whet 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/bin/HxOverrides.d.ts +8 -0
- package/bin/HxOverrides.js +54 -0
- package/bin/Lambda.d.ts +86 -0
- package/bin/Lambda.js +141 -0
- package/bin/Map.d.ts +5 -0
- package/bin/Reflect.d.ts +19 -0
- package/bin/Reflect.js +41 -0
- package/bin/Std.d.ts +49 -0
- package/bin/Std.js +96 -0
- package/bin/StdTypes.d.ts +57 -0
- package/bin/StringTools.d.ts +23 -0
- package/bin/StringTools.js +36 -0
- package/bin/commander/AddHelpTextContext.d.ts +6 -0
- package/bin/commander/AddHelpTextPosition.d.ts +2 -0
- package/bin/commander/CommandOptions.d.ts +6 -0
- package/bin/commander/ErrorOptions.d.ts +11 -0
- package/bin/commander/ExecutableCommandOptions.d.ts +7 -0
- package/bin/commander/HelpContext.d.ts +4 -0
- package/bin/commander/HookEvent.d.ts +2 -0
- package/bin/commander/OptionValueSource.d.ts +2 -0
- package/bin/commander/OutputConfiguration.d.ts +8 -0
- package/bin/commander/ParseOptions.d.ts +4 -0
- package/bin/commander/ParseOptionsResult.d.ts +5 -0
- package/bin/genes/Register.d.ts +15 -0
- package/bin/genes/Register.js +107 -0
- package/bin/genes/util/EsMap.d.ts +12 -0
- package/bin/genes/util/EsMap.js +51 -0
- package/bin/haxe/Constraints.d.ts +8 -0
- package/bin/haxe/Constraints.js +5 -0
- package/bin/haxe/Exception.d.ts +66 -0
- package/bin/haxe/Exception.js +88 -0
- package/bin/haxe/NativeStackTrace.d.ts +7 -0
- package/bin/haxe/PosInfos.d.ts +19 -0
- package/bin/haxe/Rest.d.ts +2 -0
- package/bin/haxe/ValueException.d.ts +24 -0
- package/bin/haxe/ValueException.js +36 -0
- package/bin/haxe/crypto/Crc32.d.ts +12 -0
- package/bin/haxe/crypto/Crc32.js +40 -0
- package/bin/haxe/ds/List.d.ts +31 -0
- package/bin/haxe/ds/List.js +55 -0
- package/bin/haxe/ds/ObjectMap.d.ts +7 -0
- package/bin/haxe/ds/ObjectMap.js +25 -0
- package/bin/haxe/ds/StringMap.d.ts +6 -0
- package/bin/haxe/ds/StringMap.js +25 -0
- package/bin/haxe/exceptions/NotImplementedException.d.ts +10 -0
- package/bin/haxe/exceptions/NotImplementedException.js +27 -0
- package/bin/haxe/exceptions/PosException.d.ts +19 -0
- package/bin/haxe/exceptions/PosException.js +36 -0
- package/bin/haxe/extern/Rest.d.ts +11 -0
- package/bin/haxe/io/ArrayBufferView.d.ts +2 -0
- package/bin/haxe/io/Bytes.d.ts +19 -0
- package/bin/haxe/io/Bytes.js +78 -0
- package/bin/haxe/io/BytesBuffer.d.ts +19 -0
- package/bin/haxe/io/BytesBuffer.js +67 -0
- package/bin/haxe/io/BytesData.d.ts +2 -0
- package/bin/haxe/io/BytesOutput.d.ts +18 -0
- package/bin/haxe/io/BytesOutput.js +39 -0
- package/bin/haxe/io/Encoding.d.ts +20 -0
- package/bin/haxe/io/Encoding.js +20 -0
- package/bin/haxe/io/Error.d.ts +35 -0
- package/bin/haxe/io/Error.js +31 -0
- package/bin/haxe/io/Output.d.ts +63 -0
- package/bin/haxe/io/Output.js +126 -0
- package/bin/haxe/io/Path.d.ts +109 -0
- package/bin/haxe/io/Path.js +217 -0
- package/bin/haxe/io/UInt8Array.d.ts +2 -0
- package/bin/haxe/iterators/ArrayIterator.d.ts +19 -0
- package/bin/haxe/iterators/ArrayIterator.js +35 -0
- package/bin/haxe/macro/Expr.d.ts +331 -0
- package/bin/haxe/macro/Type.d.ts +609 -0
- package/bin/haxe/zip/Compress.d.ts +5 -0
- package/bin/haxe/zip/Compress.js +21 -0
- package/bin/haxe/zip/Entry.d.ts +27 -0
- package/bin/haxe/zip/Entry.js +15 -0
- package/bin/haxe/zip/Tools.d.ts +5 -0
- package/bin/haxe/zip/Tools.js +24 -0
- package/bin/haxe/zip/Writer.d.ts +22 -0
- package/bin/haxe/zip/Writer.js +149 -0
- package/bin/js/Boot.d.ts +18 -0
- package/bin/js/Boot.js +225 -0
- package/bin/js/Node.d.ts +6 -0
- package/bin/js/lib/ArrayBuffer.d.ts +4 -0
- package/bin/js/lib/ArrayBuffer.js +24 -0
- package/bin/js/lib/Iterator.d.ts +23 -0
- package/bin/js/lib/Map.d.ts +2 -0
- package/bin/js/lib/Object.d.ts +82 -0
- package/bin/js/lib/Promise.d.ts +10 -0
- package/bin/js/lib/intl/NumberFormat.d.ts +114 -0
- package/bin/js/node/Buffer.d.ts +3 -0
- package/bin/js/node/ChildProcess.d.ts +424 -0
- package/bin/js/node/Crypto.d.ts +21 -0
- package/bin/js/node/Dns.d.ts +57 -0
- package/bin/js/node/Fs.d.ts +308 -0
- package/bin/js/node/Http.d.ts +114 -0
- package/bin/js/node/Https.d.ts +330 -0
- package/bin/js/node/Iterator.d.ts +5 -0
- package/bin/js/node/Path.d.ts +44 -0
- package/bin/js/node/Process.d.ts +6 -0
- package/bin/js/node/Tls.d.ts +304 -0
- package/bin/js/node/Url.d.ts +126 -0
- package/bin/js/node/Util.d.ts +115 -0
- package/bin/js/node/Zlib.d.ts +29 -0
- package/bin/js/node/buffer/Buffer.d.ts +23 -0
- package/bin/js/node/buffer/Buffer.js +24 -0
- package/bin/js/node/child_process/ChildProcess.d.ts +11 -0
- package/bin/js/node/console/Console.d.ts +26 -0
- package/bin/js/node/http/Agent.d.ts +40 -0
- package/bin/js/node/http/ClientRequest.d.ts +10 -0
- package/bin/js/node/https/Agent.d.ts +50 -0
- package/bin/js/node/net/Server.d.ts +22 -0
- package/bin/js/node/net/Socket.d.ts +101 -0
- package/bin/js/node/stream/Duplex.d.ts +86 -0
- package/bin/js/node/stream/Readable.d.ts +41 -0
- package/bin/js/node/stream/Transform.d.ts +92 -0
- package/bin/js/node/stream/Writable.d.ts +57 -0
- package/bin/js/node/tls/SecureContext.d.ts +74 -0
- package/bin/js/node/tls/TLSSocket.d.ts +47 -0
- package/bin/ts/Undefined.d.ts +5 -0
- package/bin/whet/Log.d.ts +16 -0
- package/bin/whet/Log.js +106 -0
- package/bin/whet/Project.d.ts +33 -0
- package/bin/whet/Project.js +71 -0
- package/bin/whet/Source.d.ts +51 -0
- package/bin/whet/Source.js +136 -0
- package/bin/whet/SourceHash.d.ts +15 -0
- package/bin/whet/SourceHash.js +68 -0
- package/bin/whet/SourceId.d.ts +10 -0
- package/bin/whet/SourceId.js +74 -0
- package/bin/whet/Stone.d.ts +88 -0
- package/bin/whet/Stone.js +157 -0
- package/bin/whet/Utils.d.ts +16 -0
- package/bin/whet/Utils.js +72 -0
- package/bin/whet/Whet.d.ts +4 -0
- package/bin/whet/Whet.js +117 -0
- package/bin/whet/cache/BaseCache.d.ts +27 -0
- package/bin/whet/cache/BaseCache.js +210 -0
- package/bin/whet/cache/Cache.d.ts +72 -0
- package/bin/whet/cache/Cache.js +57 -0
- package/bin/whet/cache/CacheManager.d.ts +23 -0
- package/bin/whet/cache/CacheManager.js +103 -0
- package/bin/whet/cache/FileCache.d.ts +35 -0
- package/bin/whet/cache/FileCache.js +295 -0
- package/bin/whet/cache/MemoryCache.d.ts +12 -0
- package/bin/whet/cache/MemoryCache.js +58 -0
- package/bin/whet/magic/MaybeArray.d.ts +4 -0
- package/bin/whet/magic/MaybeArray.js +25 -0
- package/bin/whet/magic/RoutePathType.d.ts +9 -0
- package/bin/whet/magic/RoutePathType.js +48 -0
- package/bin/whet/magic/RouteType.d.ts +12 -0
- package/bin/whet/magic/RouteType.js +70 -0
- package/bin/whet/magic/StoneId.d.ts +5 -0
- package/bin/whet/magic/StoneId.js +32 -0
- package/bin/whet/route/Route.d.ts +15 -0
- package/bin/whet/route/Route.js +81 -0
- package/bin/whet/route/RouteResult.d.ts +22 -0
- package/bin/whet/route/RouteResult.js +25 -0
- package/bin/whet/route/Router.d.ts +33 -0
- package/bin/whet/route/Router.js +224 -0
- package/bin/whet/stones/Files.d.ts +28 -0
- package/bin/whet/stones/Files.js +86 -0
- package/bin/whet/stones/JsonStone.d.ts +33 -0
- package/bin/whet/stones/JsonStone.js +117 -0
- package/bin/whet/stones/RemoteFile.d.ts +28 -0
- package/bin/whet/stones/RemoteFile.js +71 -0
- package/bin/whet/stones/Server.d.ts +42 -0
- package/bin/whet/stones/Server.js +113 -0
- package/bin/whet/stones/Zip.d.ts +30 -0
- package/bin/whet/stones/Zip.js +111 -0
- package/bin/whet/stones/haxe/HaxeBuild.d.ts +34 -0
- package/bin/whet/stones/haxe/HaxeBuild.js +89 -0
- package/bin/whet/stones/haxe/Hxml.d.ts +102 -0
- package/bin/whet/stones/haxe/Hxml.js +348 -0
- package/bin/whet.d.ts +20 -0
- package/bin/whet.js +18 -0
- package/package.json +32 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {IMap} from "../Constraints.js"
|
|
2
|
+
import {EsMap} from "../../genes/util/EsMap.js"
|
|
3
|
+
import {Register} from "../../genes/Register.js"
|
|
4
|
+
|
|
5
|
+
const $global = Register.$global
|
|
6
|
+
|
|
7
|
+
export const ObjectMap = Register.global("$hxClasses")["haxe.ds.ObjectMap"] =
|
|
8
|
+
class ObjectMap extends Register.inherits(EsMap) {
|
|
9
|
+
new() {
|
|
10
|
+
super.new();
|
|
11
|
+
}
|
|
12
|
+
static get __name__() {
|
|
13
|
+
return "haxe.ds.ObjectMap"
|
|
14
|
+
}
|
|
15
|
+
static get __interfaces__() {
|
|
16
|
+
return [IMap]
|
|
17
|
+
}
|
|
18
|
+
static get __super__() {
|
|
19
|
+
return EsMap
|
|
20
|
+
}
|
|
21
|
+
get __class__() {
|
|
22
|
+
return ObjectMap
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {IMap} from "../Constraints.js"
|
|
2
|
+
import {EsMap} from "../../genes/util/EsMap.js"
|
|
3
|
+
import {Register} from "../../genes/Register.js"
|
|
4
|
+
|
|
5
|
+
const $global = Register.$global
|
|
6
|
+
|
|
7
|
+
export const StringMap = Register.global("$hxClasses")["haxe.ds.StringMap"] =
|
|
8
|
+
class StringMap extends Register.inherits(EsMap) {
|
|
9
|
+
new() {
|
|
10
|
+
super.new();
|
|
11
|
+
}
|
|
12
|
+
static get __name__() {
|
|
13
|
+
return "haxe.ds.StringMap"
|
|
14
|
+
}
|
|
15
|
+
static get __interfaces__() {
|
|
16
|
+
return [IMap]
|
|
17
|
+
}
|
|
18
|
+
static get __super__() {
|
|
19
|
+
return EsMap
|
|
20
|
+
}
|
|
21
|
+
get __class__() {
|
|
22
|
+
return StringMap
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {PosException} from "./PosException"
|
|
2
|
+
import {PosInfos} from "../PosInfos"
|
|
3
|
+
import {Exception} from "../Exception"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
An exception that is thrown when requested function or operation does not have an implementation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NotImplementedException extends PosException {
|
|
9
|
+
constructor(message?: string, previous?: null | Exception, pos?: null | PosInfos)
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {PosException} from "./PosException.js"
|
|
2
|
+
import {Register} from "../../genes/Register.js"
|
|
3
|
+
|
|
4
|
+
const $global = Register.$global
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
An exception that is thrown when requested function or operation does not have an implementation.
|
|
8
|
+
*/
|
|
9
|
+
export const NotImplementedException = Register.global("$hxClasses")["haxe.exceptions.NotImplementedException"] =
|
|
10
|
+
class NotImplementedException extends Register.inherits(PosException) {
|
|
11
|
+
new(message, previous, pos) {
|
|
12
|
+
if (message == null) {
|
|
13
|
+
message = "Not implemented";
|
|
14
|
+
};
|
|
15
|
+
super.new(message, previous, pos);
|
|
16
|
+
}
|
|
17
|
+
static get __name__() {
|
|
18
|
+
return "haxe.exceptions.NotImplementedException"
|
|
19
|
+
}
|
|
20
|
+
static get __super__() {
|
|
21
|
+
return PosException
|
|
22
|
+
}
|
|
23
|
+
get __class__() {
|
|
24
|
+
return NotImplementedException
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {PosInfos} from "../PosInfos"
|
|
2
|
+
import {Exception} from "../Exception"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
An exception that carry position information of a place where it was created.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PosException extends Exception {
|
|
8
|
+
constructor(message: string, previous?: null | Exception, pos?: null | PosInfos)
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
Position where this exception was created.
|
|
12
|
+
*/
|
|
13
|
+
posInfos: PosInfos
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Returns exception message.
|
|
17
|
+
*/
|
|
18
|
+
toString(): string
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Exception} from "../Exception.js"
|
|
2
|
+
import {Register} from "../../genes/Register.js"
|
|
3
|
+
|
|
4
|
+
const $global = Register.$global
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
An exception that carry position information of a place where it was created.
|
|
8
|
+
*/
|
|
9
|
+
export const PosException = Register.global("$hxClasses")["haxe.exceptions.PosException"] =
|
|
10
|
+
class PosException extends Register.inherits(Exception) {
|
|
11
|
+
new(message, previous, pos) {
|
|
12
|
+
super.new(message, previous);
|
|
13
|
+
if (pos == null) {
|
|
14
|
+
this.posInfos = {"fileName": "(unknown)", "lineNumber": 0, "className": "(unknown)", "methodName": "(unknown)"};
|
|
15
|
+
} else {
|
|
16
|
+
this.posInfos = pos;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
Returns exception message.
|
|
22
|
+
*/
|
|
23
|
+
toString() {
|
|
24
|
+
return "" + super.toString() + " in " + this.posInfos.className + "." + this.posInfos.methodName + " at " + this.posInfos.fileName + ":" + this.posInfos.lineNumber;
|
|
25
|
+
}
|
|
26
|
+
static get __name__() {
|
|
27
|
+
return "haxe.exceptions.PosException"
|
|
28
|
+
}
|
|
29
|
+
static get __super__() {
|
|
30
|
+
return Exception
|
|
31
|
+
}
|
|
32
|
+
get __class__() {
|
|
33
|
+
return PosException
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
DEPRECATED: use haxe.Rest instead.
|
|
4
|
+
|
|
5
|
+
A special type that represents "rest" function argument.
|
|
6
|
+
Should be used as a type for the last argument of an extern method,
|
|
7
|
+
representing that arbitrary number of arguments of given type can be
|
|
8
|
+
passed to that method.
|
|
9
|
+
@see <https://haxe.org/manual/lf-externs.html>
|
|
10
|
+
*/
|
|
11
|
+
export type Rest<T> = T[]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Encoding} from "./Encoding"
|
|
2
|
+
|
|
3
|
+
export declare class Bytes {
|
|
4
|
+
protected constructor(data: ArrayBuffer)
|
|
5
|
+
length: number
|
|
6
|
+
protected b: Uint8Array
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
Returns a new `Bytes` instance that contains a copy of `len` bytes of
|
|
10
|
+
`this` instance, starting at index `pos`.
|
|
11
|
+
*/
|
|
12
|
+
sub(pos: number, len: number): Bytes
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
Returns the `Bytes` representation of the given `String`, using the
|
|
16
|
+
specified encoding (UTF-8 by default).
|
|
17
|
+
*/
|
|
18
|
+
static ofString(s: string, encoding?: null | Encoding): Bytes
|
|
19
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {Error as Error__1} from "./Error.js"
|
|
2
|
+
import {Encoding} from "./Encoding.js"
|
|
3
|
+
import {Exception} from "../Exception.js"
|
|
4
|
+
import {Register} from "../../genes/Register.js"
|
|
5
|
+
|
|
6
|
+
const $global = Register.$global
|
|
7
|
+
|
|
8
|
+
export const Bytes = Register.global("$hxClasses")["haxe.io.Bytes"] =
|
|
9
|
+
class Bytes extends Register.inherits() {
|
|
10
|
+
new(data) {
|
|
11
|
+
this.length = data.byteLength;
|
|
12
|
+
this.b = new Uint8Array(data);
|
|
13
|
+
this.b.bufferValue = data;
|
|
14
|
+
data.hxBytes = this;
|
|
15
|
+
data.bytes = this.b;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
Returns a new `Bytes` instance that contains a copy of `len` bytes of
|
|
20
|
+
`this` instance, starting at index `pos`.
|
|
21
|
+
*/
|
|
22
|
+
sub(pos, len) {
|
|
23
|
+
if (pos < 0 || len < 0 || pos + len > this.length) {
|
|
24
|
+
throw Exception.thrown(Error__1.OutsideBounds);
|
|
25
|
+
};
|
|
26
|
+
return new Bytes(this.b.buffer.slice(pos + this.b.byteOffset, pos + this.b.byteOffset + len));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Returns the `Bytes` representation of the given `String`, using the
|
|
31
|
+
specified encoding (UTF-8 by default).
|
|
32
|
+
*/
|
|
33
|
+
static ofString(s, encoding) {
|
|
34
|
+
if (encoding == Encoding.RawNative) {
|
|
35
|
+
var buf = new Uint8Array(s.length << 1);
|
|
36
|
+
var _g = 0;
|
|
37
|
+
var _g1 = s.length;
|
|
38
|
+
while (_g < _g1) {
|
|
39
|
+
var i = _g++;
|
|
40
|
+
var c = s.charCodeAt(i);
|
|
41
|
+
buf[i << 1] = c & 255;
|
|
42
|
+
buf[i << 1 | 1] = c >> 8;
|
|
43
|
+
};
|
|
44
|
+
return new Bytes(buf.buffer);
|
|
45
|
+
};
|
|
46
|
+
var a = new Array();
|
|
47
|
+
var i = 0;
|
|
48
|
+
while (i < s.length) {
|
|
49
|
+
var c = s.charCodeAt(i++);
|
|
50
|
+
if (55296 <= c && c <= 56319) {
|
|
51
|
+
c = c - 55232 << 10 | s.charCodeAt(i++) & 1023;
|
|
52
|
+
};
|
|
53
|
+
if (c <= 127) {
|
|
54
|
+
a.push(c);
|
|
55
|
+
} else if (c <= 2047) {
|
|
56
|
+
a.push(192 | c >> 6);
|
|
57
|
+
a.push(128 | c & 63);
|
|
58
|
+
} else if (c <= 65535) {
|
|
59
|
+
a.push(224 | c >> 12);
|
|
60
|
+
a.push(128 | c >> 6 & 63);
|
|
61
|
+
a.push(128 | c & 63);
|
|
62
|
+
} else {
|
|
63
|
+
a.push(240 | c >> 18);
|
|
64
|
+
a.push(128 | c >> 12 & 63);
|
|
65
|
+
a.push(128 | c >> 6 & 63);
|
|
66
|
+
a.push(128 | c & 63);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
return new Bytes(new Uint8Array(a).buffer);
|
|
70
|
+
}
|
|
71
|
+
static get __name__() {
|
|
72
|
+
return "haxe.io.Bytes"
|
|
73
|
+
}
|
|
74
|
+
get __class__() {
|
|
75
|
+
return Bytes
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Bytes} from "./Bytes"
|
|
2
|
+
|
|
3
|
+
export declare class BytesBuffer {
|
|
4
|
+
constructor()
|
|
5
|
+
protected buffer: ArrayBuffer
|
|
6
|
+
protected view: DataView
|
|
7
|
+
protected u8: Uint8Array
|
|
8
|
+
protected pos: number
|
|
9
|
+
protected size: number
|
|
10
|
+
addByte($byte: number): void
|
|
11
|
+
addBytes(src: Bytes, pos: number, len: number): void
|
|
12
|
+
protected grow(delta: number): void
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
Returns either a copy or a reference of the current bytes.
|
|
16
|
+
Once called, the buffer should no longer be used.
|
|
17
|
+
*/
|
|
18
|
+
getBytes(): Bytes
|
|
19
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {Error as Error__1} from "./Error.js"
|
|
2
|
+
import {Bytes} from "./Bytes.js"
|
|
3
|
+
import {Exception} from "../Exception.js"
|
|
4
|
+
import {Register} from "../../genes/Register.js"
|
|
5
|
+
|
|
6
|
+
const $global = Register.$global
|
|
7
|
+
|
|
8
|
+
export const BytesBuffer = Register.global("$hxClasses")["haxe.io.BytesBuffer"] =
|
|
9
|
+
class BytesBuffer extends Register.inherits() {
|
|
10
|
+
new() {
|
|
11
|
+
this.pos = 0;
|
|
12
|
+
this.size = 0;
|
|
13
|
+
}
|
|
14
|
+
addByte($byte) {
|
|
15
|
+
if (this.pos == this.size) {
|
|
16
|
+
this.grow(1);
|
|
17
|
+
};
|
|
18
|
+
this.view.setUint8(this.pos++, $byte);
|
|
19
|
+
}
|
|
20
|
+
addBytes(src, pos, len) {
|
|
21
|
+
if (pos < 0 || len < 0 || pos + len > src.length) {
|
|
22
|
+
throw Exception.thrown(Error__1.OutsideBounds);
|
|
23
|
+
};
|
|
24
|
+
if (this.pos + len > this.size) {
|
|
25
|
+
this.grow(len);
|
|
26
|
+
};
|
|
27
|
+
if (this.size == 0) {
|
|
28
|
+
return;
|
|
29
|
+
};
|
|
30
|
+
this.u8.set(new Uint8Array(src.b.buffer, src.b.byteOffset + pos, len), this.pos);
|
|
31
|
+
this.pos += len;
|
|
32
|
+
}
|
|
33
|
+
grow(delta) {
|
|
34
|
+
var req = this.pos + delta;
|
|
35
|
+
var nsize = (this.size == 0) ? 16 : this.size;
|
|
36
|
+
while (nsize < req) nsize = nsize * 3 >> 1;
|
|
37
|
+
var nbuf = new ArrayBuffer(nsize);
|
|
38
|
+
var nu8 = new Uint8Array(nbuf);
|
|
39
|
+
if (this.size > 0) {
|
|
40
|
+
nu8.set(this.u8);
|
|
41
|
+
};
|
|
42
|
+
this.size = nsize;
|
|
43
|
+
this.buffer = nbuf;
|
|
44
|
+
this.u8 = nu8;
|
|
45
|
+
this.view = new DataView(this.buffer);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
Returns either a copy or a reference of the current bytes.
|
|
50
|
+
Once called, the buffer should no longer be used.
|
|
51
|
+
*/
|
|
52
|
+
getBytes() {
|
|
53
|
+
if (this.size == 0) {
|
|
54
|
+
return new Bytes(new ArrayBuffer(0));
|
|
55
|
+
};
|
|
56
|
+
var b = new Bytes(this.buffer);
|
|
57
|
+
b.length = this.pos;
|
|
58
|
+
return b;
|
|
59
|
+
}
|
|
60
|
+
static get __name__() {
|
|
61
|
+
return "haxe.io.BytesBuffer"
|
|
62
|
+
}
|
|
63
|
+
get __class__() {
|
|
64
|
+
return BytesBuffer
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {Output} from "./Output"
|
|
2
|
+
import {BytesBuffer} from "./BytesBuffer"
|
|
3
|
+
import {Bytes} from "./Bytes"
|
|
4
|
+
|
|
5
|
+
export declare class BytesOutput extends Output {
|
|
6
|
+
constructor()
|
|
7
|
+
protected b: BytesBuffer
|
|
8
|
+
writeByte(c: number): void
|
|
9
|
+
writeBytes(buf: Bytes, pos: number, len: number): number
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
Returns the `Bytes` of this output.
|
|
13
|
+
|
|
14
|
+
This function should not be called more than once on a given
|
|
15
|
+
`BytesOutput` instance.
|
|
16
|
+
*/
|
|
17
|
+
getBytes(): Bytes
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {Output} from "./Output.js"
|
|
2
|
+
import {BytesBuffer} from "./BytesBuffer.js"
|
|
3
|
+
import {Register} from "../../genes/Register.js"
|
|
4
|
+
|
|
5
|
+
const $global = Register.$global
|
|
6
|
+
|
|
7
|
+
export const BytesOutput = Register.global("$hxClasses")["haxe.io.BytesOutput"] =
|
|
8
|
+
class BytesOutput extends Register.inherits(Output) {
|
|
9
|
+
new() {
|
|
10
|
+
this.b = new BytesBuffer();
|
|
11
|
+
}
|
|
12
|
+
writeByte(c) {
|
|
13
|
+
this.b.addByte(c);
|
|
14
|
+
}
|
|
15
|
+
writeBytes(buf, pos, len) {
|
|
16
|
+
this.b.addBytes(buf, pos, len);
|
|
17
|
+
return len;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
Returns the `Bytes` of this output.
|
|
22
|
+
|
|
23
|
+
This function should not be called more than once on a given
|
|
24
|
+
`BytesOutput` instance.
|
|
25
|
+
*/
|
|
26
|
+
getBytes() {
|
|
27
|
+
return this.b.getBytes();
|
|
28
|
+
}
|
|
29
|
+
static get __name__() {
|
|
30
|
+
return "haxe.io.BytesOutput"
|
|
31
|
+
}
|
|
32
|
+
static get __super__() {
|
|
33
|
+
return Output
|
|
34
|
+
}
|
|
35
|
+
get __class__() {
|
|
36
|
+
return BytesOutput
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
String binary encoding supported by Haxe I/O
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace Encoding {
|
|
6
|
+
export type UTF8 = {_hx_index: 0, __enum__: "haxe.io.Encoding"}
|
|
7
|
+
export const UTF8: UTF8
|
|
8
|
+
export type RawNative = {_hx_index: 1, __enum__: "haxe.io.Encoding"}
|
|
9
|
+
export const RawNative: RawNative
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
String binary encoding supported by Haxe I/O
|
|
14
|
+
*/
|
|
15
|
+
export declare type Encoding =
|
|
16
|
+
| Encoding.UTF8
|
|
17
|
+
/**
|
|
18
|
+
Output the string the way the platform represent it in memory. This is the most efficient but is platform-specific
|
|
19
|
+
*/
|
|
20
|
+
| Encoding.RawNative
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {Register} from "../../genes/Register.js"
|
|
2
|
+
|
|
3
|
+
const $global = Register.$global
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
String binary encoding supported by Haxe I/O
|
|
7
|
+
*/
|
|
8
|
+
export const Encoding =
|
|
9
|
+
Register.global("$hxEnums")["haxe.io.Encoding"] =
|
|
10
|
+
{
|
|
11
|
+
__ename__: "haxe.io.Encoding",
|
|
12
|
+
|
|
13
|
+
UTF8: {_hx_name: "UTF8", _hx_index: 0, __enum__: "haxe.io.Encoding"},
|
|
14
|
+
/**
|
|
15
|
+
Output the string the way the platform represent it in memory. This is the most efficient but is platform-specific
|
|
16
|
+
*/
|
|
17
|
+
RawNative: {_hx_name: "RawNative", _hx_index: 1, __enum__: "haxe.io.Encoding"}
|
|
18
|
+
}
|
|
19
|
+
Encoding.__constructs__ = [Encoding.UTF8, Encoding.RawNative]
|
|
20
|
+
Encoding.__empty_constructs__ = [Encoding.UTF8, Encoding.RawNative]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
The possible IO errors that can occur
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace Error {
|
|
6
|
+
export type Overflow = {_hx_index: 1, __enum__: "haxe.io.Error"}
|
|
7
|
+
export const Overflow: Overflow
|
|
8
|
+
export type OutsideBounds = {_hx_index: 2, __enum__: "haxe.io.Error"}
|
|
9
|
+
export const OutsideBounds: OutsideBounds
|
|
10
|
+
export type Custom = {_hx_index: 3, e: any, __enum__: "haxe.io.Error"}
|
|
11
|
+
export const Custom: (e: any) => Error
|
|
12
|
+
export type Blocked = {_hx_index: 0, __enum__: "haxe.io.Error"}
|
|
13
|
+
export const Blocked: Blocked
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
The possible IO errors that can occur
|
|
18
|
+
*/
|
|
19
|
+
export declare type Error =
|
|
20
|
+
/**
|
|
21
|
+
An integer value is outside its allowed range
|
|
22
|
+
*/
|
|
23
|
+
| Error.Overflow
|
|
24
|
+
/**
|
|
25
|
+
An operation on Bytes is outside of its valid range
|
|
26
|
+
*/
|
|
27
|
+
| Error.OutsideBounds
|
|
28
|
+
/**
|
|
29
|
+
Other errors
|
|
30
|
+
*/
|
|
31
|
+
| Error.Custom
|
|
32
|
+
/**
|
|
33
|
+
The IO is set into nonblocking mode and some data cannot be read or written
|
|
34
|
+
*/
|
|
35
|
+
| Error.Blocked
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {Register} from "../../genes/Register.js"
|
|
2
|
+
|
|
3
|
+
const $global = Register.$global
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
The possible IO errors that can occur
|
|
7
|
+
*/
|
|
8
|
+
export const Error =
|
|
9
|
+
Register.global("$hxEnums")["haxe.io.Error"] =
|
|
10
|
+
{
|
|
11
|
+
__ename__: "haxe.io.Error",
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
The IO is set into nonblocking mode and some data cannot be read or written
|
|
15
|
+
*/
|
|
16
|
+
Blocked: {_hx_name: "Blocked", _hx_index: 0, __enum__: "haxe.io.Error"},
|
|
17
|
+
/**
|
|
18
|
+
An integer value is outside its allowed range
|
|
19
|
+
*/
|
|
20
|
+
Overflow: {_hx_name: "Overflow", _hx_index: 1, __enum__: "haxe.io.Error"},
|
|
21
|
+
/**
|
|
22
|
+
An operation on Bytes is outside of its valid range
|
|
23
|
+
*/
|
|
24
|
+
OutsideBounds: {_hx_name: "OutsideBounds", _hx_index: 2, __enum__: "haxe.io.Error"},
|
|
25
|
+
/**
|
|
26
|
+
Other errors
|
|
27
|
+
*/
|
|
28
|
+
Custom: Object.assign((e) => ({_hx_index: 3, __enum__: "haxe.io.Error", "e": e}), {_hx_name: "Custom", __params__: ["e"]})
|
|
29
|
+
}
|
|
30
|
+
Error.__constructs__ = [Error.Blocked, Error.Overflow, Error.OutsideBounds, Error.Custom]
|
|
31
|
+
Error.__empty_constructs__ = [Error.Blocked, Error.Overflow, Error.OutsideBounds]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {Encoding} from "./Encoding"
|
|
2
|
+
import {Bytes} from "./Bytes"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
An Output is an abstract write. A specific output implementation will only
|
|
6
|
+
have to override the `writeByte` and maybe the `write`, `flush` and `close`
|
|
7
|
+
methods. See `File.write` and `String.write` for two ways of creating an
|
|
8
|
+
Output.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Output {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
Endianness (word byte order) used when writing numbers.
|
|
14
|
+
|
|
15
|
+
If `true`, big-endian is used, otherwise `little-endian` is used.
|
|
16
|
+
*/
|
|
17
|
+
bigEndian: boolean
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
Write one byte.
|
|
21
|
+
*/
|
|
22
|
+
writeByte(c: number): void
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
Write `len` bytes from `s` starting by position specified by `pos`.
|
|
26
|
+
|
|
27
|
+
Returns the actual length of written data that can differ from `len`.
|
|
28
|
+
|
|
29
|
+
See `writeFullBytes` that tries to write the exact amount of specified bytes.
|
|
30
|
+
*/
|
|
31
|
+
writeBytes(s: Bytes, pos: number, len: number): number
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
Write all bytes stored in `s`.
|
|
35
|
+
*/
|
|
36
|
+
write(s: Bytes): void
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
Write `len` bytes from `s` starting by position specified by `pos`.
|
|
40
|
+
|
|
41
|
+
Unlike `writeBytes`, this method tries to write the exact `len` amount of bytes.
|
|
42
|
+
*/
|
|
43
|
+
writeFullBytes(s: Bytes, pos: number, len: number): void
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
Write `x` as 16-bit unsigned integer.
|
|
47
|
+
|
|
48
|
+
Endianness is specified by the `bigEndian` property.
|
|
49
|
+
*/
|
|
50
|
+
writeUInt16(x: number): void
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
Write `x` as 32-bit signed integer.
|
|
54
|
+
|
|
55
|
+
Endianness is specified by the `bigEndian` property.
|
|
56
|
+
*/
|
|
57
|
+
writeInt32(x: number): void
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
Write `s` string.
|
|
61
|
+
*/
|
|
62
|
+
writeString(s: string, encoding?: null | Encoding): void
|
|
63
|
+
}
|