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,5 @@
package lua.lib.hxluasimdjson;
@:luaRequire("hxsimdjson")
extern class Json {
public static function parse(str:String) : Dynamic;
}

View File

@ -0,0 +1,86 @@
/*
* 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 lua.lib.lrexlib;
import haxe.extern.EitherType;
@:luaRequire("rex_pcre")
extern class Rex {
inline static function create(expr:String, flag:EitherType<Int, String>):Rex {
return untyped Rex['new'](expr, flag);
}
/**
The function searches for the first match of the regexp `patt` in the
string `subj`, starting from offset `init`, subject to flags `cf` and `ef`.
@return matched string, or array of strings.
**/
static function match(patt:EitherType<Rex, String>, subj:String, ?init:Int, ?ef:Int):Dynamic;
/**
The function searches for the first match of the regexp patt in the string
`subj`, starting from offset `init`, subject to flags `cf` and `ef`.
**/
static function find(patt:EitherType<Rex, String>, subj:String, ?init:Int, ?ef:Int):Dynamic;
/**
The function is intended for use in the generic for Lua construct. It is
used for splitting a subject string `subj` into parts (sections). The `sep`
parameter is a regular expression pattern representing separators between
the sections.
**/
static function split(subj:String, sep:EitherType<Rex, String>, ?cf:Int, ?ef:Int):Void->String;
/**
This function counts matches of the pattern `patt` in the string `subj`.
**/
static function count(subj:String, patt:EitherType<Rex, String>, cf:Int, ef:Int):Dynamic;
static function flags(?tb:Dynamic):Dynamic;
/**
The function searches for the first match of the regexp in the string
`subj`, starting from offset `init`, subject to execution flags `ef`.
**/
function tfind(subj:String, ?init:Int, ?ef:Int):Dynamic;
/**
This function searches for the first match of the regexp in the string
`subj`, starting from offset `init`, subject to execution flags `ef`.
**/
function exec(subj:String, ?init:Int, ?ef:Int):Dynamic;
/**
The function is intended for use in the generic for Lua construct. It
returns an iterator for repeated matching of the pattern patt in the
string `subj`, subject to flags `cf` and `ef`.
**/
static function gmatch(subj:String, patt:EitherType<Rex, String>, ?cf:Int, ?ef:Int):Void->String;
/**
This function searches for all matches of the pattern `patt` in the string
`subj` and replaces them according to the parameters `repl` and `n`.
**/
static function gsub(subj:String, patt:EitherType<Rex, String>, repl:Dynamic, ?n:Int, ?cf:Int, ?ef:Int):String;
}

View File

@ -0,0 +1,39 @@
/*
* 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 lua.lib.luasocket;
import lua.lib.luasocket.socket.*;
@:luaRequire("socket")
extern class Socket {
static var _DEBUG:Bool;
static var _VERSION:String;
static function tcp():Result<TcpMaster>;
static function bind(address:String, port:Int, ?backlog:Int):Result<TcpServer>;
static function connect(address:String, port:Int, ?locaddr:String, ?locport:Int):Result<TcpClient>;
static function gettime():Float;
static function select(recvt:Table<Int, Socket>, sendt:Table<Int, Socket>, ?timeout:Float):SelectResult;
function close():Void;
function getsockname():AddrInfo;
function settimeout(value:Float, ?mode:TimeoutMode):Void;
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luasocket.socket;
@:multiReturn extern class AddrInfo {
var address:String;
var port:String;
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luasocket.socket;
@:luaRequire("socket", "dns")
extern class Dns {
static function gethostname():String;
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luasocket.socket;
enum abstract ReceivePattern(String) {
var All = "*a";
var Line = "*l";
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luasocket.socket;
@:multiReturn extern class SelectResult {
var read:Table<Int, Socket>;
var write:Table<Int, Socket>;
}

View File

@ -0,0 +1,29 @@
/*
* 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 lua.lib.luasocket.socket;
enum abstract ShutdownMode(String) {
var Both = "both";
var Send = "send";
var Receive = "receive";
}

View File

@ -0,0 +1,34 @@
/*
* 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 lua.lib.luasocket.socket;
import haxe.extern.EitherType;
extern class TcpClient extends Socket {
function getpeername():AddrInfo;
function receive(pattern:EitherType<ReceivePattern, Int>, ?prefix:String):Result<String>;
function send(data:String, ?i:Int, ?j:Int):Result<Int>;
function shutdown(mode:ShutdownMode):Result<Int>;
function settimeout(value:Float, ?mode:TimeoutMode):Void;
function setoption(option:TcpOption, value:EitherType<Bool, {on:Bool, timeout:Float}>):Void;
}

View File

@ -0,0 +1,33 @@
/*
* 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 lua.lib.luasocket.socket;
import haxe.extern.EitherType;
extern class TcpMaster extends Socket {
// transforms master to TcpServer
function listen(backlog:Int):Void;
// transforms master to TcpClient
function connect(address:String, port:Int):Void;
function bind(address:String, port:Int):Void;
}

View File

@ -0,0 +1,30 @@
/*
* 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 lua.lib.luasocket.socket;
enum abstract TcpOption(String) {
var KeepAlive = "keepalive";
var Linger = "linger";
var ReuseAddress = "reuseaddr";
var TcpNoDelay = "tcp-nodelay";
}

View File

@ -0,0 +1,31 @@
/*
* 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 lua.lib.luasocket.socket;
import lua.*;
extern class TcpServer extends Socket {
function accept():Result<TcpClient>;
function settimeout(value:Int, ?mode:TimeoutMode):Void;
function setoption(option:String, value:TcpOption):Void;
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luasocket.socket;
enum abstract TimeoutMode(String) {
var Block = "b";
var Total = "t";
}

View File

@ -0,0 +1,115 @@
package lua.lib.luautf8;
/**
These are all externs for the lua-utf8 library, which functions
as an additional set of string tools.
Note that all relevant indexes are "1" based.
**/
@:luaRequire('lua-utf8')
extern class Utf8 {
/**
Receives a string and returns its length. The empty string `""` has
length `0`. Embedded zeros are counted, so `"a\000bc\000"` has length `5`.
**/
static function len(str:String):Int;
/**
Receives zero or more integers. Returns a string with length equal to the
number of arguments, in which each character has the internal numerical
code equal to its corresponding argument.
Note that numerical codes are not necessarily portable across platforms.
**/
static function char(codes:haxe.extern.Rest<Int>):String;
/**
Returns the substring of `str` that starts at `start` and continues until `end`;
`start` and `end` can be negative. If `end` is absent, then it is assumed to be
equal to `-1` (which is the same as the string length).
In particular, the call `sub(str,1,end)` returns a prefix of `str`
with length `end`, and `sub(str, -end)` returns a suffix of `str` with
length `start`.
**/
static function sub(str:String, start:Int, ?end:Int):StringSub;
/**
Returns the character code at position `index` of `str`.
**/
static function charCodeAt(str:String, index:Int):Int;
/**
Looks for the first match of pattern in the string `str`.
If it finds a match, then `find` returns the indices of `str` where this
occurrence starts and ends.
@param target If the target has captures, then in a successful match the
captured values are also returned, after the two indices.
@param start specifies where to start the search; its default value is `1`
and can be negative.
@param plain turns off the pattern matching facilities, so the function does
a plain "find substring" operation, with no characters in pattern
being considered "magic". Note that if plain is given, then `start` must be given as well.
**/
static function find(str:String, target:String, ?start:Int, ?plain:Bool):StringFind;
/**
Returns the internal numerical codes of the characters `str[index]`.
Note that numerical codes are not necessarily portable across platforms.
**/
static function byte(str:String, ?index:Int):Int;
/**
**/
@:overload(function(str:String, pattern:String, replace:String->Void, ?n:Int):String {})
@:overload(function(str:String, pattern:String, replace:String->String, ?n:Int):String {})
static function gsub(str:String, pattern:String, replace:String, ?n:Int):String;
/**
Returns an iterator function that, each time it is called, returns the next
captures from pattern over string `str`. If `pattern` specifies no captures,
then the whole match is produced in each call.
**/
@:overload(function(str:String, pattern:String, match:Void->String, ?n:Int):String->Void {})
static function gmatch(str:String, pattern:String):Void->String;
/**
Looks for the first match of pattern in the string s. If it finds one,
then match returns the captures from the pattern; otherwise it returns `null`.
If pattern specifies no captures, then the whole match is returned.
The optional argument `n` specifies where to start the search;
its default value is `1` and can be negative.
**/
static function match(str:String, pattern:String, ?n:Int):String;
/**
Receives a string and returns a copy of this string with all lowercase
letters changed to uppercase. All other characters are left unchanged.
The definition of what a lowercase letter is depends on the current locale.
**/
static function upper(str:String):String;
/**
Receives a string and returns a copy of this string with all uppercase
letters changed to lowercase. All other characters are left unchanged.
The definition of what an uppercase letter is depends on the current locale.
**/
static function lower(str:String):String;
static function codes(str:String):String->Int->StringCodePoint;
}
@:multiReturn extern class StringFind {
var begin:Int;
var end:Int;
}
@:multiReturn extern class StringSub {
var match:String;
var count:Int;
}
@:multiReturn extern class StringCodePoint {
var position:Int;
var codepoint:Int;
}

View File

@ -0,0 +1,30 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Async extends Handle {
static function new_async():Async;
@:native("new_async") function new():Void;
function send():Int;
}

View File

@ -0,0 +1,32 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Check extends Handle {
static function new_check():Check;
@:native("new_check") function new():Void;
function start(handle:Handle):Int;
function stop():Int;
}

View File

@ -0,0 +1,36 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Handle {
function is_active():Bool;
function is_closing():Bool;
function close():Void;
function ref():Void;
function unref():Void;
function has_ref():Bool;
function send_buffer_size(size:Int):Int;
function recv_buffer_size(size:Int):Int;
function fileno():Int;
}

View File

@ -0,0 +1,31 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Idle extends Handle {
static function new_idle():Idle;
@:native("new_idle") function new():Void;
function start(cb:Void->Void):Int;
function stop(cb:Void->Void):Int;
}

View File

@ -0,0 +1,14 @@
package lua.lib.luv;
@:luaRequire("luv")
extern class Loop {
static function loop_close():Bool;
static function run(?mode:String):Bool;
static function loop_alive():Bool;
static function stop():Void;
static function backend_fd():Int;
static function backend_timeout():Int;
static function now():Int;
static function update_time():Void;
static function walk(cb:Handle->Void):Void;
}

View File

@ -0,0 +1,107 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Misc {
static function chdir(path:String):Bool;
static function cpu_info():Table<Int, CpuInfo>;
static function cwd():String;
static function exepath():String;
static function get_process_title():String;
static function get_total_memory():Int;
static function get_free_memory():Int;
static function getpid():Int;
static function getrusage():ResourceUsage;
static function guess_handle(handle:Int):String;
static function hrtime():Float;
static function gettimeofday() : TimeOfDay;
// TODO: implement this
static function interface_addresses() : Dynamic;
static function loadavg():Float;
static function resident_set_memory():Int;
static function set_process_title(title:String):Bool;
static function uptime():Int;
static function version():Int;
static function version_string():String;
// Windows only
static function getuid():Int;
static function setuid(from:Int, to:Int):String;
static function getgid():Int;
static function setgid(from:Int, to:Int):Void;
// Windows only
static function print_all_handles():Table<Int, String>;
static function print_active_handles():Table<Int, String>;
}
typedef CpuInfo = {
model:String,
times:CpuTimes,
speed:Int
}
typedef CpuTimes = {
sys:Int,
idle:Int,
irq:Int,
user:Int
}
typedef ResourceUsage = {
nivcsw:Int,
maxrss:Int,
msgrcv:Int,
isrss:Int,
inblock:Int,
ixrss:Int,
nvcsw:Int,
nsignals:Int,
minflt:Int,
nswap:Int,
msgsnd:Int,
oublock:Int,
majflt:Int,
stime:MicroTimeStamp,
idrss:Int,
utime:MicroTimeStamp
}
typedef MicroTimeStamp = {
usec:Int,
sec:Int
}
@:multiReturn
extern class TimeOfDay {
var seconds : Int;
var microseconds : Int;
}

View File

@ -0,0 +1,72 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Os {
@:native("os_homedir")
static function homedir():String;
@:native("os_tmpdir")
static function tmpdir():String;
@:native("os_get_passwd")
static function get_passwd():String;
@:native("os_getenv")
static function getenv(env:String):String;
@:native("os_setenv")
static function setenv(env:String, value:String):Void;
@:native("os_unsetenv")
static function unsetenv(env:String):Void;
@:native("os_gethostname")
static function gethostname():String;
@:native("os_environ")
static function environ():Table<String, String>;
@:native("os_uname")
static function uname():Uname;
@:native("os_getpid")
static function getpid():Int;
@:native("os_getppid")
static function getppid():Int;
@:native("os_getpriority")
static function getpriority(pid:Int):Int;
@:native("os_setpriority")
static function setpriority(pid:Int, priority:Int):Bool;
}
typedef Uname = {
sysname:String,
release:String,
version:String,
machine:String
}

View File

@ -0,0 +1,39 @@
/*
* 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 lua.lib.luv;
import haxe.extern.EitherType;
@:luaRequire("luv")
extern class Pipe extends Stream {
static function new_pipe(ipc:Bool):Pipe;
@:native("new_pipe") function new(ipc:Bool):Void;
function open(file:EitherType<FileHandle, Handle>):Pipe;
function bind(name:String):Pipe;
function connect(name:String, cb:String->Bool->Void):Int;
function getsockname():String;
function pending_instances(count:Int):Int;
function pending_count():Int;
function pending_type():Int;
}

View File

@ -0,0 +1,32 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Poll extends Handle {
static function new_poll():Async;
@:native("new_poll") function new():Void;
function start(?type:Int, ?cb:Void->Void):Int;
function stop():Int;
}

View File

@ -0,0 +1,32 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Prepare extends Handle {
static function new_prepare():Prepare;
@:native("new_prepare") function new():Void;
function start():Int;
function stop():Int;
}

View File

@ -0,0 +1,40 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Process extends Handle {
static function disable_stdio_inheritance():Void;
static function spawn(path:String, options:Dynamic, cb:Int->Signal->Void):LuvSpawn;
function kill(sig:String):Int;
}
typedef ProcessOptions = {
args:Table<Int, String>,
stdio:Table<Int, Pipe>
}
@:multiReturn extern class LuvSpawn {
var handle:Process;
var pid:Int;
}

View File

@ -0,0 +1,28 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Request {
function cancel():Bool;
}

View File

@ -0,0 +1,32 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Signal extends Handle {
static function new_signal():Signal;
@:native("new_signal") function new():Void;
function start(sigtype:haxe.extern.EitherType<Int, String>, ?cb:Void->Void):Int;
function stop():Int;
}

View File

@ -0,0 +1,42 @@
/*
* 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 lua.lib.luv;
import lua.lib.luv.net.Tcp;
@:luaRequire("luv")
extern class Stream extends Handle {
function shutdown(?cb:Void->Void):Int;
function listen(backlog:Int, cb:String->String->Void):Int;
function accept(client_stream:Stream):Int;
function read_start(cb:String->String->Void):Int;
function read_stop():Int;
function write(data:StreamData, ?cb:String->Bool->Void):Int;
function write2(data:StreamData, send_handle:Tcp, cb:String->Bool->Void):Int;
function try_write(data:StreamData):Int;
function is_readable():Bool;
function is_writable():Bool;
function set_blocking(blocking:Bool):Int;
}
typedef StreamData = haxe.extern.EitherType<String, Table<Int, String>>;

View File

@ -0,0 +1,34 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Thread {
static function new_thread():Timer;
@:native("new_thread") function new():Void;
static function self():Thread;
static function sleep(msec:Int):Void;
function equal(t:Thread):Bool;
function join(t:Thread):Bool;
}

View File

@ -0,0 +1,35 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Timer extends Handle {
static function new_timer():Timer;
@:native("new_timer") function new():Void;
function start(timeout:Int, repeat:Int, cb:Void->Void):Int;
function stop():Int;
function again():Int;
function set_repeat(repeat:Int):Void;
function get_repeat():Int;
}

View File

@ -0,0 +1,40 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Tty extends Stream {
static function new_tty(fd:Int, readable:Bool):Tty;
@:native("new_tty") function new(fd:Int, readable:Bool):Void;
static function reset_mode():Int;
function set_mode(mode:Int):Int;
function get_winsize():WidthHeight;
}
@:multiReturn
extern class WidthHeight {
var width:Int;
var height:Int;
}

View File

@ -0,0 +1,30 @@
/*
* 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 lua.lib.luv;
@:luaRequire("luv")
extern class Work {
static function new_work():Work;
@:native("new_work") function new():Void;
static function queue_work(work:Work):Bool;
}

View File

@ -0,0 +1,25 @@
/*
* 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 lua.lib.luv.fs;
typedef FileDescriptor = Int;

View File

@ -0,0 +1,215 @@
/*
* 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 lua.lib.luv.fs;
import lua.lib.luv.fs.Open;
import lua.Result;
@:luaRequire("luv")
extern class FileSystem {
@:native("fs_close")
@:overload(function(file:FileDescriptor, cb:String->Bool->Void):Request {})
static function close(file:FileDescriptor):Result<Bool>;
@:native("fs_open")
@:overload(function(path:String, flags:Open, mode:Int, ?cb:String->FileDescriptor->Void):Request {})
static function open(path:String, flags:Open, mode:Int):Result<FileDescriptor>;
@:native("fs_read")
@:overload(function(file:FileDescriptor, len:Int, offset:Int, ?cb:String->String->Void):Request {})
static function read(file:FileDescriptor, len:Int, offset:Int):Result<String>;
@:native("fs_unlink")
@:overload(function(file:FileDescriptor, ?cb:String->String->Void):Request {})
static function unlink(file:FileDescriptor, content:String):Result<String>;
@:native("fs_write")
@:overload(function(file:FileDescriptor, content:String, offset:Int, ?cb:String->Bool->Void):Int {})
static function write(file:FileDescriptor, content:String, offset:Int):Result<Bool>;
@:native("fs_mkdir")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function mkdir(path:String, mode:Int):Result<Bool>;
@:native("fs_mkdtemp")
@:overload(function(data:String, cb:String->Bool->Void):Request {})
static function mkdtemp(data:String):Result<Bool>;
@:native("fs_rmdir")
@:overload(function(path:String, cb:String->Bool->Void):Request {})
static function rmdir(path:String):Result<Int>;
@:native("fs_scandir")
@:overload(function(path:String, cb:String->Bool->Void):Request {})
static function scandir(path:String):ScanDirMarker;
@:native("fs_scandir_next")
static function scandir_next(scandir:ScanDirMarker):ScandirNext;
@:native("fs_stat")
@:overload(function(path:String, cb:String->Stat->Void):Request {})
static function stat(path:String):Result<Stat>;
@:native("fs_fstat")
@:overload(function(descriptor:FileDescriptor, cb:String->Stat->Void):Request {})
static function fstat(descriptor:FileDescriptor):Result<Stat>;
@:native("fs_lstat")
@:overload(function(path:String, cb:String->Stat->Void):Request {})
static function lstat(path:String):Result<Stat>;
@:native("fs_rename")
@:overload(function(path:String, newpath:String, cb:String->Bool->Void):Request {})
static function rename(path:String, newpath:String):Result<Bool>;
@:native("fs_fsync")
@:overload(function(descriptor:FileDescriptor, cb:String->Bool->Void):Request {})
static function fsync(descriptor:FileDescriptor):Result<Bool>;
@:native("fs_fdatasync")
@:overload(function(descriptor:FileDescriptor, cb:String->Bool->Void):Request {})
static function fdatasync(descriptor:FileDescriptor):Result<Bool>;
@:native("fs_ftruncate")
@:overload(function(descriptor:FileDescriptor, offset:Int, cb:String->Bool->Void):Request {})
static function ftruncate(descriptor:FileDescriptor, offset:Int):Result<Bool>;
@:native("fs_sendfile")
@:overload(function(fin:FileDescriptor, fout:FileDescriptor, cb:String->Int->Void):Request {})
static function sendfile(fin:FileDescriptor, fout:FileDescriptor):Result<Int>;
@:native("fs_access")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function access(path:String, mode:Int):Result<Bool>;
@:native("fs_chmod")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function chmod(path:String, mode:Int):Result<Bool>;
@:native("fs_fchmod")
@:overload(function(descriptor:FileDescriptor, mode:Int, cb:String->Bool->Void):Request {})
static function fchmod(descriptor:FileDescriptor, mode:Int):Result<Bool>;
@:native("fs_futime")
@:overload(function(descriptor:FileDescriptor, actime:Int, modtime:Int, cb:String->Bool->Void):Request {})
static function futime(descriptor:FileDescriptor, actime:Int, modtime:Int):Result<Bool>;
@:native("fs_utime")
@:overload(function(path:String, actime:Int, modtime:Int, cb:String->Bool->Void):Request {})
static function utime(path:String, actime:Int, modtime:Int):Result<Bool>;
@:native("fs_link")
@:overload(function(oldpath:String, newpath:String, cb:String->Bool->Void):Request {})
static function link(oldpath:String, newpath:String):Result<Bool>;
@:native("fs_symlink")
@:overload(function(oldpath:String, newpath:String, flags:Int, cb:String->Bool->Void):Request {})
static function symlink(oldpath:String, newpath:String, flags:Int):Bool;
@:native("fs_readlink")
@:overload(function(path:String, cb:String->String->Void):Request {})
static function readlink(path:String):String;
@:native("fs_realpath")
@:overload(function(path:String, cb:String->String->Void):Request {})
static function realpath(path:String):String;
@:native("fs_chown")
@:overload(function(path:String, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function chown(path:String, uid:Int, gid:Int):Bool;
@:native("fs_fchown")
@:overload(function(descriptor:FileDescriptor, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function fchown(descriptor:FileDescriptor, uid:Int, gid:Int):Bool;
/**
Not available on windows
**/
@:native("fs_lchown")
@:overload(function(descriptor:FileDescriptor, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function lchown(descriptor:FileDescriptor, uid:Int, gid:Int):Bool;
@:native("fs_statfs")
@:overload(function(path:String, cb:StatFs->Bool->Void):Request {})
static function statfs(path:String):StatFs;
@:native("fs_opendir")
@:overload(function(path:String, cb:Handle->Bool->Void):Request {})
static function opendir(path:String):Handle;
@:native("fs_readdir")
@:overload(function(dir:Handle, cb:Table<Int, NameType>->Bool->Void):Request {})
static function readdir(path:String):Table<Int, NameType>;
@:native("fs_closedir")
@:overload(function(dir:Handle, cb:Bool->Void):Request {})
static function closedir(dir:Handle):Bool;
}
extern class ScanDirMarker {}
@:multiReturn
extern class ScandirNext {
var name:String;
var type:String;
}
typedef NameType = {
name:String,
type:String
}
typedef Stat = {
ino:Int,
ctime:TimeStamp,
uid:Int,
dev:Int,
nlink:Int,
mode:Int,
size:Int,
birthtime:TimeStamp,
gid:Int,
type:String,
rdev:Int,
gen:Int,
blocks:Int,
mtime:TimeStamp,
atime:TimeStamp,
blksize:Int,
flags:Int
}
typedef TimeStamp = {
sec:Int,
nsec:Int
}
typedef StatFs = {
type:Int,
bsize:Int,
blocks:Int,
bfree:Int,
bavail:Int,
files:Int,
ffree:Int
}

View File

@ -0,0 +1,39 @@
/*
* 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 lua.lib.luv.fs;
@:luaRequire("luv")
extern class FileSystemEvent {
static function new_fs_event():FileSystemEvent;
@:native("new_fs_event") function new():Void;
function start(path:String, options:StartOptions, cb:String->Bool->Void):Int;
function stop():Int;
function getpath():String;
}
typedef StartOptions = {
watch_entry:Bool,
stat:Bool,
recursive:Bool
}

View File

@ -0,0 +1,33 @@
/*
* 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 lua.lib.luv.fs;
@:luaRequire("luv")
extern class FileSystemPoll {
static function new_fs_poll():FileSystemPoll;
@:native("new_fs_poll") function new():Void;
function start(path:String, interval:Int, cb:String->Bool->Void):Bool;
function stop():Bool;
function getpath():String;
}

View File

@ -0,0 +1,38 @@
/*
* 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 lua.lib.luv.fs;
enum abstract Open(String) {
var ReadOnly = "r";
var ReadOnlySync = "rs";
var ReadWrite = "r+";
var ReadWriteSync = "rs+";
var ReadWriteAppend = "a+";
var ReadWriteTruncate = "w+";
var ReadWriteTruncateNewFile = "wx+";
var ReadWriteAppendNewFile = "ax+";
var WriteOnly = "w";
var WriteNewFile = "wx";
var Append = "a";
var AppendNewFile = "ax";
}

View File

@ -0,0 +1,40 @@
/*
* 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 lua.lib.luv.net;
@:luaRequire("luv")
extern class Dns {
@:overload(function(node:String, ?service:String, ?hints:AddrInfo, cb:String->Table<Int, AddrInfo>->Void):Request {})
static function getaddrinfo(node:String, ?service:String, ?hints:AddrInfo):Result<Table<Int, AddrInfo>>;
@:overload(function(ip:String, ?port:Int, ?family:String, ?cb:String->AddrInfo->Void):Request {})
static function getnameinfo(info:AddrInfo):Result<String>;
}
typedef AddrInfo = {
?ip:String,
?addr:String,
?port:Int,
?family:String,
?socktype:String
}

View File

@ -0,0 +1,38 @@
/*
* 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 lua.lib.luv.net;
@:luaRequire("luv")
extern class Tcp extends Stream {
static function new_tcp():Tcp;
@:native("new_tcp") function new():Void;
function open(sock:Int):Int;
function nodelay(enable:Bool):Int;
function keepalive(enable:Bool, ?delay:Int):Int;
function simultaneous_accepts(enable:Bool):Int;
function bind(address:String, port:Int):Int;
function getsockname():Int;
function getpeername():String;
function connect(host:String, port:Int, cb:String->Bool->Void):Int;
function write_queue_size():Int;
}

View File

@ -0,0 +1,43 @@
/*
* 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 lua.lib.luv.net;
@:luaRequire("luv")
extern class Udp extends Handle {
static function new_udp():Udp;
@:native("new_udp") function new():Void;
function open(fd:Int):Int;
function bind(host:String, port:Int):Int;
function getsockname():String;
function set_membership(multicast_addr:String, interface_addr:String, membership:String):Int;
function set_multicast_loop(on:Bool):Int;
function set_multicast_ttl(ttl:Int):Int;
function set_multicast_interface(interface_addr:String):Int;
function set_broadcast(on:Bool):Int;
function set_ttl(ttl:Int):Int;
function send(data:String, host:String, port:Int, cb:Bool->Void):Int;
function try_send(data:String, host:String, port:Int):Int;
function recv_start(cb:String->Bool->Void):Int;
function recv_stop():Int;
}