forked from LeenkxTeam/LNXSDK
Update
This commit is contained in:
@ -22,7 +22,21 @@
|
||||
|
||||
package cpp;
|
||||
|
||||
@:coreType @:notNull @:runtimeValue abstract Int64 from Int to Int {
|
||||
@:coreType @:notNull @:runtimeValue abstract Int64 from Int {
|
||||
|
||||
/**
|
||||
Destructively cast to Int
|
||||
**/
|
||||
public inline function toInt():Int {
|
||||
return cast this;
|
||||
}
|
||||
|
||||
@:to
|
||||
@:deprecated("Implicit cast from Int64 to Int (32 bits) is deprecated. Use .toInt() or explicitly cast instead.")
|
||||
inline function implicitToInt(): Int {
|
||||
return toInt();
|
||||
}
|
||||
|
||||
@:to
|
||||
#if !cppia inline #end function toInt64():haxe.Int64 {
|
||||
return cast this;
|
||||
|
||||
154
Kha/Tools/windows_x64/std/cpp/Int64Map.hx
Normal file
154
Kha/Tools/windows_x64/std/cpp/Int64Map.hx
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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 cpp;
|
||||
|
||||
import haxe.Int64;
|
||||
|
||||
@:headerClassCode("
|
||||
inline void set(cpp::Int64 key, ::null value) { __int64_hash_set(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, bool value) { __int64_hash_set(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, char value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, unsigned char value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, signed char value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, short value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, unsigned short value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, int value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, unsigned int value) { __int64_hash_set_int(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, float value) { __int64_hash_set_float(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, double value) { __int64_hash_set_float(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, ::String value) { __int64_hash_set_string(HX_MAP_THIS,key,value); }
|
||||
inline void set(cpp::Int64 key, cpp::Int64 value) { __int64_hash_set_int64(HX_MAP_THIS,key,value); }
|
||||
|
||||
template<typename V, typename H>
|
||||
inline void set(cpp::Int64 key, const ::cpp::Struct<V,H> &value) {__int64_hash_set(HX_MAP_THIS,key,value); }
|
||||
template<typename F>
|
||||
inline void set(cpp::Int64 key, const ::cpp::Function<F> &value) {__int64_hash_set(HX_MAP_THIS,key,value); }
|
||||
template<typename V>
|
||||
inline void set(cpp::Int64 key, const ::cpp::Pointer<V> &value) {__int64_hash_set(HX_MAP_THIS,key,(Dynamic)value ); }
|
||||
|
||||
template<typename VALUE>
|
||||
inline void set(Dynamic &key, const VALUE &value) { set( (cpp::Int64)key, value ); }
|
||||
|
||||
inline bool get_bool(cpp::Int64 key) { return __int64_hash_get_bool(h,key); }
|
||||
inline int get_int(cpp::Int64 key) { return __int64_hash_get_int(h,key); }
|
||||
inline Float get_float(cpp::Int64 key) { return __int64_hash_get_float(h,key); }
|
||||
inline String get_string(cpp::Int64 key) { return __int64_hash_get_string(h,key); }
|
||||
inline cpp::Int64 get_int64(cpp::Int64 key) { return __int64_hash_get_int64(h,key); }
|
||||
")
|
||||
@:coreApi class Int64Map<T> implements haxe.Constraints.IMap<Int64, T> {
|
||||
@:ifFeature("cpp.Int64Map.*")
|
||||
private var h:Dynamic;
|
||||
|
||||
public function new():Void {}
|
||||
|
||||
public function set(key:Int64, value:T):Void {
|
||||
untyped __global__.__int64_hash_set(__cpp__("HX_MAP_THIS"), key, value);
|
||||
}
|
||||
|
||||
public function get(key:Int64):Null<T> {
|
||||
return untyped __global__.__int64_hash_get(h, key);
|
||||
}
|
||||
|
||||
public function exists(key:Int64):Bool {
|
||||
return untyped __global__.__int64_hash_exists(h, key);
|
||||
}
|
||||
|
||||
public function remove(key:Int64):Bool {
|
||||
return untyped __global__.__int64_hash_remove(h, key);
|
||||
}
|
||||
|
||||
public function keys():Iterator<Int64> {
|
||||
var a:Array<Int64> = untyped __global__.__int64_hash_keys(h);
|
||||
return a.iterator();
|
||||
}
|
||||
|
||||
public function iterator():Iterator<T> {
|
||||
var a:Array<Dynamic> = untyped __global__.__int64_hash_values(h);
|
||||
return a.iterator();
|
||||
}
|
||||
|
||||
@:runtime public inline function keyValueIterator():KeyValueIterator<Int64, T> {
|
||||
return new haxe.iterators.MapKeyValueIterator(this);
|
||||
}
|
||||
|
||||
public function copy():Int64Map<T> {
|
||||
var copied = new Int64Map();
|
||||
for (key in keys())
|
||||
copied.set(key, get(key));
|
||||
return copied;
|
||||
}
|
||||
|
||||
public function toString():String {
|
||||
return untyped __global__.__int64_hash_to_string(h);
|
||||
}
|
||||
|
||||
public function clear():Void {
|
||||
#if (hxcpp_api_level >= 400)
|
||||
return untyped __global__.__int64_hash_clear(h);
|
||||
#else
|
||||
h = null;
|
||||
#end
|
||||
}
|
||||
|
||||
#if (scriptable)
|
||||
private function setString(key:Int64, val:String):Void {
|
||||
untyped __int64_hash_set_string(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setInt(key:Int64, val:Int):Void {
|
||||
untyped __int64_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setBool(key:Int64, val:Bool):Void {
|
||||
untyped __int64_hash_set_int(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setFloat(key:Int64, val:Float):Void {
|
||||
untyped __int64_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setInt64(key:Int64, val:Int64):Void {
|
||||
untyped __int64_hash_set_int64(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function getString(key:Int64):String {
|
||||
return untyped __int64_hash_get_string(h, key);
|
||||
}
|
||||
|
||||
private function getInt(key:Int64):Int {
|
||||
return untyped __int64_hash_get_int(h, key);
|
||||
}
|
||||
|
||||
private function getBool(key:Int64):Bool {
|
||||
return untyped __int64_hash_get_bool(h, key);
|
||||
}
|
||||
|
||||
private function getFloat(key:Int64):Float {
|
||||
return untyped __int64_hash_get_float(h, key);
|
||||
}
|
||||
|
||||
private function getInt64(key:Int64):Int64 {
|
||||
return untyped __int64_hash_get_int64(h, key);
|
||||
}
|
||||
#end
|
||||
}
|
||||
@ -79,7 +79,7 @@ class Lib {
|
||||
}
|
||||
|
||||
@:noDebug @:native("HX_STACK_DO_RETHROW")
|
||||
extern static function do_rethrow(inExp:Dynamic);
|
||||
extern static function do_rethrow(inExp:Dynamic):Void;
|
||||
|
||||
@:noDebug #if (!cppia) inline #end
|
||||
public static function rethrow(inExp:Dynamic) {
|
||||
|
||||
@ -43,7 +43,7 @@ extern class NativeProcess {
|
||||
static function process_stdin_close(handle:Dynamic):Void;
|
||||
|
||||
@:native("_hx_std_process_exit")
|
||||
static function process_exit(handle:Dynamic):Int;
|
||||
static function process_exit(handle:Dynamic, block:Bool):Dynamic;
|
||||
|
||||
@:native("_hx_std_process_pid")
|
||||
static function process_pid(handle:Dynamic):Int;
|
||||
|
||||
@ -34,7 +34,7 @@ extern class NativeSys {
|
||||
extern static function get_env(v:String):String;
|
||||
|
||||
@:native("_hx_std_put_env")
|
||||
extern static function put_env(e:String, v:String):Void;
|
||||
extern static function put_env(e:String, v:Null<String>):Void;
|
||||
|
||||
@:native("_hx_std_sys_sleep")
|
||||
extern static function sys_sleep(f:Float):Void;
|
||||
|
||||
@ -221,7 +221,7 @@ class Xml {
|
||||
function new():Void {}
|
||||
|
||||
@:native("parse_xml")
|
||||
extern static function parse_xml(str:String, state:NativeXmlState);
|
||||
extern static function parse_xml(str:String, state:NativeXmlState):String;
|
||||
|
||||
public static function parse(str:String):Xml {
|
||||
var x = new Xml();
|
||||
|
||||
@ -22,4 +22,19 @@
|
||||
|
||||
package cpp;
|
||||
|
||||
@:coreType @:notNull @:runtimeValue abstract UInt64 from Int to Int {}
|
||||
@:coreType @:notNull @:runtimeValue abstract UInt64 from Int {
|
||||
|
||||
/**
|
||||
Destructively cast to Int
|
||||
**/
|
||||
public inline function toInt():Int {
|
||||
return cast this;
|
||||
}
|
||||
|
||||
@:to
|
||||
@:deprecated("Implicit cast from UInt64 to Int (32 bits) is deprecated. Use .toInt() or explicitly cast instead.")
|
||||
inline function implicitToInt(): Int {
|
||||
return toInt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ import haxe.SysTools;
|
||||
return v;
|
||||
}
|
||||
|
||||
public static function putEnv(s:String, v:String):Void {
|
||||
public static function putEnv(s:String, v:Null<String>):Void {
|
||||
NativeSys.put_env(s, v);
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,10 @@ class Exception {
|
||||
if(Std.isOfType(value, Exception)) {
|
||||
return value;
|
||||
} else {
|
||||
return new ValueException(value, null, value);
|
||||
var e = new ValueException(value, null, value);
|
||||
// Undo automatic __shiftStack()
|
||||
e.__unshiftStack();
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +66,12 @@ class Exception {
|
||||
__skipStack++;
|
||||
}
|
||||
|
||||
@:noCompletion
|
||||
@:ifFeature("haxe.Exception.get_stack")
|
||||
inline function __unshiftStack():Void {
|
||||
__skipStack--;
|
||||
}
|
||||
|
||||
function get_message():String {
|
||||
return __exceptionMessage;
|
||||
}
|
||||
|
||||
@ -22,13 +22,8 @@
|
||||
|
||||
package haxe;
|
||||
|
||||
import haxe.Int64Helper;
|
||||
|
||||
@:notNull
|
||||
@:include("cpp/Int64.h")
|
||||
@:native("cpp::Int64Struct")
|
||||
private extern class ___Int64 {
|
||||
|
||||
private extern class NativeInt64Helper {
|
||||
@:native("_hx_int64_make")
|
||||
static function make(high:Int32, low:Int32):__Int64;
|
||||
|
||||
@ -132,21 +127,21 @@ private extern class ___Int64 {
|
||||
static function low(a:__Int64):Int32;
|
||||
}
|
||||
|
||||
private typedef __Int64 = ___Int64;
|
||||
private typedef __Int64 = cpp.Int64;
|
||||
|
||||
@:coreApi
|
||||
@:transitive
|
||||
abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
@:notNull
|
||||
abstract Int64(__Int64) from __Int64 from Int 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);
|
||||
return NativeInt64Helper.make(high, low);
|
||||
}
|
||||
|
||||
@:from
|
||||
public static #if !cppia inline #end function ofInt(x:Int):Int64 {
|
||||
return __Int64.ofInt(x);
|
||||
return x;
|
||||
}
|
||||
|
||||
public static #if !cppia inline #end function toInt(x:Int64):Int {
|
||||
@ -158,11 +153,11 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
|
||||
@:deprecated('haxe.Int64.is() is deprecated. Use haxe.Int64.isInt64() instead')
|
||||
inline public static function is(val:Dynamic):Bool {
|
||||
return isInt64(val);
|
||||
return val is cpp.Int64;
|
||||
}
|
||||
|
||||
public static #if !cppia inline #end function isInt64(val:Dynamic):Bool
|
||||
return __Int64.isInt64(val);
|
||||
return val is cpp.Int64;
|
||||
|
||||
@:deprecated("Use high instead")
|
||||
public static #if !cppia inline #end function getHigh(x:Int64):Int32
|
||||
@ -173,22 +168,22 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
return x.low;
|
||||
|
||||
public static #if !cppia inline #end function isNeg(x:Int64):Bool
|
||||
return __Int64.isNeg(x);
|
||||
return NativeInt64Helper.isNeg(x);
|
||||
|
||||
public static #if !cppia inline #end function isZero(x:Int64):Bool
|
||||
return __Int64.isZero(x);
|
||||
return NativeInt64Helper.isZero(x);
|
||||
|
||||
public static #if !cppia inline #end function compare(a:Int64, b:Int64):Int
|
||||
return __Int64.compare(a, b);
|
||||
return NativeInt64Helper.compare(a, b);
|
||||
|
||||
public static #if !cppia inline #end function ucompare(a:Int64, b:Int64):Int
|
||||
return __Int64.ucompare(a, b);
|
||||
return NativeInt64Helper.ucompare(a, b);
|
||||
|
||||
public static #if !cppia inline #end function toStr(x:Int64):String
|
||||
return x.toString();
|
||||
return cast x.val;
|
||||
|
||||
private #if !cppia inline #end function toString():String
|
||||
return __Int64.toString(this);
|
||||
return cast this;
|
||||
|
||||
public static function parseString(sParam:String):Int64 {
|
||||
return Int64Helper.parseString(sParam);
|
||||
@ -201,7 +196,7 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
public static function divMod(dividend:Int64, divisor:Int64):{quotient:Int64, modulus:Int64} {
|
||||
var q = dividend / divisor;
|
||||
|
||||
if (isZero(divisor))
|
||||
if (divisor == 0)
|
||||
throw "divide by zero";
|
||||
|
||||
var m = dividend - q * divisor;
|
||||
@ -209,16 +204,16 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
return {quotient: q, modulus: m};
|
||||
}
|
||||
|
||||
@:op(-A)
|
||||
@:op(-A)
|
||||
public static #if !cppia inline #end function neg(x:Int64):Int64
|
||||
return __Int64.neg(x);
|
||||
return NativeInt64Helper.neg(x);
|
||||
|
||||
@:op(++A) private inline function preIncrement():Int64 {
|
||||
#if cppia
|
||||
this = this + make(0, 1);
|
||||
return this;
|
||||
#else
|
||||
return __Int64.preIncrement(this);
|
||||
return NativeInt64Helper.preIncrement(this);
|
||||
#end
|
||||
}
|
||||
|
||||
@ -228,7 +223,7 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
this = this + make(0, 1);
|
||||
return result;
|
||||
#else
|
||||
return __Int64.postIncrement(this);
|
||||
return NativeInt64Helper.postIncrement(this);
|
||||
#end
|
||||
}
|
||||
|
||||
@ -237,7 +232,7 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
untyped this = this - make(0, 1);
|
||||
return this;
|
||||
#else
|
||||
return __Int64.preDecrement(this);
|
||||
return NativeInt64Helper.preDecrement(this);
|
||||
#end
|
||||
}
|
||||
|
||||
@ -247,35 +242,35 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
this = this - make(0, 1);
|
||||
return result;
|
||||
#else
|
||||
return __Int64.postDecrement(this);
|
||||
return NativeInt64Helper.postDecrement(this);
|
||||
#end
|
||||
}
|
||||
|
||||
@:op(A + B)
|
||||
public static #if !cppia inline #end function add(a:Int64, b:Int64):Int64
|
||||
return __Int64.add(a, b);
|
||||
return NativeInt64Helper.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);
|
||||
return NativeInt64Helper.addInt(a, b);
|
||||
|
||||
@:op(A - B)
|
||||
public static #if !cppia inline #end function sub(a:Int64, b:Int64):Int64 {
|
||||
return __Int64.sub(a, b);
|
||||
return NativeInt64Helper.sub(a, b);
|
||||
}
|
||||
|
||||
@:op(A - B)
|
||||
private static #if !cppia inline #end function subInt(a:Int64, b:Int):Int64
|
||||
return __Int64.subInt(a, b);
|
||||
return NativeInt64Helper.subInt(a, b);
|
||||
|
||||
@:op(A - B)
|
||||
private static #if !cppia inline #end function intSub(a:Int, b:Int64):Int64
|
||||
return __Int64.intSub(a, b);
|
||||
return NativeInt64Helper.intSub(a, b);
|
||||
|
||||
@:op(A * B)
|
||||
public static #if !cppia inline #end function mul(a:Int64, b:Int64):Int64
|
||||
return __Int64.mul(a, b);
|
||||
return NativeInt64Helper.mul(a, b);
|
||||
|
||||
@:op(A * B)
|
||||
@:commutative
|
||||
@ -284,9 +279,9 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
|
||||
@:op(A / B)
|
||||
public static #if !cppia inline #end function div(a:Int64, b:Int64):Int64 {
|
||||
if (__Int64.isZero(b))
|
||||
if (NativeInt64Helper.isZero(b))
|
||||
throw "divide by zero";
|
||||
return __Int64.div(a, b);
|
||||
return NativeInt64Helper.div(a, b);
|
||||
}
|
||||
|
||||
@:op(A / B)
|
||||
@ -299,9 +294,9 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
|
||||
@:op(A % B)
|
||||
public static #if !cppia inline #end function mod(a:Int64, b:Int64):Int64 {
|
||||
if (__Int64.isZero(b))
|
||||
if (NativeInt64Helper.isZero(b))
|
||||
throw "divide by zero";
|
||||
return __Int64.mod(a, b);
|
||||
return NativeInt64Helper.mod(a, b);
|
||||
}
|
||||
|
||||
@:op(A % B)
|
||||
@ -314,16 +309,16 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
|
||||
@:op(A == B)
|
||||
public static #if !cppia inline #end function eq(a:Int64, b:Int64):Bool
|
||||
return __Int64.eq(a, b);
|
||||
return NativeInt64Helper.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);
|
||||
return NativeInt64Helper.eqInt(a, b);
|
||||
|
||||
@:op(A != B)
|
||||
public static #if !cppia inline #end function neq(a:Int64, b:Int64):Bool
|
||||
return __Int64.neq(a, b);
|
||||
return NativeInt64Helper.neq(a, b);
|
||||
|
||||
@:op(A != B)
|
||||
@:commutative
|
||||
@ -380,39 +375,44 @@ abstract Int64(__Int64) from __Int64 to __Int64 {
|
||||
|
||||
@:op(~A)
|
||||
private static #if !cppia inline #end function complement(a:Int64):Int64
|
||||
return __Int64.complement(a);
|
||||
return NativeInt64Helper.complement(a);
|
||||
|
||||
@:op(A & B)
|
||||
public static #if !cppia inline #end function and(a:Int64, b:Int64):Int64
|
||||
return __Int64.bitAnd(a, b);
|
||||
return NativeInt64Helper.bitAnd(a, b);
|
||||
|
||||
@:op(A | B)
|
||||
public static #if !cppia inline #end function or(a:Int64, b:Int64):Int64
|
||||
return __Int64.bitOr(a, b);
|
||||
return NativeInt64Helper.bitOr(a, b);
|
||||
|
||||
@:op(A ^ B)
|
||||
public static #if !cppia inline #end function xor(a:Int64, b:Int64):Int64
|
||||
return __Int64.bitXor(a, b);
|
||||
return NativeInt64Helper.bitXor(a, b);
|
||||
|
||||
@:op(A << B)
|
||||
public static #if !cppia inline #end function shl(a:Int64, b:Int):Int64
|
||||
return __Int64.shl(a, b);
|
||||
return NativeInt64Helper.shl(a, b);
|
||||
|
||||
@:op(A >> B)
|
||||
public static #if !cppia inline #end function shr(a:Int64, b:Int):Int64
|
||||
return __Int64.shr(a, b);
|
||||
return NativeInt64Helper.shr(a, b);
|
||||
|
||||
@:op(A >>> B)
|
||||
public static #if !cppia inline #end function ushr(a:Int64, b:Int):Int64
|
||||
return __Int64.ushr(a, b);
|
||||
return NativeInt64Helper.ushr(a, b);
|
||||
|
||||
public var high(get, never):Int32;
|
||||
|
||||
private #if !cppia inline #end function get_high():Int32
|
||||
return __Int64.high(this);
|
||||
return NativeInt64Helper.high(this);
|
||||
|
||||
public var low(get, never):Int32;
|
||||
|
||||
private #if !cppia inline #end function get_low():Int32
|
||||
return __Int64.low(this);
|
||||
return NativeInt64Helper.low(this);
|
||||
|
||||
private var val(get, never):__Int64;
|
||||
|
||||
private #if !cppia inline #end function get_val():__Int64
|
||||
return this;
|
||||
}
|
||||
|
||||
68
Kha/Tools/windows_x64/std/cpp/_std/haxe/atomic/AtomicInt.hx
Normal file
68
Kha/Tools/windows_x64/std/cpp/_std/haxe/atomic/AtomicInt.hx
Normal file
@ -0,0 +1,68 @@
|
||||
package haxe.atomic;
|
||||
|
||||
#if cppia
|
||||
extern
|
||||
#end
|
||||
abstract AtomicInt(cpp.Pointer<Int>) {
|
||||
#if cppia
|
||||
public function new(value:Int):Void;
|
||||
|
||||
public function add(b:Int):Int;
|
||||
|
||||
public function sub(b:Int):Int;
|
||||
|
||||
public function and(b:Int):Int;
|
||||
|
||||
public function or(b:Int):Int;
|
||||
|
||||
public function xor(b:Int):Int;
|
||||
|
||||
public function compareExchange(expected:Int, replacement:Int):Int;
|
||||
|
||||
public function exchange(value:Int):Int;
|
||||
|
||||
public function load():Int;
|
||||
|
||||
public function store(value:Int):Int;
|
||||
#else
|
||||
public #if !scriptable inline #end function new(value:Int) {
|
||||
this = cpp.Pointer.ofArray([value]);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function add(b:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_add({0}, {1})", this, b);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function sub(b:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_sub({0}, {1})", this, b);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function and(b:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_and({0}, {1})", this, b);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function or(b:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_or({0}, {1})", this, b);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function xor(b:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_xor({0}, {1})", this, b);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function compareExchange(expected:Int, replacement:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_compare_exchange({0}, {1}, {2})", this, expected, replacement);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function exchange(value:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_exchange({0}, {1})", this, value);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function load():Int {
|
||||
return untyped __cpp__("_hx_atomic_load({0})", this);
|
||||
}
|
||||
|
||||
public #if !scriptable inline #end function store(value:Int):Int {
|
||||
return untyped __cpp__("_hx_atomic_store({0}, {1})", this, value);
|
||||
}
|
||||
#end
|
||||
}
|
||||
@ -35,6 +35,7 @@ package haxe.ds;
|
||||
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); }
|
||||
@ -50,6 +51,7 @@ package haxe.ds;
|
||||
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); }
|
||||
")
|
||||
@:coreApi class IntMap<T> implements haxe.Constraints.IMap<Int, T> {
|
||||
@:ifFeature("haxe.ds.IntMap.*")
|
||||
@ -123,6 +125,10 @@ package haxe.ds;
|
||||
untyped __int_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setInt64(key:Int, val:haxe.Int64):Void {
|
||||
untyped __int_hash_set_int64(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function getString(key:Int):String {
|
||||
return untyped __int_hash_get_string(h, key);
|
||||
}
|
||||
@ -138,5 +144,9 @@ package haxe.ds;
|
||||
private function getFloat(key:Int):Float {
|
||||
return untyped __int_hash_get_float(h, key);
|
||||
}
|
||||
|
||||
private function getInt64(key:Int):haxe.Int64 {
|
||||
return untyped __int_hash_get_int64(h, key);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
209
Kha/Tools/windows_x64/std/cpp/_std/haxe/ds/Map.hx
Normal file
209
Kha/Tools/windows_x64/std/cpp/_std/haxe/ds/Map.hx
Normal file
@ -0,0 +1,209 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import haxe.Int64;
|
||||
import haxe.ds.StringMap;
|
||||
import haxe.ds.IntMap;
|
||||
import haxe.ds.HashMap;
|
||||
import haxe.ds.ObjectMap;
|
||||
import haxe.ds.WeakMap;
|
||||
import haxe.ds.EnumValueMap;
|
||||
import haxe.Constraints.IMap;
|
||||
import cpp.Int64Map;
|
||||
|
||||
/**
|
||||
Map allows key to value mapping for arbitrary value types, and many key
|
||||
types.
|
||||
|
||||
This is a multi-type abstract, it is instantiated as one of its
|
||||
specialization types depending on its type parameters.
|
||||
|
||||
A Map can be instantiated without explicit type parameters. Type inference
|
||||
will then determine the type parameters from the usage.
|
||||
|
||||
Maps can also be created with `[key1 => value1, key2 => value2]` syntax.
|
||||
|
||||
Map is an abstract type, it is not available at runtime.
|
||||
|
||||
@see https://haxe.org/manual/std-Map.html
|
||||
**/
|
||||
@:transitive
|
||||
@:multiType(@:followWithAbstracts K)
|
||||
abstract Map<K, V>(IMap<K, V>) {
|
||||
/**
|
||||
Creates a new Map.
|
||||
|
||||
This becomes a constructor call to one of the specialization types in
|
||||
the output. The rules for that are as follows:
|
||||
|
||||
1. if `K` is a `String`, `haxe.ds.StringMap` is used
|
||||
2. if `K` is an `Int`, `haxe.ds.IntMap` is used
|
||||
3. if `K` is an `EnumValue`, `haxe.ds.EnumValueMap` is used
|
||||
4. if `K` is any other class or structure, `haxe.ds.ObjectMap` is used
|
||||
5. if `K` is any other type, it causes a compile-time error
|
||||
|
||||
(Cpp) Map does not use weak keys on `ObjectMap` by default.
|
||||
**/
|
||||
public function new();
|
||||
|
||||
/**
|
||||
Maps `key` to `value`.
|
||||
|
||||
If `key` already has a mapping, the previous value disappears.
|
||||
|
||||
If `key` is `null`, the result is unspecified.
|
||||
**/
|
||||
public inline function set(key:K, value:V)
|
||||
this.set(key, value);
|
||||
|
||||
/**
|
||||
Returns the current mapping of `key`.
|
||||
|
||||
If no such mapping exists, `null` is returned.
|
||||
|
||||
Note that a check like `map.get(key) == null` can hold for two reasons:
|
||||
|
||||
1. the map has no mapping for `key`
|
||||
2. the map has a mapping with a value of `null`
|
||||
|
||||
If it is important to distinguish these cases, `exists()` should be
|
||||
used.
|
||||
|
||||
If `key` is `null`, the result is unspecified.
|
||||
**/
|
||||
@:arrayAccess public inline function get(key:K)
|
||||
return this.get(key);
|
||||
|
||||
/**
|
||||
Returns true if `key` has a mapping, false otherwise.
|
||||
|
||||
If `key` is `null`, the result is unspecified.
|
||||
**/
|
||||
public inline function exists(key:K)
|
||||
return this.exists(key);
|
||||
|
||||
/**
|
||||
Removes the mapping of `key` and returns true if such a mapping existed,
|
||||
false otherwise.
|
||||
|
||||
If `key` is `null`, the result is unspecified.
|
||||
**/
|
||||
public inline function remove(key:K)
|
||||
return this.remove(key);
|
||||
|
||||
/**
|
||||
Returns an Iterator over the keys of `this` Map.
|
||||
|
||||
The order of keys is undefined.
|
||||
**/
|
||||
public inline function keys():Iterator<K> {
|
||||
return this.keys();
|
||||
}
|
||||
|
||||
/**
|
||||
Returns an Iterator over the values of `this` Map.
|
||||
|
||||
The order of values is undefined.
|
||||
**/
|
||||
public inline function iterator():Iterator<V> {
|
||||
return this.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
Returns an Iterator over the keys and values of `this` Map.
|
||||
|
||||
The order of values is undefined.
|
||||
**/
|
||||
public inline function keyValueIterator():KeyValueIterator<K, V> {
|
||||
return this.keyValueIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a shallow copy of `this` map.
|
||||
|
||||
The order of values is undefined.
|
||||
**/
|
||||
public inline function copy():Map<K, V> {
|
||||
return cast this.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
Returns a String representation of `this` Map.
|
||||
|
||||
The exact representation depends on the platform and key-type.
|
||||
**/
|
||||
public inline function toString():String {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
Removes all keys from `this` Map.
|
||||
**/
|
||||
public inline function clear():Void {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
@:arrayAccess @:noCompletion public inline function arrayWrite(k:K, v:V):V {
|
||||
this.set(k, v);
|
||||
return v;
|
||||
}
|
||||
|
||||
@:to static inline function toStringMap<K:String, V>(t:IMap<K, V>):StringMap<V> {
|
||||
return new StringMap<V>();
|
||||
}
|
||||
|
||||
@:to static inline function toIntMap<K:Int, V>(t:IMap<K, V>):IntMap<V> {
|
||||
return new IntMap<V>();
|
||||
}
|
||||
|
||||
@:noDoc
|
||||
@:to static inline function toInt64Map<K:Int64, V>(t:IMap<K, V>):Int64Map<V> {
|
||||
return new Int64Map<V>();
|
||||
}
|
||||
|
||||
@:to static inline function toEnumValueMapMap<K:EnumValue, V>(t:IMap<K, V>):EnumValueMap<K, V> {
|
||||
return new EnumValueMap<K, V>();
|
||||
}
|
||||
|
||||
@:to static inline function toObjectMap<K:{}, V>(t:IMap<K, V>):ObjectMap<K, V> {
|
||||
return new ObjectMap<K, V>();
|
||||
}
|
||||
|
||||
@:from static inline function fromStringMap<V>(map:StringMap<V>):Map<String, V> {
|
||||
return cast map;
|
||||
}
|
||||
|
||||
@:from static inline function fromIntMap<V>(map:IntMap<V>):Map<Int, V> {
|
||||
return cast map;
|
||||
}
|
||||
|
||||
@:noDoc
|
||||
@:from static inline function fromInt64Map<V>(map:Int64Map<V>):Map<Int64, V> {
|
||||
return cast map;
|
||||
}
|
||||
|
||||
@:from static inline function fromObjectMap<K:{}, V>(map:ObjectMap<K, V>):Map<K, V> {
|
||||
return cast map;
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,7 @@ package haxe.ds;
|
||||
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>
|
||||
@ -48,7 +49,7 @@ package haxe.ds;
|
||||
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); }
|
||||
")
|
||||
@:coreApi
|
||||
class ObjectMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
|
||||
@ -123,6 +124,10 @@ class ObjectMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
|
||||
untyped __object_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setInt64(key:Dynamic, val:haxe.Int64):Void {
|
||||
untyped __object_hash_set_int64(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function getString(key:Dynamic):String {
|
||||
return untyped __object_hash_get_string(h, key);
|
||||
}
|
||||
@ -138,5 +143,9 @@ class ObjectMap<K:{}, V> implements haxe.Constraints.IMap<K, V> {
|
||||
private function getFloat(key:Dynamic):Float {
|
||||
return untyped __object_hash_get_float(h, key);
|
||||
}
|
||||
|
||||
private function getInt64(key:Dynamic):haxe.Int64 {
|
||||
return untyped __object_hash_get_int64(h, key);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ package haxe.ds;
|
||||
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); }
|
||||
@ -50,6 +51,7 @@ package haxe.ds;
|
||||
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); }
|
||||
")
|
||||
@:coreApi class StringMap<T> implements haxe.Constraints.IMap<String, T> {
|
||||
@:ifFeature("haxe.ds.StringMap.*")
|
||||
@ -123,6 +125,10 @@ package haxe.ds;
|
||||
untyped __string_hash_set_float(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function setInt64(key:String, val:haxe.Int64):Void {
|
||||
untyped __string_hash_set_int64(__cpp__("HX_MAP_THIS"), key, val);
|
||||
}
|
||||
|
||||
private function getString(key:String):String {
|
||||
return untyped __string_hash_get_string(h, key);
|
||||
}
|
||||
@ -138,5 +144,9 @@ package haxe.ds;
|
||||
private function getFloat(key:String):Float {
|
||||
return untyped __string_hash_get_float(h, key);
|
||||
}
|
||||
|
||||
private function getInt64(key:String):haxe.Int64 {
|
||||
return untyped __string_hash_get_int64(h, key);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ package haxe.ds;
|
||||
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); }
|
||||
inline void set(Dynamic key, cpp::Int64 value) { __object_hash_set_int64(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); }
|
||||
|
||||
@ -105,9 +105,7 @@ class Process {
|
||||
}
|
||||
|
||||
public function exitCode(block:Bool = true):Null<Int> {
|
||||
if (block == false)
|
||||
throw "Non blocking exitCode() not supported on this platform";
|
||||
return NativeProcess.process_exit(p);
|
||||
return NativeProcess.process_exit(p, block);
|
||||
}
|
||||
|
||||
public function close():Void {
|
||||
|
||||
33
Kha/Tools/windows_x64/std/cpp/_std/sys/thread/Condition.hx
Normal file
33
Kha/Tools/windows_x64/std/cpp/_std/sys/thread/Condition.hx
Normal file
@ -0,0 +1,33 @@
|
||||
package sys.thread;
|
||||
|
||||
@:coreApi
|
||||
class Condition {
|
||||
var c:Dynamic;
|
||||
public function new():Void {
|
||||
c = untyped __global__.__hxcpp_condition_create();
|
||||
}
|
||||
|
||||
public function acquire():Void {
|
||||
untyped __global__.__hxcpp_condition_acquire(c);
|
||||
}
|
||||
|
||||
public function tryAcquire():Bool {
|
||||
return untyped __global__.__hxcpp_condition_try_acquire(c);
|
||||
}
|
||||
|
||||
public function release():Void {
|
||||
untyped __global__.__hxcpp_condition_release(c);
|
||||
}
|
||||
|
||||
public function wait():Void {
|
||||
untyped __global__.__hxcpp_condition_wait(c);
|
||||
}
|
||||
|
||||
public function signal():Void {
|
||||
untyped __global__.__hxcpp_condition_signal(c);
|
||||
}
|
||||
|
||||
public function broadcast():Void {
|
||||
untyped __global__.__hxcpp_condition_broadcast(c);
|
||||
}
|
||||
}
|
||||
22
Kha/Tools/windows_x64/std/cpp/_std/sys/thread/Semaphore.hx
Normal file
22
Kha/Tools/windows_x64/std/cpp/_std/sys/thread/Semaphore.hx
Normal file
@ -0,0 +1,22 @@
|
||||
package sys.thread;
|
||||
|
||||
@:coreApi
|
||||
class Semaphore {
|
||||
var m:Dynamic;
|
||||
|
||||
public function new(value:Int) {
|
||||
m = untyped __global__.__hxcpp_semaphore_create(value);
|
||||
}
|
||||
|
||||
public function acquire():Void {
|
||||
untyped __global__.__hxcpp_semaphore_acquire(m);
|
||||
}
|
||||
|
||||
public function tryAcquire(?timeout:Float):Bool {
|
||||
return untyped __global__.__hxcpp_semaphore_try_acquire(m, timeout == null ? 0 : (timeout:Float));
|
||||
}
|
||||
|
||||
public function release():Void {
|
||||
untyped __global__.__hxcpp_semaphore_release(m);
|
||||
}
|
||||
}
|
||||
@ -46,6 +46,8 @@ class HostClasses {
|
||||
"sys.thread.Mutex",
|
||||
"sys.thread.Thread",
|
||||
"sys.thread.Tls",
|
||||
"sys.thread.Semaphore",
|
||||
"sys.thread.Condition",
|
||||
"cpp.vm.ExecutionTrace",
|
||||
"cpp.vm.Gc",
|
||||
"cpp.vm.Profiler",
|
||||
@ -53,6 +55,7 @@ class HostClasses {
|
||||
"cpp.vm.WeakRef",
|
||||
"cpp.Object",
|
||||
"cpp.Int64",
|
||||
"cpp.Int64Map",
|
||||
"cpp.Finalizable",
|
||||
"Std",
|
||||
"StringBuf",
|
||||
@ -147,6 +150,7 @@ class HostClasses {
|
||||
"List",
|
||||
"Map",
|
||||
"String",
|
||||
"haxe.atomic.AtomicInt"
|
||||
];
|
||||
|
||||
static function parseClassInfo(externs:Map<String, Bool>, filename:String) {
|
||||
|
||||
Reference in New Issue
Block a user