Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,85 @@
package haxe;
//TODO: extend ::std::exception
@:coreApi
class Exception {
public var message(get,never):String;
public var stack(get,never):CallStack;
public var previous(get,never):Null<Exception>;
public var native(get,never):Any;
@:noCompletion var __exceptionMessage:String;
@:noCompletion var __exceptionStack:Null<CallStack>;
@:noCompletion var __nativeStack:Array<String>;
@:noCompletion @:ifFeature("haxe.Exception.get_stack") var __skipStack:Int = 0;
@:noCompletion var __nativeException:Any;
@:noCompletion var __previousException:Null<Exception>;
static function caught(value:Any):Exception {
if(Std.isOfType(value, Exception)) {
return value;
} else {
return new ValueException(value, null, value);
}
}
static function thrown(value:Any):Any {
if(Std.isOfType(value, Exception)) {
return (value:Exception).native;
} else {
var e = new ValueException(value);
e.__shiftStack();
return e;
}
}
public function new(message:String, ?previous:Exception, ?native:Any) {
__exceptionMessage = message;
__previousException = previous;
if(native != null) {
__nativeStack = NativeStackTrace.exceptionStack();
__nativeException = native;
} else {
__nativeStack = NativeStackTrace.callStack();
__nativeException = this;
}
}
function unwrap():Any {
return __nativeException;
}
public function toString():String {
return message;
}
public function details():String {
return inline CallStack.exceptionToString(this);
}
@:noCompletion
@:ifFeature("haxe.Exception.get_stack")
inline function __shiftStack():Void {
__skipStack++;
}
function get_message():String {
return __exceptionMessage;
}
function get_previous():Null<Exception> {
return __previousException;
}
final function get_native():Any {
return __nativeException;
}
function get_stack():CallStack {
return switch __exceptionStack {
case null: __exceptionStack = NativeStackTrace.toHaxe(__nativeStack, __skipStack);
case s: s;
}
}
}

View File

@ -0,0 +1,418 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe;
import haxe.Int64Helper;
@:notNull
@:include("cpp/Int64.h")
@:native("cpp::Int64Struct")
private extern class ___Int64 {
@:native("_hx_int64_make")
static function make(high:Int32, low:Int32):__Int64;
@:native(" ::cpp::Int64Struct")
static function ofInt(value:Int):__Int64;
@:native(" ::cpp::Int64Struct::is")
static function isInt64(d:Dynamic):Bool;
@:native("_hx_int64_is_neg")
static function isNeg(a:__Int64):Bool;
@:native("_hx_int64_is_zero")
static function isZero(a:__Int64):Bool;
@:native("_hx_int64_compare")
static function compare(a:__Int64, b:__Int64):Int;
@:native("_hx_int64_ucompare")
static function ucompare(a:__Int64, b:__Int64):Int;
@:native("_hx_int64_to_string")
static function toString(a:__Int64):String;
@:native("_hx_int64_neg")
static function neg(a:__Int64):__Int64;
@:native("_hx_int64_pre_increment")
static function preIncrement(a:__Int64):__Int64;
@:native("_hx_int64_post_increment")
static function postIncrement(a:__Int64):__Int64;
@:native("_hx_int64_pre_decrement")
static function preDecrement(a:__Int64):__Int64;
@:native("_hx_int64_post_decrement")
static function postDecrement(a:__Int64):__Int64;
@:native("_hx_int64_add")
static function add(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_add")
static function addInt(a:__Int64, b:Int):__Int64;
@:native("_hx_int64_sub")
static function sub(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_sub")
static function subInt(a:__Int64, b:Int):__Int64;
@:native("_hx_int64_sub")
static function intSub(a:Int, b:__Int64):__Int64;
@:native("_hx_int64_mul")
static function mul(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_div")
static function div(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_mod")
static function mod(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_eq")
static function eq(a:__Int64, b:__Int64):Bool;
@:native("_hx_int64_eq")
static function eqInt(a:__Int64, b:Int):Bool;
@:native("_hx_int64_neq")
static function neq(a:__Int64, b:__Int64):Bool;
@:native("_hx_int64_neq")
static function neqInt(a:__Int64, b:Int):Bool;
@:native("_hx_int64_complement")
static function complement(a:__Int64):__Int64;
@:native("_hx_int64_and")
static function bitAnd(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_or")
static function bitOr(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_xor")
static function bitXor(a:__Int64, b:__Int64):__Int64;
@:native("_hx_int64_shl")
static function shl(a:__Int64, b:Int):__Int64;
@:native("_hx_int64_shr")
static function shr(a:__Int64, b:Int):__Int64;
@:native("_hx_int64_ushr")
static function ushr(a:__Int64, b:Int):__Int64;
@:native("_hx_int64_high")
static function high(a:__Int64):Int32;
@:native("_hx_int64_low")
static function low(a:__Int64):Int32;
}
private typedef __Int64 = ___Int64;
@:coreApi
@:transitive
abstract Int64(__Int64) from __Int64 to __Int64 {
public #if !cppia inline #end function copy():Int64
return this;
public static #if !cppia inline #end function make(high:Int32, low:Int32):Int64 {
return __Int64.make(high, low);
}
@:from
public static #if !cppia inline #end function ofInt(x:Int):Int64 {
return __Int64.ofInt(x);
}
public static #if !cppia inline #end function toInt(x:Int64):Int {
if (x.high != x.low >> 31)
throw "Overflow";
return x.low;
}
@:deprecated('haxe.Int64.is() is deprecated. Use haxe.Int64.isInt64() instead')
inline public static function is(val:Dynamic):Bool {
return isInt64(val);
}
public static #if !cppia inline #end function isInt64(val:Dynamic):Bool
return __Int64.isInt64(val);
@:deprecated("Use high instead")
public static #if !cppia inline #end function getHigh(x:Int64):Int32
return x.high;
@:deprecated("Use low instead")
public static #if !cppia inline #end function getLow(x:Int64):Int32
return x.low;
public static #if !cppia inline #end function isNeg(x:Int64):Bool
return __Int64.isNeg(x);
public static #if !cppia inline #end function isZero(x:Int64):Bool
return __Int64.isZero(x);
public static #if !cppia inline #end function compare(a:Int64, b:Int64):Int
return __Int64.compare(a, b);
public static #if !cppia inline #end function ucompare(a:Int64, b:Int64):Int
return __Int64.ucompare(a, b);
public static #if !cppia inline #end function toStr(x:Int64):String
return x.toString();
private #if !cppia inline #end function toString():String
return __Int64.toString(this);
public static function parseString(sParam:String):Int64 {
return Int64Helper.parseString(sParam);
}
public static function fromFloat(f:Float):Int64 {
return Int64Helper.fromFloat(f);
}
public static function divMod(dividend:Int64, divisor:Int64):{quotient:Int64, modulus:Int64} {
var q = dividend / divisor;
if (isZero(divisor))
throw "divide by zero";
var m = dividend - q * divisor;
return {quotient: q, modulus: m};
}
@:op(-A)
public static #if !cppia inline #end function neg(x:Int64):Int64
return __Int64.neg(x);
@:op(++A) private inline function preIncrement():Int64 {
#if cppia
this = this + make(0, 1);
return this;
#else
return __Int64.preIncrement(this);
#end
}
@:op(A++) private inline function postIncrement():Int64 {
#if cppia
var result = this;
this = this + make(0, 1);
return result;
#else
return __Int64.postIncrement(this);
#end
}
@:op(--A) private inline function preDecrement():Int64 {
#if cppia
untyped this = this - make(0, 1);
return this;
#else
return __Int64.preDecrement(this);
#end
}
@:op(A--) private inline function postDecrement():Int64 {
#if cppia
var result = this;
this = this - make(0, 1);
return result;
#else
return __Int64.postDecrement(this);
#end
}
@:op(A + B)
public static #if !cppia inline #end function add(a:Int64, b:Int64):Int64
return __Int64.add(a, b);
@:op(A + B)
@:commutative
private static #if !cppia inline #end function addInt(a:Int64, b:Int):Int64
return __Int64.addInt(a, b);
@:op(A - B)
public static #if !cppia inline #end function sub(a:Int64, b:Int64):Int64 {
return __Int64.sub(a, b);
}
@:op(A - B)
private static #if !cppia inline #end function subInt(a:Int64, b:Int):Int64
return __Int64.subInt(a, b);
@:op(A - B)
private static #if !cppia inline #end function intSub(a:Int, b:Int64):Int64
return __Int64.intSub(a, b);
@:op(A * B)
public static #if !cppia inline #end function mul(a:Int64, b:Int64):Int64
return __Int64.mul(a, b);
@:op(A * B)
@:commutative
private static #if !cppia inline #end function mulInt(a:Int64, b:Int):Int64
return mul(a, b);
@:op(A / B)
public static #if !cppia inline #end function div(a:Int64, b:Int64):Int64 {
if (__Int64.isZero(b))
throw "divide by zero";
return __Int64.div(a, b);
}
@:op(A / B)
private static #if !cppia inline #end function divInt(a:Int64, b:Int):Int64
return div(a, b);
@:op(A / B)
private static #if !cppia inline #end function intDiv(a:Int, b:Int64):Int64
return toInt(div(a, b));
@:op(A % B)
public static #if !cppia inline #end function mod(a:Int64, b:Int64):Int64 {
if (__Int64.isZero(b))
throw "divide by zero";
return __Int64.mod(a, b);
}
@:op(A % B)
private static #if !cppia inline #end function modInt(a:Int64, b:Int):Int64
return toInt(mod(a, b));
@:op(A % B)
private static #if !cppia inline #end function intMod(a:Int, b:Int64):Int64
return toInt(mod(a, b));
@:op(A == B)
public static #if !cppia inline #end function eq(a:Int64, b:Int64):Bool
return __Int64.eq(a, b);
@:op(A == B)
@:commutative
private static #if !cppia inline #end function eqInt(a:Int64, b:Int):Bool
return __Int64.eqInt(a, b);
@:op(A != B)
public static #if !cppia inline #end function neq(a:Int64, b:Int64):Bool
return __Int64.neq(a, b);
@:op(A != B)
@:commutative
private static #if !cppia inline #end function neqInt(a:Int64, b:Int):Bool
return neq(a, b);
@:op(A < B)
private static #if !cppia inline #end function lt(a:Int64, b:Int64):Bool
return compare(a, b) < 0;
@:op(A < B)
private static #if !cppia inline #end function ltInt(a:Int64, b:Int):Bool
return lt(a, b);
@:op(A < B)
private static #if !cppia inline #end function intLt(a:Int, b:Int64):Bool
return lt(a, b);
@:op(A <= B)
private static #if !cppia inline #end function lte(a:Int64, b:Int64):Bool
return compare(a, b) <= 0;
@:op(A <= B)
private static #if !cppia inline #end function lteInt(a:Int64, b:Int):Bool
return lte(a, b);
@:op(A <= B)
private static #if !cppia inline #end function intLte(a:Int, b:Int64):Bool
return lte(a, b);
@:op(A > B)
private static #if !cppia inline #end function gt(a:Int64, b:Int64):Bool
return compare(a, b) > 0;
@:op(A > B)
private static #if !cppia inline #end function gtInt(a:Int64, b:Int):Bool
return gt(a, b);
@:op(A > B)
private static #if !cppia inline #end function intGt(a:Int, b:Int64):Bool
return gt(a, b);
@:op(A >= B)
private static #if !cppia inline #end function gte(a:Int64, b:Int64):Bool
return compare(a, b) >= 0;
@:op(A >= B)
private static #if !cppia inline #end function gteInt(a:Int64, b:Int):Bool
return gte(a, b);
@:op(A >= B)
private static #if !cppia inline #end function intGte(a:Int, b:Int64):Bool
return gte(a, b);
@:op(~A)
private static #if !cppia inline #end function complement(a:Int64):Int64
return __Int64.complement(a);
@:op(A & B)
public static #if !cppia inline #end function and(a:Int64, b:Int64):Int64
return __Int64.bitAnd(a, b);
@:op(A | B)
public static #if !cppia inline #end function or(a:Int64, b:Int64):Int64
return __Int64.bitOr(a, b);
@:op(A ^ B)
public static #if !cppia inline #end function xor(a:Int64, b:Int64):Int64
return __Int64.bitXor(a, b);
@:op(A << B)
public static #if !cppia inline #end function shl(a:Int64, b:Int):Int64
return __Int64.shl(a, b);
@:op(A >> B)
public static #if !cppia inline #end function shr(a:Int64, b:Int):Int64
return __Int64.shr(a, b);
@:op(A >>> B)
public static #if !cppia inline #end function ushr(a:Int64, b:Int):Int64
return __Int64.ushr(a, b);
public var high(get, never):Int32;
private #if !cppia inline #end function get_high():Int32
return __Int64.high(this);
public var low(get, never):Int32;
private #if !cppia inline #end function get_low():Int32
return __Int64.low(this);
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe;
@:coreApi class Log {
@:native("__trace")
extern private static function nativeTrace(message:String, posInfo:Dynamic):Void;
public static dynamic function trace(v:Dynamic, ?infos:PosInfos):Void {
if (infos != null && infos.customParams != null) {
var extra:String = "";
for (v in infos.customParams)
extra += "," + v;
nativeTrace(v + extra, infos);
} else
nativeTrace(v, infos);
}
public static function formatOutput(v:Dynamic, infos:PosInfos):String {
var str = Std.string(v);
if (infos == null)
return str;
var pstr = infos.fileName + ":" + infos.lineNumber;
if (infos != null && infos.customParams != null)
for (v in infos.customParams)
str += ", " + Std.string(v);
return pstr + ": " + str;
}
}

View File

@ -0,0 +1,42 @@
package haxe;
import haxe.CallStack.StackItem;
/**
Do not use manually.
**/
@:dox(hide)
@:noCompletion
class NativeStackTrace {
@:ifFeature('haxe.NativeStackTrace.exceptionStack')
static public inline function saveStack(exception:Any):Void {
}
@:noDebug //Do not mess up the exception stack
static public function callStack():Array<String> {
return untyped __global__.__hxcpp_get_call_stack(true);
}
@:noDebug //Do not mess up the exception stack/
static public function exceptionStack():Array<String> {
return untyped __global__.__hxcpp_get_exception_stack();
}
static public function toHaxe(native:Array<String>, skip:Int = 0):Array<StackItem> {
var stack:Array<String> = native;
var m = new Array<StackItem>();
for (i in 0...stack.length) {
if(skip > i) {
continue;
}
var words = stack[i].split("::");
if (words.length == 0)
m.push(CFunction)
else if (words.length == 2)
m.push(Method(words[0], words[1]));
else if (words.length == 4)
m.push(FilePos(Method(words[0], words[1]), words[2], Std.parseInt(words[3])));
}
return m;
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe;
@:coreApi
class Resource {
public static function listNames():Array<String> {
return untyped __global__.__hxcpp_resource_names();
}
public static function getString(name:String):String {
return untyped __global__.__hxcpp_resource_string(name);
}
public static function getBytes(name:String):haxe.io.Bytes {
var array:haxe.io.BytesData = untyped __global__.__hxcpp_resource_bytes(name);
if (array == null)
return null;
return haxe.io.Bytes.ofData(array);
}
}

View File

@ -0,0 +1,85 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe;
using cpp.NativeString;
@:coreApi
@:deprecated('haxe.Utf8 is deprecated. Use UnicodeString instead.')
class Utf8 {
var __s:Array<Int>;
public function new(?size:Int):Void {
__s = new Array<Int>();
if (size != null && size > 0)
cpp.NativeArray.reserve(__s, size);
}
public function addChar(c:Int):Void {
__s.push(c);
}
public function toString():String {
return untyped __global__.__hxcpp_char_array_to_utf8_string(__s);
}
// Incoming string is array of bytes containing possibly invalid utf8 chars
// Result is the same string with the bytes expanded into utf8 sequences
public static function encode(s:String):String {
return untyped __global__.__hxcpp_char_bytes_to_utf8_string(s);
}
// Incoming string is array of bytes representing valid utf8 chars
// Result is a string containing the compressed bytes
public static function decode(s:String):String {
return untyped __global__.__hxcpp_utf8_string_to_char_bytes(s);
}
public #if !cppia inline #end static function iter(s:String, chars:Int->Void):Void {
var src = s.c_str();
var end = src.add(s.length);
while (src.lt(end))
chars(src.ptr.utf8DecodeAdvance());
}
public static function charCodeAt(s:String, index:Int):Int {
return s.utf8CharCodeAt(index);
}
public static function validate(s:String):Bool {
return s.utf8IsValid();
}
public static function length(s:String):Int {
return s.utf8Length();
}
public static function compare(a:String, b:String):Int {
return a.compare(b);
}
public static function sub(s:String, pos:Int, len:Int):String {
return s.utf8Sub(pos, len);
}
}

View File

@ -0,0 +1,142 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.ds;
@:headerClassCode("
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); }
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); }
")
@:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int, T> {
@:ifFeature("haxe.ds.IntMap.*")
private var h:Dynamic;
public function new():Void {}
public function set(key:Int, value:T):Void {
untyped __global__.__int_hash_set(__cpp__("HX_MAP_THIS"), key, value);
}
public function get(key:Int):Null<T> {
return untyped __global__.__int_hash_get(h, key);
}
public function exists(key:Int):Bool {
return untyped __global__.__int_hash_exists(h, key);
}
public function remove(key:Int):Bool {
return untyped __global__.__int_hash_remove(h, key);
}
public function keys():Iterator<Int> {
var a:Array<Int> = untyped __global__.__int_hash_keys(h);
return a.iterator();
}
public function iterator():Iterator<T> {
var a:Array<Dynamic> = untyped __global__.__int_hash_values(h);
return a.iterator();
}
@:runtime public inline function keyValueIterator():KeyValueIterator<Int, T> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():IntMap<T> {
var copied = new IntMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
return untyped __global__.__int_hash_to_string(h);
}
public function clear():Void {
#if (hxcpp_api_level >= 400)
return untyped __global__.__int_hash_clear(h);
#else
h = null;
#end
}
#if (scriptable)
private function setString(key:Int, val:String):Void {
untyped __int_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
}
private function setInt(key:Int, val:Int):Void {
untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setBool(key:Int, val:Bool):Void {
untyped __int_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setFloat(key:Int, val:Float):Void {
untyped __int_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
}
private function getString(key:Int):String {
return untyped __int_hash_get_string(h, key);
}
private function getInt(key:Int):Int {
return untyped __int_hash_get_int(h, key);
}
private function getBool(key:Int):Bool {
return untyped __int_hash_get_bool(h, key);
}
private function getFloat(key:Int):Float {
return untyped __int_hash_get_float(h, key);
}
#end
}

View File

@ -0,0 +1,142 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.ds;
@:headerClassCode("
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); }
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); }
")
@:coreApi
class ObjectMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
@:ifFeature("haxe.ds.ObjectMap.*")
private var h:Dynamic;
public function new():Void {}
public function set(key:K, value:V):Void {
untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"), key, value);
}
public function get(key:K):Null<V> {
return untyped __global__.__object_hash_get(h, key);
}
public function exists(key:K):Bool {
return untyped __global__.__object_hash_exists(h, key);
}
public function remove(key:K):Bool {
return untyped __global__.__object_hash_remove(h, key);
}
public function keys():Iterator<K> {
var a:Array<K> = untyped __global__.__object_hash_keys(h);
return a.iterator();
}
public function iterator():Iterator<V> {
var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
return a.iterator();
}
@:runtime public inline function keyValueIterator():KeyValueIterator<K, V> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():ObjectMap<K, V> {
var copied = new ObjectMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
return untyped __global__.__object_hash_to_string(h);
}
public function clear():Void {
#if (hxcpp_api_level >= 400)
return untyped __global__.__object_hash_clear(h);
#else
h = null;
#end
}
#if (scriptable)
private function setString(key:Dynamic, val:String):Void {
untyped __object_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
}
private function setInt(key:Dynamic, val:Int):Void {
untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setBool(key:Dynamic, val:Bool):Void {
untyped __object_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setFloat(key:Dynamic, val:Float):Void {
untyped __object_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
}
private function getString(key:Dynamic):String {
return untyped __object_hash_get_string(h, key);
}
private function getInt(key:Dynamic):Int {
return untyped __object_hash_get_int(h, key);
}
private function getBool(key:Dynamic):Bool {
return untyped __object_hash_get_bool(h, key);
}
private function getFloat(key:Dynamic):Float {
return untyped __object_hash_get_float(h, key);
}
#end
}

View File

@ -0,0 +1,142 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.ds;
@:headerClassCode("
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); }
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); }
")
@:coreApi class StringMap<T> implements haxe.Constraints.IMap<String, T> {
@:ifFeature("haxe.ds.StringMap.*")
private var h:Dynamic;
public function new():Void {}
public function set(key:String, value:T):Void {
untyped __global__.__string_hash_set(__cpp__("HX_MAP_THIS"), key, value);
}
public function get(key:String):Null<T> {
return untyped __global__.__string_hash_get(h, key);
}
public function exists(key:String):Bool {
return untyped __global__.__string_hash_exists(h, key);
}
public function remove(key:String):Bool {
return untyped __global__.__string_hash_remove(h, key);
}
public function keys():Iterator<String> {
var a:Array<String> = untyped __global__.__string_hash_keys(h);
return a.iterator();
}
public function iterator():Iterator<T> {
var a:Array<Dynamic> = untyped __global__.__string_hash_values(h);
return a.iterator();
}
@:runtime public inline function keyValueIterator():KeyValueIterator<String, T> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():StringMap<T> {
var copied = new StringMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
return untyped __global__.__string_hash_to_string(h);
}
public function clear():Void {
#if (hxcpp_api_level >= 400)
return untyped __global__.__string_hash_clear(h);
#else
h = null;
#end
}
#if (scriptable)
private function setString(key:String, val:String):Void {
untyped __string_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
}
private function setInt(key:String, val:Int):Void {
untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setBool(key:String, val:Bool):Void {
untyped __string_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
}
private function setFloat(key:String, val:Float):Void {
untyped __string_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
}
private function getString(key:String):String {
return untyped __string_hash_get_string(h, key);
}
private function getInt(key:String):Int {
return untyped __string_hash_get_int(h, key);
}
private function getBool(key:String):Bool {
return untyped __string_hash_get_bool(h, key);
}
private function getFloat(key:String):Float {
return untyped __string_hash_get_float(h, key);
}
#end
}

View File

@ -0,0 +1,101 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.ds;
@:headerClassCode("
inline void set(Dynamic key, ::null value) { __object_hash_set(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, bool value) { __object_hash_set(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, char value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, unsigned char value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, signed char value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, short value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, unsigned short value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, int value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, unsigned int value) { __object_hash_set_int(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, float value) { __object_hash_set_float(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, double value) { __object_hash_set_float(HX_MAP_THIS,key,value,true); }
inline void set(Dynamic key, ::String value) { __object_hash_set_string(HX_MAP_THIS,key,value,true); }
template<typename V, typename H>
inline void set(Dynamic key, const ::cpp::Struct<V,H> &value) {__object_hash_set(HX_MAP_THIS,key,value,true); }
template<typename V>
inline void set(Dynamic key, const ::cpp::Pointer<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value,true ); }
template<typename V>
inline void set(Dynamic key, const ::cpp::Function<V> &value) {__object_hash_set(HX_MAP_THIS,key,(Dynamic)value,true ); }
")
@:coreApi
class WeakMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
@:ifFeature("haxe.ds.WeakMap.*")
private var h:Dynamic;
public function new():Void {}
public function set(key:K, value:V):Void {
untyped __global__.__object_hash_set(__cpp__("HX_MAP_THIS"), key, value, true);
}
public function get(key:K):Null<V> {
return untyped __global__.__object_hash_get(h, key);
}
public function exists(key:K):Bool {
return untyped __global__.__object_hash_exists(h, key);
}
public function remove(key:K):Bool {
return untyped __global__.__object_hash_remove(h, key);
}
public function keys():Iterator<K> {
var a:Array<K> = untyped __global__.__object_hash_keys(h);
return a.iterator();
}
public function iterator():Iterator<V> {
var a:Array<Dynamic> = untyped __global__.__object_hash_values(h);
return a.iterator();
}
public inline function keyValueIterator():KeyValueIterator<K, V> {
return new haxe.iterators.MapKeyValueIterator(this);
}
public function copy():WeakMap<K, V> {
var copied = new WeakMap();
for (key in keys())
copied.set(key, get(key));
return copied;
}
public function toString():String {
return untyped __global__.__object_hash_to_string(h);
}
public function clear():Void {
#if (hxcpp_api_level >= 400)
return untyped __global__.__object_hash_clear(h);
#else
h = null;
#end
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.zip;
@:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml" />')
class Compress {
var s:Dynamic;
public function new(level:Int):Void {
s = _deflate_init(level);
}
public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
return _deflate_buffer(s, src.getData(), srcPos, dst.getData(), dstPos);
}
public function setFlushMode(f:FlushMode):Void {
_set_flush_mode(s, Std.string(f));
}
public function close():Void {
_deflate_end(s);
}
public static function run(s:haxe.io.Bytes, level:Int):haxe.io.Bytes {
var c = new Compress(level);
c.setFlushMode(FlushMode.FINISH);
var out = haxe.io.Bytes.alloc(_deflate_bound(c.s, s.length));
var r = c.execute(s, 0, out, 0);
c.close();
if (!r.done || r.read != s.length)
throw "Compression failed";
return out.sub(0, r.write);
}
@:native("_hx_deflate_init")
extern static function _deflate_init(level:Int):Dynamic;
@:native("_hx_deflate_bound")
extern static function _deflate_bound(handle:Dynamic, length:Int):Int;
@:native("_hx_deflate_buffer")
extern static function _deflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int, dest:haxe.io.BytesData,
destPos:Int):{done:Bool, read:Int, write:Int};
@:native("_hx_deflate_end")
extern static function _deflate_end(handle:Dynamic):Void;
@:native("_hx_zip_set_flush_mode")
extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
}

View File

@ -0,0 +1,76 @@
/*
* Copyright (C)2005-2019 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.
*/
package haxe.zip;
@:coreApi @:buildXml('<include name="${HXCPP}/src/hx/libs/zlib/Build.xml"/>')
class Uncompress {
var s:Dynamic;
public function new(?windowBits:Int):Void {
s = _inflate_init(windowBits);
}
public function execute(src:haxe.io.Bytes, srcPos:Int, dst:haxe.io.Bytes, dstPos:Int):{done:Bool, read:Int, write:Int} {
return _inflate_buffer(s, src.getData(), srcPos, dst.getData(), dstPos);
}
public function setFlushMode(f:FlushMode):Void {
_set_flush_mode(s, untyped f.__Tag());
}
public function close():Void {
_inflate_end(s);
}
public static function run(src:haxe.io.Bytes, ?bufsize:Int):haxe.io.Bytes {
var u = new Uncompress(null);
if (bufsize == null)
bufsize = 1 << 16; // 64K
var tmp = haxe.io.Bytes.alloc(bufsize);
var b = new haxe.io.BytesBuffer();
var pos = 0;
u.setFlushMode(FlushMode.SYNC);
while (true) {
var r = u.execute(src, pos, tmp, 0);
b.addBytes(tmp, 0, r.write);
pos += r.read;
if (r.done)
break;
}
u.close();
return b.getBytes();
}
@:native("_hx_inflate_init")
extern static function _inflate_init(windowBits:Dynamic):Dynamic;
@:native("_hx_inflate_buffer")
extern static function _inflate_buffer(handle:Dynamic, src:haxe.io.BytesData, srcPos:Int, dest:haxe.io.BytesData,
destPos:Int):{done:Bool, read:Int, write:Int};
@:native("_hx_inflate_end")
extern static function _inflate_end(handle:Dynamic):Void;
@:native("_hx_zip_set_flush_mode")
extern static function _set_flush_mode(handle:Dynamic, flushMode:String):Void;
}