mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
39539 lines
2.2 MiB
39539 lines
2.2 MiB
"use strict";
|
|
(function() {
|
|
|
|
Error.stackTraceLimit = Infinity;
|
|
|
|
var $global, $module;
|
|
if (typeof window !== "undefined") { /* web page */
|
|
$global = window;
|
|
} else if (typeof self !== "undefined") { /* web worker */
|
|
$global = self;
|
|
} else if (typeof global !== "undefined") { /* Node.js */
|
|
$global = global;
|
|
$global.require = require;
|
|
} else { /* others (e.g. Nashorn) */
|
|
$global = this;
|
|
}
|
|
|
|
if ($global === undefined || $global.Array === undefined) {
|
|
throw new Error("no global object found");
|
|
}
|
|
if (typeof module !== "undefined") {
|
|
$module = module;
|
|
}
|
|
|
|
var $packages = {}, $idCounter = 0;
|
|
var $keys = function(m) { return m ? Object.keys(m) : []; };
|
|
var $flushConsole = function() {};
|
|
var $throwRuntimeError; /* set by package "runtime" */
|
|
var $throwNilPointerError = function() { $throwRuntimeError("invalid memory address or nil pointer dereference"); };
|
|
var $call = function(fn, rcvr, args) { return fn.apply(rcvr, args); };
|
|
var $makeFunc = function(fn) { return function() { return $externalize(fn(this, new ($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments, []))), $emptyInterface); }; };
|
|
var $unused = function(v) {};
|
|
|
|
var $mapArray = function(array, f) {
|
|
var newArray = new array.constructor(array.length);
|
|
for (var i = 0; i < array.length; i++) {
|
|
newArray[i] = f(array[i]);
|
|
}
|
|
return newArray;
|
|
};
|
|
|
|
var $methodVal = function(recv, name) {
|
|
var vals = recv.$methodVals || {};
|
|
recv.$methodVals = vals; /* noop for primitives */
|
|
var f = vals[name];
|
|
if (f !== undefined) {
|
|
return f;
|
|
}
|
|
var method = recv[name];
|
|
f = function() {
|
|
$stackDepthOffset--;
|
|
try {
|
|
return method.apply(recv, arguments);
|
|
} finally {
|
|
$stackDepthOffset++;
|
|
}
|
|
};
|
|
vals[name] = f;
|
|
return f;
|
|
};
|
|
|
|
var $methodExpr = function(typ, name) {
|
|
var method = typ.prototype[name];
|
|
if (method.$expr === undefined) {
|
|
method.$expr = function() {
|
|
$stackDepthOffset--;
|
|
try {
|
|
if (typ.wrapped) {
|
|
arguments[0] = new typ(arguments[0]);
|
|
}
|
|
return Function.call.apply(method, arguments);
|
|
} finally {
|
|
$stackDepthOffset++;
|
|
}
|
|
};
|
|
}
|
|
return method.$expr;
|
|
};
|
|
|
|
var $ifaceMethodExprs = {};
|
|
var $ifaceMethodExpr = function(name) {
|
|
var expr = $ifaceMethodExprs["$" + name];
|
|
if (expr === undefined) {
|
|
expr = $ifaceMethodExprs["$" + name] = function() {
|
|
$stackDepthOffset--;
|
|
try {
|
|
return Function.call.apply(arguments[0][name], arguments);
|
|
} finally {
|
|
$stackDepthOffset++;
|
|
}
|
|
};
|
|
}
|
|
return expr;
|
|
};
|
|
|
|
var $subslice = function(slice, low, high, max) {
|
|
if (high === undefined) {
|
|
high = slice.$length;
|
|
}
|
|
if (max === undefined) {
|
|
max = slice.$capacity;
|
|
}
|
|
if (low < 0 || high < low || max < high || high > slice.$capacity || max > slice.$capacity) {
|
|
$throwRuntimeError("slice bounds out of range");
|
|
}
|
|
if (slice === slice.constructor.nil) {
|
|
return slice;
|
|
}
|
|
var s = new slice.constructor(slice.$array);
|
|
s.$offset = slice.$offset + low;
|
|
s.$length = high - low;
|
|
s.$capacity = max - low;
|
|
return s;
|
|
};
|
|
|
|
var $substring = function(str, low, high) {
|
|
if (low < 0 || high < low || high > str.length) {
|
|
$throwRuntimeError("slice bounds out of range");
|
|
}
|
|
return str.substring(low, high);
|
|
};
|
|
|
|
var $sliceToArray = function(slice) {
|
|
if (slice.$array.constructor !== Array) {
|
|
return slice.$array.subarray(slice.$offset, slice.$offset + slice.$length);
|
|
}
|
|
return slice.$array.slice(slice.$offset, slice.$offset + slice.$length);
|
|
};
|
|
|
|
var $decodeRune = function(str, pos) {
|
|
var c0 = str.charCodeAt(pos);
|
|
|
|
if (c0 < 0x80) {
|
|
return [c0, 1];
|
|
}
|
|
|
|
if (c0 !== c0 || c0 < 0xC0) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
|
|
var c1 = str.charCodeAt(pos + 1);
|
|
if (c1 !== c1 || c1 < 0x80 || 0xC0 <= c1) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
|
|
if (c0 < 0xE0) {
|
|
var r = (c0 & 0x1F) << 6 | (c1 & 0x3F);
|
|
if (r <= 0x7F) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
return [r, 2];
|
|
}
|
|
|
|
var c2 = str.charCodeAt(pos + 2);
|
|
if (c2 !== c2 || c2 < 0x80 || 0xC0 <= c2) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
|
|
if (c0 < 0xF0) {
|
|
var r = (c0 & 0x0F) << 12 | (c1 & 0x3F) << 6 | (c2 & 0x3F);
|
|
if (r <= 0x7FF) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
if (0xD800 <= r && r <= 0xDFFF) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
return [r, 3];
|
|
}
|
|
|
|
var c3 = str.charCodeAt(pos + 3);
|
|
if (c3 !== c3 || c3 < 0x80 || 0xC0 <= c3) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
|
|
if (c0 < 0xF8) {
|
|
var r = (c0 & 0x07) << 18 | (c1 & 0x3F) << 12 | (c2 & 0x3F) << 6 | (c3 & 0x3F);
|
|
if (r <= 0xFFFF || 0x10FFFF < r) {
|
|
return [0xFFFD, 1];
|
|
}
|
|
return [r, 4];
|
|
}
|
|
|
|
return [0xFFFD, 1];
|
|
};
|
|
|
|
var $encodeRune = function(r) {
|
|
if (r < 0 || r > 0x10FFFF || (0xD800 <= r && r <= 0xDFFF)) {
|
|
r = 0xFFFD;
|
|
}
|
|
if (r <= 0x7F) {
|
|
return String.fromCharCode(r);
|
|
}
|
|
if (r <= 0x7FF) {
|
|
return String.fromCharCode(0xC0 | r >> 6, 0x80 | (r & 0x3F));
|
|
}
|
|
if (r <= 0xFFFF) {
|
|
return String.fromCharCode(0xE0 | r >> 12, 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F));
|
|
}
|
|
return String.fromCharCode(0xF0 | r >> 18, 0x80 | (r >> 12 & 0x3F), 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F));
|
|
};
|
|
|
|
var $stringToBytes = function(str) {
|
|
var array = new Uint8Array(str.length);
|
|
for (var i = 0; i < str.length; i++) {
|
|
array[i] = str.charCodeAt(i);
|
|
}
|
|
return array;
|
|
};
|
|
|
|
var $bytesToString = function(slice) {
|
|
if (slice.$length === 0) {
|
|
return "";
|
|
}
|
|
var str = "";
|
|
for (var i = 0; i < slice.$length; i += 10000) {
|
|
str += String.fromCharCode.apply(undefined, slice.$array.subarray(slice.$offset + i, slice.$offset + Math.min(slice.$length, i + 10000)));
|
|
}
|
|
return str;
|
|
};
|
|
|
|
var $stringToRunes = function(str) {
|
|
var array = new Int32Array(str.length);
|
|
var rune, j = 0;
|
|
for (var i = 0; i < str.length; i += rune[1], j++) {
|
|
rune = $decodeRune(str, i);
|
|
array[j] = rune[0];
|
|
}
|
|
return array.subarray(0, j);
|
|
};
|
|
|
|
var $runesToString = function(slice) {
|
|
if (slice.$length === 0) {
|
|
return "";
|
|
}
|
|
var str = "";
|
|
for (var i = 0; i < slice.$length; i++) {
|
|
str += $encodeRune(slice.$array[slice.$offset + i]);
|
|
}
|
|
return str;
|
|
};
|
|
|
|
var $copyString = function(dst, src) {
|
|
var n = Math.min(src.length, dst.$length);
|
|
for (var i = 0; i < n; i++) {
|
|
dst.$array[dst.$offset + i] = src.charCodeAt(i);
|
|
}
|
|
return n;
|
|
};
|
|
|
|
var $copySlice = function(dst, src) {
|
|
var n = Math.min(src.$length, dst.$length);
|
|
$copyArray(dst.$array, src.$array, dst.$offset, src.$offset, n, dst.constructor.elem);
|
|
return n;
|
|
};
|
|
|
|
var $copyArray = function(dst, src, dstOffset, srcOffset, n, elem) {
|
|
if (n === 0 || (dst === src && dstOffset === srcOffset)) {
|
|
return;
|
|
}
|
|
|
|
if (src.subarray) {
|
|
dst.set(src.subarray(srcOffset, srcOffset + n), dstOffset);
|
|
return;
|
|
}
|
|
|
|
switch (elem.kind) {
|
|
case $kindArray:
|
|
case $kindStruct:
|
|
if (dst === src && dstOffset > srcOffset) {
|
|
for (var i = n - 1; i >= 0; i--) {
|
|
elem.copy(dst[dstOffset + i], src[srcOffset + i]);
|
|
}
|
|
return;
|
|
}
|
|
for (var i = 0; i < n; i++) {
|
|
elem.copy(dst[dstOffset + i], src[srcOffset + i]);
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (dst === src && dstOffset > srcOffset) {
|
|
for (var i = n - 1; i >= 0; i--) {
|
|
dst[dstOffset + i] = src[srcOffset + i];
|
|
}
|
|
return;
|
|
}
|
|
for (var i = 0; i < n; i++) {
|
|
dst[dstOffset + i] = src[srcOffset + i];
|
|
}
|
|
};
|
|
|
|
var $clone = function(src, type) {
|
|
var clone = type.zero();
|
|
type.copy(clone, src);
|
|
return clone;
|
|
};
|
|
|
|
var $pointerOfStructConversion = function(obj, type) {
|
|
if(obj.$proxies === undefined) {
|
|
obj.$proxies = {};
|
|
obj.$proxies[obj.constructor.string] = obj;
|
|
}
|
|
var proxy = obj.$proxies[type.string];
|
|
if (proxy === undefined) {
|
|
var properties = {};
|
|
for (var i = 0; i < type.elem.fields.length; i++) {
|
|
(function(fieldProp) {
|
|
properties[fieldProp] = {
|
|
get: function() { return obj[fieldProp]; },
|
|
set: function(value) { obj[fieldProp] = value; }
|
|
};
|
|
})(type.elem.fields[i].prop);
|
|
}
|
|
proxy = Object.create(type.prototype, properties);
|
|
proxy.$val = proxy;
|
|
obj.$proxies[type.string] = proxy;
|
|
proxy.$proxies = obj.$proxies;
|
|
}
|
|
return proxy;
|
|
};
|
|
|
|
var $append = function(slice) {
|
|
return $internalAppend(slice, arguments, 1, arguments.length - 1);
|
|
};
|
|
|
|
var $appendSlice = function(slice, toAppend) {
|
|
if (toAppend.constructor === String) {
|
|
var bytes = $stringToBytes(toAppend);
|
|
return $internalAppend(slice, bytes, 0, bytes.length);
|
|
}
|
|
return $internalAppend(slice, toAppend.$array, toAppend.$offset, toAppend.$length);
|
|
};
|
|
|
|
var $internalAppend = function(slice, array, offset, length) {
|
|
if (length === 0) {
|
|
return slice;
|
|
}
|
|
|
|
var newArray = slice.$array;
|
|
var newOffset = slice.$offset;
|
|
var newLength = slice.$length + length;
|
|
var newCapacity = slice.$capacity;
|
|
|
|
if (newLength > newCapacity) {
|
|
newOffset = 0;
|
|
newCapacity = Math.max(newLength, slice.$capacity < 1024 ? slice.$capacity * 2 : Math.floor(slice.$capacity * 5 / 4));
|
|
|
|
if (slice.$array.constructor === Array) {
|
|
newArray = slice.$array.slice(slice.$offset, slice.$offset + slice.$length);
|
|
newArray.length = newCapacity;
|
|
var zero = slice.constructor.elem.zero;
|
|
for (var i = slice.$length; i < newCapacity; i++) {
|
|
newArray[i] = zero();
|
|
}
|
|
} else {
|
|
newArray = new slice.$array.constructor(newCapacity);
|
|
newArray.set(slice.$array.subarray(slice.$offset, slice.$offset + slice.$length));
|
|
}
|
|
}
|
|
|
|
$copyArray(newArray, array, newOffset + slice.$length, offset, length, slice.constructor.elem);
|
|
|
|
var newSlice = new slice.constructor(newArray);
|
|
newSlice.$offset = newOffset;
|
|
newSlice.$length = newLength;
|
|
newSlice.$capacity = newCapacity;
|
|
return newSlice;
|
|
};
|
|
|
|
var $equal = function(a, b, type) {
|
|
if (type === $jsObjectPtr) {
|
|
return a === b;
|
|
}
|
|
switch (type.kind) {
|
|
case $kindComplex64:
|
|
case $kindComplex128:
|
|
return a.$real === b.$real && a.$imag === b.$imag;
|
|
case $kindInt64:
|
|
case $kindUint64:
|
|
return a.$high === b.$high && a.$low === b.$low;
|
|
case $kindArray:
|
|
if (a.length !== b.length) {
|
|
return false;
|
|
}
|
|
for (var i = 0; i < a.length; i++) {
|
|
if (!$equal(a[i], b[i], type.elem)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
case $kindStruct:
|
|
for (var i = 0; i < type.fields.length; i++) {
|
|
var f = type.fields[i];
|
|
if (!$equal(a[f.prop], b[f.prop], f.typ)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
case $kindInterface:
|
|
return $interfaceIsEqual(a, b);
|
|
default:
|
|
return a === b;
|
|
}
|
|
};
|
|
|
|
var $interfaceIsEqual = function(a, b) {
|
|
if (a === $ifaceNil || b === $ifaceNil) {
|
|
return a === b;
|
|
}
|
|
if (a.constructor !== b.constructor) {
|
|
return false;
|
|
}
|
|
if (a.constructor === $jsObjectPtr) {
|
|
return a.object === b.object;
|
|
}
|
|
if (!a.constructor.comparable) {
|
|
$throwRuntimeError("comparing uncomparable type " + a.constructor.string);
|
|
}
|
|
return $equal(a.$val, b.$val, a.constructor);
|
|
};
|
|
|
|
var $min = Math.min;
|
|
var $mod = function(x, y) { return x % y; };
|
|
var $parseInt = parseInt;
|
|
var $parseFloat = function(f) {
|
|
if (f !== undefined && f !== null && f.constructor === Number) {
|
|
return f;
|
|
}
|
|
return parseFloat(f);
|
|
};
|
|
|
|
var $froundBuf = new Float32Array(1);
|
|
var $fround = Math.fround || function(f) {
|
|
$froundBuf[0] = f;
|
|
return $froundBuf[0];
|
|
};
|
|
|
|
var $imul = Math.imul || function(a, b) {
|
|
var ah = (a >>> 16) & 0xffff;
|
|
var al = a & 0xffff;
|
|
var bh = (b >>> 16) & 0xffff;
|
|
var bl = b & 0xffff;
|
|
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) >> 0);
|
|
};
|
|
|
|
var $floatKey = function(f) {
|
|
if (f !== f) {
|
|
$idCounter++;
|
|
return "NaN$" + $idCounter;
|
|
}
|
|
return String(f);
|
|
};
|
|
|
|
var $flatten64 = function(x) {
|
|
return x.$high * 4294967296 + x.$low;
|
|
};
|
|
|
|
var $shiftLeft64 = function(x, y) {
|
|
if (y === 0) {
|
|
return x;
|
|
}
|
|
if (y < 32) {
|
|
return new x.constructor(x.$high << y | x.$low >>> (32 - y), (x.$low << y) >>> 0);
|
|
}
|
|
if (y < 64) {
|
|
return new x.constructor(x.$low << (y - 32), 0);
|
|
}
|
|
return new x.constructor(0, 0);
|
|
};
|
|
|
|
var $shiftRightInt64 = function(x, y) {
|
|
if (y === 0) {
|
|
return x;
|
|
}
|
|
if (y < 32) {
|
|
return new x.constructor(x.$high >> y, (x.$low >>> y | x.$high << (32 - y)) >>> 0);
|
|
}
|
|
if (y < 64) {
|
|
return new x.constructor(x.$high >> 31, (x.$high >> (y - 32)) >>> 0);
|
|
}
|
|
if (x.$high < 0) {
|
|
return new x.constructor(-1, 4294967295);
|
|
}
|
|
return new x.constructor(0, 0);
|
|
};
|
|
|
|
var $shiftRightUint64 = function(x, y) {
|
|
if (y === 0) {
|
|
return x;
|
|
}
|
|
if (y < 32) {
|
|
return new x.constructor(x.$high >>> y, (x.$low >>> y | x.$high << (32 - y)) >>> 0);
|
|
}
|
|
if (y < 64) {
|
|
return new x.constructor(0, x.$high >>> (y - 32));
|
|
}
|
|
return new x.constructor(0, 0);
|
|
};
|
|
|
|
var $mul64 = function(x, y) {
|
|
var high = 0, low = 0;
|
|
if ((y.$low & 1) !== 0) {
|
|
high = x.$high;
|
|
low = x.$low;
|
|
}
|
|
for (var i = 1; i < 32; i++) {
|
|
if ((y.$low & 1<<i) !== 0) {
|
|
high += x.$high << i | x.$low >>> (32 - i);
|
|
low += (x.$low << i) >>> 0;
|
|
}
|
|
}
|
|
for (var i = 0; i < 32; i++) {
|
|
if ((y.$high & 1<<i) !== 0) {
|
|
high += x.$low << i;
|
|
}
|
|
}
|
|
return new x.constructor(high, low);
|
|
};
|
|
|
|
var $div64 = function(x, y, returnRemainder) {
|
|
if (y.$high === 0 && y.$low === 0) {
|
|
$throwRuntimeError("integer divide by zero");
|
|
}
|
|
|
|
var s = 1;
|
|
var rs = 1;
|
|
|
|
var xHigh = x.$high;
|
|
var xLow = x.$low;
|
|
if (xHigh < 0) {
|
|
s = -1;
|
|
rs = -1;
|
|
xHigh = -xHigh;
|
|
if (xLow !== 0) {
|
|
xHigh--;
|
|
xLow = 4294967296 - xLow;
|
|
}
|
|
}
|
|
|
|
var yHigh = y.$high;
|
|
var yLow = y.$low;
|
|
if (y.$high < 0) {
|
|
s *= -1;
|
|
yHigh = -yHigh;
|
|
if (yLow !== 0) {
|
|
yHigh--;
|
|
yLow = 4294967296 - yLow;
|
|
}
|
|
}
|
|
|
|
var high = 0, low = 0, n = 0;
|
|
while (yHigh < 2147483648 && ((xHigh > yHigh) || (xHigh === yHigh && xLow > yLow))) {
|
|
yHigh = (yHigh << 1 | yLow >>> 31) >>> 0;
|
|
yLow = (yLow << 1) >>> 0;
|
|
n++;
|
|
}
|
|
for (var i = 0; i <= n; i++) {
|
|
high = high << 1 | low >>> 31;
|
|
low = (low << 1) >>> 0;
|
|
if ((xHigh > yHigh) || (xHigh === yHigh && xLow >= yLow)) {
|
|
xHigh = xHigh - yHigh;
|
|
xLow = xLow - yLow;
|
|
if (xLow < 0) {
|
|
xHigh--;
|
|
xLow += 4294967296;
|
|
}
|
|
low++;
|
|
if (low === 4294967296) {
|
|
high++;
|
|
low = 0;
|
|
}
|
|
}
|
|
yLow = (yLow >>> 1 | yHigh << (32 - 1)) >>> 0;
|
|
yHigh = yHigh >>> 1;
|
|
}
|
|
|
|
if (returnRemainder) {
|
|
return new x.constructor(xHigh * rs, xLow * rs);
|
|
}
|
|
return new x.constructor(high * s, low * s);
|
|
};
|
|
|
|
var $divComplex = function(n, d) {
|
|
var ninf = n.$real === Infinity || n.$real === -Infinity || n.$imag === Infinity || n.$imag === -Infinity;
|
|
var dinf = d.$real === Infinity || d.$real === -Infinity || d.$imag === Infinity || d.$imag === -Infinity;
|
|
var nnan = !ninf && (n.$real !== n.$real || n.$imag !== n.$imag);
|
|
var dnan = !dinf && (d.$real !== d.$real || d.$imag !== d.$imag);
|
|
if(nnan || dnan) {
|
|
return new n.constructor(NaN, NaN);
|
|
}
|
|
if (ninf && !dinf) {
|
|
return new n.constructor(Infinity, Infinity);
|
|
}
|
|
if (!ninf && dinf) {
|
|
return new n.constructor(0, 0);
|
|
}
|
|
if (d.$real === 0 && d.$imag === 0) {
|
|
if (n.$real === 0 && n.$imag === 0) {
|
|
return new n.constructor(NaN, NaN);
|
|
}
|
|
return new n.constructor(Infinity, Infinity);
|
|
}
|
|
var a = Math.abs(d.$real);
|
|
var b = Math.abs(d.$imag);
|
|
if (a <= b) {
|
|
var ratio = d.$real / d.$imag;
|
|
var denom = d.$real * ratio + d.$imag;
|
|
return new n.constructor((n.$real * ratio + n.$imag) / denom, (n.$imag * ratio - n.$real) / denom);
|
|
}
|
|
var ratio = d.$imag / d.$real;
|
|
var denom = d.$imag * ratio + d.$real;
|
|
return new n.constructor((n.$imag * ratio + n.$real) / denom, (n.$imag - n.$real * ratio) / denom);
|
|
};
|
|
|
|
var $kindBool = 1;
|
|
var $kindInt = 2;
|
|
var $kindInt8 = 3;
|
|
var $kindInt16 = 4;
|
|
var $kindInt32 = 5;
|
|
var $kindInt64 = 6;
|
|
var $kindUint = 7;
|
|
var $kindUint8 = 8;
|
|
var $kindUint16 = 9;
|
|
var $kindUint32 = 10;
|
|
var $kindUint64 = 11;
|
|
var $kindUintptr = 12;
|
|
var $kindFloat32 = 13;
|
|
var $kindFloat64 = 14;
|
|
var $kindComplex64 = 15;
|
|
var $kindComplex128 = 16;
|
|
var $kindArray = 17;
|
|
var $kindChan = 18;
|
|
var $kindFunc = 19;
|
|
var $kindInterface = 20;
|
|
var $kindMap = 21;
|
|
var $kindPtr = 22;
|
|
var $kindSlice = 23;
|
|
var $kindString = 24;
|
|
var $kindStruct = 25;
|
|
var $kindUnsafePointer = 26;
|
|
|
|
var $methodSynthesizers = [];
|
|
var $addMethodSynthesizer = function(f) {
|
|
if ($methodSynthesizers === null) {
|
|
f();
|
|
return;
|
|
}
|
|
$methodSynthesizers.push(f);
|
|
};
|
|
var $synthesizeMethods = function() {
|
|
$methodSynthesizers.forEach(function(f) { f(); });
|
|
$methodSynthesizers = null;
|
|
};
|
|
|
|
var $ifaceKeyFor = function(x) {
|
|
if (x === $ifaceNil) {
|
|
return 'nil';
|
|
}
|
|
var c = x.constructor;
|
|
return c.string + '$' + c.keyFor(x.$val);
|
|
};
|
|
|
|
var $identity = function(x) { return x; };
|
|
|
|
var $typeIDCounter = 0;
|
|
|
|
var $idKey = function(x) {
|
|
if (x.$id === undefined) {
|
|
$idCounter++;
|
|
x.$id = $idCounter;
|
|
}
|
|
return String(x.$id);
|
|
};
|
|
|
|
var $newType = function(size, kind, string, named, pkg, exported, constructor) {
|
|
var typ;
|
|
switch(kind) {
|
|
case $kindBool:
|
|
case $kindInt:
|
|
case $kindInt8:
|
|
case $kindInt16:
|
|
case $kindInt32:
|
|
case $kindUint:
|
|
case $kindUint8:
|
|
case $kindUint16:
|
|
case $kindUint32:
|
|
case $kindUintptr:
|
|
case $kindUnsafePointer:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.keyFor = $identity;
|
|
break;
|
|
|
|
case $kindString:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.keyFor = function(x) { return "$" + x; };
|
|
break;
|
|
|
|
case $kindFloat32:
|
|
case $kindFloat64:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.keyFor = function(x) { return $floatKey(x); };
|
|
break;
|
|
|
|
case $kindInt64:
|
|
typ = function(high, low) {
|
|
this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >> 0;
|
|
this.$low = low >>> 0;
|
|
this.$val = this;
|
|
};
|
|
typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
|
|
break;
|
|
|
|
case $kindUint64:
|
|
typ = function(high, low) {
|
|
this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >>> 0;
|
|
this.$low = low >>> 0;
|
|
this.$val = this;
|
|
};
|
|
typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
|
|
break;
|
|
|
|
case $kindComplex64:
|
|
typ = function(real, imag) {
|
|
this.$real = $fround(real);
|
|
this.$imag = $fround(imag);
|
|
this.$val = this;
|
|
};
|
|
typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
|
|
break;
|
|
|
|
case $kindComplex128:
|
|
typ = function(real, imag) {
|
|
this.$real = real;
|
|
this.$imag = imag;
|
|
this.$val = this;
|
|
};
|
|
typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
|
|
break;
|
|
|
|
case $kindArray:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.ptr = $newType(4, $kindPtr, "*" + string, false, "", false, function(array) {
|
|
this.$get = function() { return array; };
|
|
this.$set = function(v) { typ.copy(this, v); };
|
|
this.$val = array;
|
|
});
|
|
typ.init = function(elem, len) {
|
|
typ.elem = elem;
|
|
typ.len = len;
|
|
typ.comparable = elem.comparable;
|
|
typ.keyFor = function(x) {
|
|
return Array.prototype.join.call($mapArray(x, function(e) {
|
|
return String(elem.keyFor(e)).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
|
|
}), "$");
|
|
};
|
|
typ.copy = function(dst, src) {
|
|
$copyArray(dst, src, 0, 0, src.length, elem);
|
|
};
|
|
typ.ptr.init(typ);
|
|
Object.defineProperty(typ.ptr.nil, "nilCheck", { get: $throwNilPointerError });
|
|
};
|
|
break;
|
|
|
|
case $kindChan:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.keyFor = $idKey;
|
|
typ.init = function(elem, sendOnly, recvOnly) {
|
|
typ.elem = elem;
|
|
typ.sendOnly = sendOnly;
|
|
typ.recvOnly = recvOnly;
|
|
};
|
|
break;
|
|
|
|
case $kindFunc:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.init = function(params, results, variadic) {
|
|
typ.params = params;
|
|
typ.results = results;
|
|
typ.variadic = variadic;
|
|
typ.comparable = false;
|
|
};
|
|
break;
|
|
|
|
case $kindInterface:
|
|
typ = { implementedBy: {}, missingMethodFor: {} };
|
|
typ.keyFor = $ifaceKeyFor;
|
|
typ.init = function(methods) {
|
|
typ.methods = methods;
|
|
methods.forEach(function(m) {
|
|
$ifaceNil[m.prop] = $throwNilPointerError;
|
|
});
|
|
};
|
|
break;
|
|
|
|
case $kindMap:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.init = function(key, elem) {
|
|
typ.key = key;
|
|
typ.elem = elem;
|
|
typ.comparable = false;
|
|
};
|
|
break;
|
|
|
|
case $kindPtr:
|
|
typ = constructor || function(getter, setter, target) {
|
|
this.$get = getter;
|
|
this.$set = setter;
|
|
this.$target = target;
|
|
this.$val = this;
|
|
};
|
|
typ.keyFor = $idKey;
|
|
typ.init = function(elem) {
|
|
typ.elem = elem;
|
|
typ.wrapped = (elem.kind === $kindArray);
|
|
typ.nil = new typ($throwNilPointerError, $throwNilPointerError);
|
|
};
|
|
break;
|
|
|
|
case $kindSlice:
|
|
typ = function(array) {
|
|
if (array.constructor !== typ.nativeArray) {
|
|
array = new typ.nativeArray(array);
|
|
}
|
|
this.$array = array;
|
|
this.$offset = 0;
|
|
this.$length = array.length;
|
|
this.$capacity = array.length;
|
|
this.$val = this;
|
|
};
|
|
typ.init = function(elem) {
|
|
typ.elem = elem;
|
|
typ.comparable = false;
|
|
typ.nativeArray = $nativeArray(elem.kind);
|
|
typ.nil = new typ([]);
|
|
};
|
|
break;
|
|
|
|
case $kindStruct:
|
|
typ = function(v) { this.$val = v; };
|
|
typ.wrapped = true;
|
|
typ.ptr = $newType(4, $kindPtr, "*" + string, false, pkg, exported, constructor);
|
|
typ.ptr.elem = typ;
|
|
typ.ptr.prototype.$get = function() { return this; };
|
|
typ.ptr.prototype.$set = function(v) { typ.copy(this, v); };
|
|
typ.init = function(pkgPath, fields) {
|
|
typ.pkgPath = pkgPath;
|
|
typ.fields = fields;
|
|
fields.forEach(function(f) {
|
|
if (!f.typ.comparable) {
|
|
typ.comparable = false;
|
|
}
|
|
});
|
|
typ.keyFor = function(x) {
|
|
var val = x.$val;
|
|
return $mapArray(fields, function(f) {
|
|
return String(f.typ.keyFor(val[f.prop])).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
|
|
}).join("$");
|
|
};
|
|
typ.copy = function(dst, src) {
|
|
for (var i = 0; i < fields.length; i++) {
|
|
var f = fields[i];
|
|
switch (f.typ.kind) {
|
|
case $kindArray:
|
|
case $kindStruct:
|
|
f.typ.copy(dst[f.prop], src[f.prop]);
|
|
continue;
|
|
default:
|
|
dst[f.prop] = src[f.prop];
|
|
continue;
|
|
}
|
|
}
|
|
};
|
|
/* nil value */
|
|
var properties = {};
|
|
fields.forEach(function(f) {
|
|
properties[f.prop] = { get: $throwNilPointerError, set: $throwNilPointerError };
|
|
});
|
|
typ.ptr.nil = Object.create(constructor.prototype, properties);
|
|
typ.ptr.nil.$val = typ.ptr.nil;
|
|
/* methods for embedded fields */
|
|
$addMethodSynthesizer(function() {
|
|
var synthesizeMethod = function(target, m, f) {
|
|
if (target.prototype[m.prop] !== undefined) { return; }
|
|
target.prototype[m.prop] = function() {
|
|
var v = this.$val[f.prop];
|
|
if (f.typ === $jsObjectPtr) {
|
|
v = new $jsObjectPtr(v);
|
|
}
|
|
if (v.$val === undefined) {
|
|
v = new f.typ(v);
|
|
}
|
|
return v[m.prop].apply(v, arguments);
|
|
};
|
|
};
|
|
fields.forEach(function(f) {
|
|
if (f.embedded) {
|
|
$methodSet(f.typ).forEach(function(m) {
|
|
synthesizeMethod(typ, m, f);
|
|
synthesizeMethod(typ.ptr, m, f);
|
|
});
|
|
$methodSet($ptrType(f.typ)).forEach(function(m) {
|
|
synthesizeMethod(typ.ptr, m, f);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
};
|
|
break;
|
|
|
|
default:
|
|
$panic(new $String("invalid kind: " + kind));
|
|
}
|
|
|
|
switch (kind) {
|
|
case $kindBool:
|
|
case $kindMap:
|
|
typ.zero = function() { return false; };
|
|
break;
|
|
|
|
case $kindInt:
|
|
case $kindInt8:
|
|
case $kindInt16:
|
|
case $kindInt32:
|
|
case $kindUint:
|
|
case $kindUint8 :
|
|
case $kindUint16:
|
|
case $kindUint32:
|
|
case $kindUintptr:
|
|
case $kindUnsafePointer:
|
|
case $kindFloat32:
|
|
case $kindFloat64:
|
|
typ.zero = function() { return 0; };
|
|
break;
|
|
|
|
case $kindString:
|
|
typ.zero = function() { return ""; };
|
|
break;
|
|
|
|
case $kindInt64:
|
|
case $kindUint64:
|
|
case $kindComplex64:
|
|
case $kindComplex128:
|
|
var zero = new typ(0, 0);
|
|
typ.zero = function() { return zero; };
|
|
break;
|
|
|
|
case $kindPtr:
|
|
case $kindSlice:
|
|
typ.zero = function() { return typ.nil; };
|
|
break;
|
|
|
|
case $kindChan:
|
|
typ.zero = function() { return $chanNil; };
|
|
break;
|
|
|
|
case $kindFunc:
|
|
typ.zero = function() { return $throwNilPointerError; };
|
|
break;
|
|
|
|
case $kindInterface:
|
|
typ.zero = function() { return $ifaceNil; };
|
|
break;
|
|
|
|
case $kindArray:
|
|
typ.zero = function() {
|
|
var arrayClass = $nativeArray(typ.elem.kind);
|
|
if (arrayClass !== Array) {
|
|
return new arrayClass(typ.len);
|
|
}
|
|
var array = new Array(typ.len);
|
|
for (var i = 0; i < typ.len; i++) {
|
|
array[i] = typ.elem.zero();
|
|
}
|
|
return array;
|
|
};
|
|
break;
|
|
|
|
case $kindStruct:
|
|
typ.zero = function() { return new typ.ptr(); };
|
|
break;
|
|
|
|
default:
|
|
$panic(new $String("invalid kind: " + kind));
|
|
}
|
|
|
|
typ.id = $typeIDCounter;
|
|
$typeIDCounter++;
|
|
typ.size = size;
|
|
typ.kind = kind;
|
|
typ.string = string;
|
|
typ.named = named;
|
|
typ.pkg = pkg;
|
|
typ.exported = exported;
|
|
typ.methods = [];
|
|
typ.methodSetCache = null;
|
|
typ.comparable = true;
|
|
return typ;
|
|
};
|
|
|
|
var $methodSet = function(typ) {
|
|
if (typ.methodSetCache !== null) {
|
|
return typ.methodSetCache;
|
|
}
|
|
var base = {};
|
|
|
|
var isPtr = (typ.kind === $kindPtr);
|
|
if (isPtr && typ.elem.kind === $kindInterface) {
|
|
typ.methodSetCache = [];
|
|
return [];
|
|
}
|
|
|
|
var current = [{typ: isPtr ? typ.elem : typ, indirect: isPtr}];
|
|
|
|
var seen = {};
|
|
|
|
while (current.length > 0) {
|
|
var next = [];
|
|
var mset = [];
|
|
|
|
current.forEach(function(e) {
|
|
if (seen[e.typ.string]) {
|
|
return;
|
|
}
|
|
seen[e.typ.string] = true;
|
|
|
|
if (e.typ.named) {
|
|
mset = mset.concat(e.typ.methods);
|
|
if (e.indirect) {
|
|
mset = mset.concat($ptrType(e.typ).methods);
|
|
}
|
|
}
|
|
|
|
switch (e.typ.kind) {
|
|
case $kindStruct:
|
|
e.typ.fields.forEach(function(f) {
|
|
if (f.embedded) {
|
|
var fTyp = f.typ;
|
|
var fIsPtr = (fTyp.kind === $kindPtr);
|
|
next.push({typ: fIsPtr ? fTyp.elem : fTyp, indirect: e.indirect || fIsPtr});
|
|
}
|
|
});
|
|
break;
|
|
|
|
case $kindInterface:
|
|
mset = mset.concat(e.typ.methods);
|
|
break;
|
|
}
|
|
});
|
|
|
|
mset.forEach(function(m) {
|
|
if (base[m.name] === undefined) {
|
|
base[m.name] = m;
|
|
}
|
|
});
|
|
|
|
current = next;
|
|
}
|
|
|
|
typ.methodSetCache = [];
|
|
Object.keys(base).sort().forEach(function(name) {
|
|
typ.methodSetCache.push(base[name]);
|
|
});
|
|
return typ.methodSetCache;
|
|
};
|
|
|
|
var $Bool = $newType( 1, $kindBool, "bool", true, "", false, null);
|
|
var $Int = $newType( 4, $kindInt, "int", true, "", false, null);
|
|
var $Int8 = $newType( 1, $kindInt8, "int8", true, "", false, null);
|
|
var $Int16 = $newType( 2, $kindInt16, "int16", true, "", false, null);
|
|
var $Int32 = $newType( 4, $kindInt32, "int32", true, "", false, null);
|
|
var $Int64 = $newType( 8, $kindInt64, "int64", true, "", false, null);
|
|
var $Uint = $newType( 4, $kindUint, "uint", true, "", false, null);
|
|
var $Uint8 = $newType( 1, $kindUint8, "uint8", true, "", false, null);
|
|
var $Uint16 = $newType( 2, $kindUint16, "uint16", true, "", false, null);
|
|
var $Uint32 = $newType( 4, $kindUint32, "uint32", true, "", false, null);
|
|
var $Uint64 = $newType( 8, $kindUint64, "uint64", true, "", false, null);
|
|
var $Uintptr = $newType( 4, $kindUintptr, "uintptr", true, "", false, null);
|
|
var $Float32 = $newType( 4, $kindFloat32, "float32", true, "", false, null);
|
|
var $Float64 = $newType( 8, $kindFloat64, "float64", true, "", false, null);
|
|
var $Complex64 = $newType( 8, $kindComplex64, "complex64", true, "", false, null);
|
|
var $Complex128 = $newType(16, $kindComplex128, "complex128", true, "", false, null);
|
|
var $String = $newType( 8, $kindString, "string", true, "", false, null);
|
|
var $UnsafePointer = $newType( 4, $kindUnsafePointer, "unsafe.Pointer", true, "", false, null);
|
|
|
|
var $nativeArray = function(elemKind) {
|
|
switch (elemKind) {
|
|
case $kindInt:
|
|
return Int32Array;
|
|
case $kindInt8:
|
|
return Int8Array;
|
|
case $kindInt16:
|
|
return Int16Array;
|
|
case $kindInt32:
|
|
return Int32Array;
|
|
case $kindUint:
|
|
return Uint32Array;
|
|
case $kindUint8:
|
|
return Uint8Array;
|
|
case $kindUint16:
|
|
return Uint16Array;
|
|
case $kindUint32:
|
|
return Uint32Array;
|
|
case $kindUintptr:
|
|
return Uint32Array;
|
|
case $kindFloat32:
|
|
return Float32Array;
|
|
case $kindFloat64:
|
|
return Float64Array;
|
|
default:
|
|
return Array;
|
|
}
|
|
};
|
|
var $toNativeArray = function(elemKind, array) {
|
|
var nativeArray = $nativeArray(elemKind);
|
|
if (nativeArray === Array) {
|
|
return array;
|
|
}
|
|
return new nativeArray(array);
|
|
};
|
|
var $arrayTypes = {};
|
|
var $arrayType = function(elem, len) {
|
|
var typeKey = elem.id + "$" + len;
|
|
var typ = $arrayTypes[typeKey];
|
|
if (typ === undefined) {
|
|
typ = $newType(12, $kindArray, "[" + len + "]" + elem.string, false, "", false, null);
|
|
$arrayTypes[typeKey] = typ;
|
|
typ.init(elem, len);
|
|
}
|
|
return typ;
|
|
};
|
|
|
|
var $chanType = function(elem, sendOnly, recvOnly) {
|
|
var string = (recvOnly ? "<-" : "") + "chan" + (sendOnly ? "<- " : " ") + elem.string;
|
|
var field = sendOnly ? "SendChan" : (recvOnly ? "RecvChan" : "Chan");
|
|
var typ = elem[field];
|
|
if (typ === undefined) {
|
|
typ = $newType(4, $kindChan, string, false, "", false, null);
|
|
elem[field] = typ;
|
|
typ.init(elem, sendOnly, recvOnly);
|
|
}
|
|
return typ;
|
|
};
|
|
var $Chan = function(elem, capacity) {
|
|
if (capacity < 0 || capacity > 2147483647) {
|
|
$throwRuntimeError("makechan: size out of range");
|
|
}
|
|
this.$elem = elem;
|
|
this.$capacity = capacity;
|
|
this.$buffer = [];
|
|
this.$sendQueue = [];
|
|
this.$recvQueue = [];
|
|
this.$closed = false;
|
|
};
|
|
var $chanNil = new $Chan(null, 0);
|
|
$chanNil.$sendQueue = $chanNil.$recvQueue = { length: 0, push: function() {}, shift: function() { return undefined; }, indexOf: function() { return -1; } };
|
|
|
|
var $funcTypes = {};
|
|
var $funcType = function(params, results, variadic) {
|
|
var typeKey = $mapArray(params, function(p) { return p.id; }).join(",") + "$" + $mapArray(results, function(r) { return r.id; }).join(",") + "$" + variadic;
|
|
var typ = $funcTypes[typeKey];
|
|
if (typ === undefined) {
|
|
var paramTypes = $mapArray(params, function(p) { return p.string; });
|
|
if (variadic) {
|
|
paramTypes[paramTypes.length - 1] = "..." + paramTypes[paramTypes.length - 1].substr(2);
|
|
}
|
|
var string = "func(" + paramTypes.join(", ") + ")";
|
|
if (results.length === 1) {
|
|
string += " " + results[0].string;
|
|
} else if (results.length > 1) {
|
|
string += " (" + $mapArray(results, function(r) { return r.string; }).join(", ") + ")";
|
|
}
|
|
typ = $newType(4, $kindFunc, string, false, "", false, null);
|
|
$funcTypes[typeKey] = typ;
|
|
typ.init(params, results, variadic);
|
|
}
|
|
return typ;
|
|
};
|
|
|
|
var $interfaceTypes = {};
|
|
var $interfaceType = function(methods) {
|
|
var typeKey = $mapArray(methods, function(m) { return m.pkg + "," + m.name + "," + m.typ.id; }).join("$");
|
|
var typ = $interfaceTypes[typeKey];
|
|
if (typ === undefined) {
|
|
var string = "interface {}";
|
|
if (methods.length !== 0) {
|
|
string = "interface { " + $mapArray(methods, function(m) {
|
|
return (m.pkg !== "" ? m.pkg + "." : "") + m.name + m.typ.string.substr(4);
|
|
}).join("; ") + " }";
|
|
}
|
|
typ = $newType(8, $kindInterface, string, false, "", false, null);
|
|
$interfaceTypes[typeKey] = typ;
|
|
typ.init(methods);
|
|
}
|
|
return typ;
|
|
};
|
|
var $emptyInterface = $interfaceType([]);
|
|
var $ifaceNil = {};
|
|
var $error = $newType(8, $kindInterface, "error", true, "", false, null);
|
|
$error.init([{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}]);
|
|
|
|
var $mapTypes = {};
|
|
var $mapType = function(key, elem) {
|
|
var typeKey = key.id + "$" + elem.id;
|
|
var typ = $mapTypes[typeKey];
|
|
if (typ === undefined) {
|
|
typ = $newType(4, $kindMap, "map[" + key.string + "]" + elem.string, false, "", false, null);
|
|
$mapTypes[typeKey] = typ;
|
|
typ.init(key, elem);
|
|
}
|
|
return typ;
|
|
};
|
|
var $makeMap = function(keyForFunc, entries) {
|
|
var m = {};
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var e = entries[i];
|
|
m[keyForFunc(e.k)] = e;
|
|
}
|
|
return m;
|
|
};
|
|
|
|
var $ptrType = function(elem) {
|
|
var typ = elem.ptr;
|
|
if (typ === undefined) {
|
|
typ = $newType(4, $kindPtr, "*" + elem.string, false, "", elem.exported, null);
|
|
elem.ptr = typ;
|
|
typ.init(elem);
|
|
}
|
|
return typ;
|
|
};
|
|
|
|
var $newDataPointer = function(data, constructor) {
|
|
if (constructor.elem.kind === $kindStruct) {
|
|
return data;
|
|
}
|
|
return new constructor(function() { return data; }, function(v) { data = v; });
|
|
};
|
|
|
|
var $indexPtr = function(array, index, constructor) {
|
|
array.$ptr = array.$ptr || {};
|
|
return array.$ptr[index] || (array.$ptr[index] = new constructor(function() { return array[index]; }, function(v) { array[index] = v; }));
|
|
};
|
|
|
|
var $sliceType = function(elem) {
|
|
var typ = elem.slice;
|
|
if (typ === undefined) {
|
|
typ = $newType(12, $kindSlice, "[]" + elem.string, false, "", false, null);
|
|
elem.slice = typ;
|
|
typ.init(elem);
|
|
}
|
|
return typ;
|
|
};
|
|
var $makeSlice = function(typ, length, capacity) {
|
|
capacity = capacity || length;
|
|
if (length < 0 || length > 2147483647) {
|
|
$throwRuntimeError("makeslice: len out of range");
|
|
}
|
|
if (capacity < 0 || capacity < length || capacity > 2147483647) {
|
|
$throwRuntimeError("makeslice: cap out of range");
|
|
}
|
|
var array = new typ.nativeArray(capacity);
|
|
if (typ.nativeArray === Array) {
|
|
for (var i = 0; i < capacity; i++) {
|
|
array[i] = typ.elem.zero();
|
|
}
|
|
}
|
|
var slice = new typ(array);
|
|
slice.$length = length;
|
|
return slice;
|
|
};
|
|
|
|
var $structTypes = {};
|
|
var $structType = function(pkgPath, fields) {
|
|
var typeKey = $mapArray(fields, function(f) { return f.name + "," + f.typ.id + "," + f.tag; }).join("$");
|
|
var typ = $structTypes[typeKey];
|
|
if (typ === undefined) {
|
|
var string = "struct { " + $mapArray(fields, function(f) {
|
|
return f.name + " " + f.typ.string + (f.tag !== "" ? (" \"" + f.tag.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"") : "");
|
|
}).join("; ") + " }";
|
|
if (fields.length === 0) {
|
|
string = "struct {}";
|
|
}
|
|
typ = $newType(0, $kindStruct, string, false, "", false, function() {
|
|
this.$val = this;
|
|
for (var i = 0; i < fields.length; i++) {
|
|
var f = fields[i];
|
|
var arg = arguments[i];
|
|
this[f.prop] = arg !== undefined ? arg : f.typ.zero();
|
|
}
|
|
});
|
|
$structTypes[typeKey] = typ;
|
|
typ.init(pkgPath, fields);
|
|
}
|
|
return typ;
|
|
};
|
|
|
|
var $assertType = function(value, type, returnTuple) {
|
|
var isInterface = (type.kind === $kindInterface), ok, missingMethod = "";
|
|
if (value === $ifaceNil) {
|
|
ok = false;
|
|
} else if (!isInterface) {
|
|
ok = value.constructor === type;
|
|
} else {
|
|
var valueTypeString = value.constructor.string;
|
|
ok = type.implementedBy[valueTypeString];
|
|
if (ok === undefined) {
|
|
ok = true;
|
|
var valueMethodSet = $methodSet(value.constructor);
|
|
var interfaceMethods = type.methods;
|
|
for (var i = 0; i < interfaceMethods.length; i++) {
|
|
var tm = interfaceMethods[i];
|
|
var found = false;
|
|
for (var j = 0; j < valueMethodSet.length; j++) {
|
|
var vm = valueMethodSet[j];
|
|
if (vm.name === tm.name && vm.pkg === tm.pkg && vm.typ === tm.typ) {
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!found) {
|
|
ok = false;
|
|
type.missingMethodFor[valueTypeString] = tm.name;
|
|
break;
|
|
}
|
|
}
|
|
type.implementedBy[valueTypeString] = ok;
|
|
}
|
|
if (!ok) {
|
|
missingMethod = type.missingMethodFor[valueTypeString];
|
|
}
|
|
}
|
|
|
|
if (!ok) {
|
|
if (returnTuple) {
|
|
return [type.zero(), false];
|
|
}
|
|
$panic(new $packages["runtime"].TypeAssertionError.ptr(
|
|
$packages["runtime"]._type.ptr.nil,
|
|
(value === $ifaceNil ? $packages["runtime"]._type.ptr.nil : new $packages["runtime"]._type.ptr(value.constructor.string)),
|
|
new $packages["runtime"]._type.ptr(type.string),
|
|
missingMethod));
|
|
}
|
|
|
|
if (!isInterface) {
|
|
value = value.$val;
|
|
}
|
|
if (type === $jsObjectPtr) {
|
|
value = value.object;
|
|
}
|
|
return returnTuple ? [value, true] : value;
|
|
};
|
|
|
|
var $stackDepthOffset = 0;
|
|
var $getStackDepth = function() {
|
|
var err = new Error();
|
|
if (err.stack === undefined) {
|
|
return undefined;
|
|
}
|
|
return $stackDepthOffset + err.stack.split("\n").length;
|
|
};
|
|
|
|
var $panicStackDepth = null, $panicValue;
|
|
var $callDeferred = function(deferred, jsErr, fromPanic) {
|
|
if (!fromPanic && deferred !== null && deferred.index >= $curGoroutine.deferStack.length) {
|
|
throw jsErr;
|
|
}
|
|
if (jsErr !== null) {
|
|
var newErr = null;
|
|
try {
|
|
$curGoroutine.deferStack.push(deferred);
|
|
$panic(new $jsErrorPtr(jsErr));
|
|
} catch (err) {
|
|
newErr = err;
|
|
}
|
|
$curGoroutine.deferStack.pop();
|
|
$callDeferred(deferred, newErr);
|
|
return;
|
|
}
|
|
if ($curGoroutine.asleep) {
|
|
return;
|
|
}
|
|
|
|
$stackDepthOffset--;
|
|
var outerPanicStackDepth = $panicStackDepth;
|
|
var outerPanicValue = $panicValue;
|
|
|
|
var localPanicValue = $curGoroutine.panicStack.pop();
|
|
if (localPanicValue !== undefined) {
|
|
$panicStackDepth = $getStackDepth();
|
|
$panicValue = localPanicValue;
|
|
}
|
|
|
|
try {
|
|
while (true) {
|
|
if (deferred === null) {
|
|
deferred = $curGoroutine.deferStack[$curGoroutine.deferStack.length - 1];
|
|
if (deferred === undefined) {
|
|
/* The panic reached the top of the stack. Clear it and throw it as a JavaScript error. */
|
|
$panicStackDepth = null;
|
|
if (localPanicValue.Object instanceof Error) {
|
|
throw localPanicValue.Object;
|
|
}
|
|
var msg;
|
|
if (localPanicValue.constructor === $String) {
|
|
msg = localPanicValue.$val;
|
|
} else if (localPanicValue.Error !== undefined) {
|
|
msg = localPanicValue.Error();
|
|
} else if (localPanicValue.String !== undefined) {
|
|
msg = localPanicValue.String();
|
|
} else {
|
|
msg = localPanicValue;
|
|
}
|
|
throw new Error(msg);
|
|
}
|
|
}
|
|
var call = deferred.pop();
|
|
if (call === undefined) {
|
|
$curGoroutine.deferStack.pop();
|
|
if (localPanicValue !== undefined) {
|
|
deferred = null;
|
|
continue;
|
|
}
|
|
return;
|
|
}
|
|
var r = call[0].apply(call[2], call[1]);
|
|
if (r && r.$blk !== undefined) {
|
|
deferred.push([r.$blk, [], r]);
|
|
if (fromPanic) {
|
|
throw null;
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (localPanicValue !== undefined && $panicStackDepth === null) {
|
|
throw null; /* error was recovered */
|
|
}
|
|
}
|
|
} finally {
|
|
if (localPanicValue !== undefined) {
|
|
if ($panicStackDepth !== null) {
|
|
$curGoroutine.panicStack.push(localPanicValue);
|
|
}
|
|
$panicStackDepth = outerPanicStackDepth;
|
|
$panicValue = outerPanicValue;
|
|
}
|
|
$stackDepthOffset++;
|
|
}
|
|
};
|
|
|
|
var $panic = function(value) {
|
|
$curGoroutine.panicStack.push(value);
|
|
$callDeferred(null, null, true);
|
|
};
|
|
var $recover = function() {
|
|
if ($panicStackDepth === null || ($panicStackDepth !== undefined && $panicStackDepth !== $getStackDepth() - 2)) {
|
|
return $ifaceNil;
|
|
}
|
|
$panicStackDepth = null;
|
|
return $panicValue;
|
|
};
|
|
var $throw = function(err) { throw err; };
|
|
|
|
var $noGoroutine = { asleep: false, exit: false, deferStack: [], panicStack: [] };
|
|
var $curGoroutine = $noGoroutine, $totalGoroutines = 0, $awakeGoroutines = 0, $checkForDeadlock = true;
|
|
var $mainFinished = false;
|
|
var $go = function(fun, args) {
|
|
$totalGoroutines++;
|
|
$awakeGoroutines++;
|
|
var $goroutine = function() {
|
|
try {
|
|
$curGoroutine = $goroutine;
|
|
var r = fun.apply(undefined, args);
|
|
if (r && r.$blk !== undefined) {
|
|
fun = function() { return r.$blk(); };
|
|
args = [];
|
|
return;
|
|
}
|
|
$goroutine.exit = true;
|
|
} catch (err) {
|
|
if (!$goroutine.exit) {
|
|
throw err;
|
|
}
|
|
} finally {
|
|
$curGoroutine = $noGoroutine;
|
|
if ($goroutine.exit) { /* also set by runtime.Goexit() */
|
|
$totalGoroutines--;
|
|
$goroutine.asleep = true;
|
|
}
|
|
if ($goroutine.asleep) {
|
|
$awakeGoroutines--;
|
|
if (!$mainFinished && $awakeGoroutines === 0 && $checkForDeadlock) {
|
|
console.error("fatal error: all goroutines are asleep - deadlock!");
|
|
if ($global.process !== undefined) {
|
|
$global.process.exit(2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
$goroutine.asleep = false;
|
|
$goroutine.exit = false;
|
|
$goroutine.deferStack = [];
|
|
$goroutine.panicStack = [];
|
|
$schedule($goroutine);
|
|
};
|
|
|
|
var $scheduled = [];
|
|
var $runScheduled = function() {
|
|
try {
|
|
var r;
|
|
while ((r = $scheduled.shift()) !== undefined) {
|
|
r();
|
|
}
|
|
} finally {
|
|
if ($scheduled.length > 0) {
|
|
setTimeout($runScheduled, 0);
|
|
}
|
|
}
|
|
};
|
|
|
|
var $schedule = function(goroutine) {
|
|
if (goroutine.asleep) {
|
|
goroutine.asleep = false;
|
|
$awakeGoroutines++;
|
|
}
|
|
$scheduled.push(goroutine);
|
|
if ($curGoroutine === $noGoroutine) {
|
|
$runScheduled();
|
|
}
|
|
};
|
|
|
|
var $setTimeout = function(f, t) {
|
|
$awakeGoroutines++;
|
|
return setTimeout(function() {
|
|
$awakeGoroutines--;
|
|
f();
|
|
}, t);
|
|
};
|
|
|
|
var $block = function() {
|
|
if ($curGoroutine === $noGoroutine) {
|
|
$throwRuntimeError("cannot block in JavaScript callback, fix by wrapping code in goroutine");
|
|
}
|
|
$curGoroutine.asleep = true;
|
|
};
|
|
|
|
var $send = function(chan, value) {
|
|
if (chan.$closed) {
|
|
$throwRuntimeError("send on closed channel");
|
|
}
|
|
var queuedRecv = chan.$recvQueue.shift();
|
|
if (queuedRecv !== undefined) {
|
|
queuedRecv([value, true]);
|
|
return;
|
|
}
|
|
if (chan.$buffer.length < chan.$capacity) {
|
|
chan.$buffer.push(value);
|
|
return;
|
|
}
|
|
|
|
var thisGoroutine = $curGoroutine;
|
|
var closedDuringSend;
|
|
chan.$sendQueue.push(function(closed) {
|
|
closedDuringSend = closed;
|
|
$schedule(thisGoroutine);
|
|
return value;
|
|
});
|
|
$block();
|
|
return {
|
|
$blk: function() {
|
|
if (closedDuringSend) {
|
|
$throwRuntimeError("send on closed channel");
|
|
}
|
|
}
|
|
};
|
|
};
|
|
var $recv = function(chan) {
|
|
var queuedSend = chan.$sendQueue.shift();
|
|
if (queuedSend !== undefined) {
|
|
chan.$buffer.push(queuedSend(false));
|
|
}
|
|
var bufferedValue = chan.$buffer.shift();
|
|
if (bufferedValue !== undefined) {
|
|
return [bufferedValue, true];
|
|
}
|
|
if (chan.$closed) {
|
|
return [chan.$elem.zero(), false];
|
|
}
|
|
|
|
var thisGoroutine = $curGoroutine;
|
|
var f = { $blk: function() { return this.value; } };
|
|
var queueEntry = function(v) {
|
|
f.value = v;
|
|
$schedule(thisGoroutine);
|
|
};
|
|
chan.$recvQueue.push(queueEntry);
|
|
$block();
|
|
return f;
|
|
};
|
|
var $close = function(chan) {
|
|
if (chan.$closed) {
|
|
$throwRuntimeError("close of closed channel");
|
|
}
|
|
chan.$closed = true;
|
|
while (true) {
|
|
var queuedSend = chan.$sendQueue.shift();
|
|
if (queuedSend === undefined) {
|
|
break;
|
|
}
|
|
queuedSend(true); /* will panic */
|
|
}
|
|
while (true) {
|
|
var queuedRecv = chan.$recvQueue.shift();
|
|
if (queuedRecv === undefined) {
|
|
break;
|
|
}
|
|
queuedRecv([chan.$elem.zero(), false]);
|
|
}
|
|
};
|
|
var $select = function(comms) {
|
|
var ready = [];
|
|
var selection = -1;
|
|
for (var i = 0; i < comms.length; i++) {
|
|
var comm = comms[i];
|
|
var chan = comm[0];
|
|
switch (comm.length) {
|
|
case 0: /* default */
|
|
selection = i;
|
|
break;
|
|
case 1: /* recv */
|
|
if (chan.$sendQueue.length !== 0 || chan.$buffer.length !== 0 || chan.$closed) {
|
|
ready.push(i);
|
|
}
|
|
break;
|
|
case 2: /* send */
|
|
if (chan.$closed) {
|
|
$throwRuntimeError("send on closed channel");
|
|
}
|
|
if (chan.$recvQueue.length !== 0 || chan.$buffer.length < chan.$capacity) {
|
|
ready.push(i);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (ready.length !== 0) {
|
|
selection = ready[Math.floor(Math.random() * ready.length)];
|
|
}
|
|
if (selection !== -1) {
|
|
var comm = comms[selection];
|
|
switch (comm.length) {
|
|
case 0: /* default */
|
|
return [selection];
|
|
case 1: /* recv */
|
|
return [selection, $recv(comm[0])];
|
|
case 2: /* send */
|
|
$send(comm[0], comm[1]);
|
|
return [selection];
|
|
}
|
|
}
|
|
|
|
var entries = [];
|
|
var thisGoroutine = $curGoroutine;
|
|
var f = { $blk: function() { return this.selection; } };
|
|
var removeFromQueues = function() {
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var entry = entries[i];
|
|
var queue = entry[0];
|
|
var index = queue.indexOf(entry[1]);
|
|
if (index !== -1) {
|
|
queue.splice(index, 1);
|
|
}
|
|
}
|
|
};
|
|
for (var i = 0; i < comms.length; i++) {
|
|
(function(i) {
|
|
var comm = comms[i];
|
|
switch (comm.length) {
|
|
case 1: /* recv */
|
|
var queueEntry = function(value) {
|
|
f.selection = [i, value];
|
|
removeFromQueues();
|
|
$schedule(thisGoroutine);
|
|
};
|
|
entries.push([comm[0].$recvQueue, queueEntry]);
|
|
comm[0].$recvQueue.push(queueEntry);
|
|
break;
|
|
case 2: /* send */
|
|
var queueEntry = function() {
|
|
if (comm[0].$closed) {
|
|
$throwRuntimeError("send on closed channel");
|
|
}
|
|
f.selection = [i];
|
|
removeFromQueues();
|
|
$schedule(thisGoroutine);
|
|
return comm[1];
|
|
};
|
|
entries.push([comm[0].$sendQueue, queueEntry]);
|
|
comm[0].$sendQueue.push(queueEntry);
|
|
break;
|
|
}
|
|
})(i);
|
|
}
|
|
$block();
|
|
return f;
|
|
};
|
|
|
|
var $jsObjectPtr, $jsErrorPtr;
|
|
|
|
var $needsExternalization = function(t) {
|
|
switch (t.kind) {
|
|
case $kindBool:
|
|
case $kindInt:
|
|
case $kindInt8:
|
|
case $kindInt16:
|
|
case $kindInt32:
|
|
case $kindUint:
|
|
case $kindUint8:
|
|
case $kindUint16:
|
|
case $kindUint32:
|
|
case $kindUintptr:
|
|
case $kindFloat32:
|
|
case $kindFloat64:
|
|
return false;
|
|
default:
|
|
return t !== $jsObjectPtr;
|
|
}
|
|
};
|
|
|
|
var $externalize = function(v, t) {
|
|
if (t === $jsObjectPtr) {
|
|
return v;
|
|
}
|
|
switch (t.kind) {
|
|
case $kindBool:
|
|
case $kindInt:
|
|
case $kindInt8:
|
|
case $kindInt16:
|
|
case $kindInt32:
|
|
case $kindUint:
|
|
case $kindUint8:
|
|
case $kindUint16:
|
|
case $kindUint32:
|
|
case $kindUintptr:
|
|
case $kindFloat32:
|
|
case $kindFloat64:
|
|
return v;
|
|
case $kindInt64:
|
|
case $kindUint64:
|
|
return $flatten64(v);
|
|
case $kindArray:
|
|
if ($needsExternalization(t.elem)) {
|
|
return $mapArray(v, function(e) { return $externalize(e, t.elem); });
|
|
}
|
|
return v;
|
|
case $kindFunc:
|
|
return $externalizeFunction(v, t, false);
|
|
case $kindInterface:
|
|
if (v === $ifaceNil) {
|
|
return null;
|
|
}
|
|
if (v.constructor === $jsObjectPtr) {
|
|
return v.$val.object;
|
|
}
|
|
return $externalize(v.$val, v.constructor);
|
|
case $kindMap:
|
|
var m = {};
|
|
var keys = $keys(v);
|
|
for (var i = 0; i < keys.length; i++) {
|
|
var entry = v[keys[i]];
|
|
m[$externalize(entry.k, t.key)] = $externalize(entry.v, t.elem);
|
|
}
|
|
return m;
|
|
case $kindPtr:
|
|
if (v === t.nil) {
|
|
return null;
|
|
}
|
|
return $externalize(v.$get(), t.elem);
|
|
case $kindSlice:
|
|
if ($needsExternalization(t.elem)) {
|
|
return $mapArray($sliceToArray(v), function(e) { return $externalize(e, t.elem); });
|
|
}
|
|
return $sliceToArray(v);
|
|
case $kindString:
|
|
if ($isASCII(v)) {
|
|
return v;
|
|
}
|
|
var s = "", r;
|
|
for (var i = 0; i < v.length; i += r[1]) {
|
|
r = $decodeRune(v, i);
|
|
var c = r[0];
|
|
if (c > 0xFFFF) {
|
|
var h = Math.floor((c - 0x10000) / 0x400) + 0xD800;
|
|
var l = (c - 0x10000) % 0x400 + 0xDC00;
|
|
s += String.fromCharCode(h, l);
|
|
continue;
|
|
}
|
|
s += String.fromCharCode(c);
|
|
}
|
|
return s;
|
|
case $kindStruct:
|
|
var timePkg = $packages["time"];
|
|
if (timePkg !== undefined && v.constructor === timePkg.Time.ptr) {
|
|
var milli = $div64(v.UnixNano(), new $Int64(0, 1000000));
|
|
return new Date($flatten64(milli));
|
|
}
|
|
|
|
var noJsObject = {};
|
|
var searchJsObject = function(v, t) {
|
|
if (t === $jsObjectPtr) {
|
|
return v;
|
|
}
|
|
switch (t.kind) {
|
|
case $kindPtr:
|
|
if (v === t.nil) {
|
|
return noJsObject;
|
|
}
|
|
return searchJsObject(v.$get(), t.elem);
|
|
case $kindStruct:
|
|
var f = t.fields[0];
|
|
return searchJsObject(v[f.prop], f.typ);
|
|
case $kindInterface:
|
|
return searchJsObject(v.$val, v.constructor);
|
|
default:
|
|
return noJsObject;
|
|
}
|
|
};
|
|
var o = searchJsObject(v, t);
|
|
if (o !== noJsObject) {
|
|
return o;
|
|
}
|
|
|
|
o = {};
|
|
for (var i = 0; i < t.fields.length; i++) {
|
|
var f = t.fields[i];
|
|
if (!f.exported) {
|
|
continue;
|
|
}
|
|
o[f.name] = $externalize(v[f.prop], f.typ);
|
|
}
|
|
return o;
|
|
}
|
|
$throwRuntimeError("cannot externalize " + t.string);
|
|
};
|
|
|
|
var $externalizeFunction = function(v, t, passThis) {
|
|
if (v === $throwNilPointerError) {
|
|
return null;
|
|
}
|
|
if (v.$externalizeWrapper === undefined) {
|
|
$checkForDeadlock = false;
|
|
v.$externalizeWrapper = function() {
|
|
var args = [];
|
|
for (var i = 0; i < t.params.length; i++) {
|
|
if (t.variadic && i === t.params.length - 1) {
|
|
var vt = t.params[i].elem, varargs = [];
|
|
for (var j = i; j < arguments.length; j++) {
|
|
varargs.push($internalize(arguments[j], vt));
|
|
}
|
|
args.push(new (t.params[i])(varargs));
|
|
break;
|
|
}
|
|
args.push($internalize(arguments[i], t.params[i]));
|
|
}
|
|
var result = v.apply(passThis ? this : undefined, args);
|
|
switch (t.results.length) {
|
|
case 0:
|
|
return;
|
|
case 1:
|
|
return $externalize(result, t.results[0]);
|
|
default:
|
|
for (var i = 0; i < t.results.length; i++) {
|
|
result[i] = $externalize(result[i], t.results[i]);
|
|
}
|
|
return result;
|
|
}
|
|
};
|
|
}
|
|
return v.$externalizeWrapper;
|
|
};
|
|
|
|
var $internalize = function(v, t, recv) {
|
|
if (t === $jsObjectPtr) {
|
|
return v;
|
|
}
|
|
if (t === $jsObjectPtr.elem) {
|
|
$throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
|
|
}
|
|
if (v && v.__internal_object__ !== undefined) {
|
|
return $assertType(v.__internal_object__, t, false);
|
|
}
|
|
var timePkg = $packages["time"];
|
|
if (timePkg !== undefined && t === timePkg.Time) {
|
|
if (!(v !== null && v !== undefined && v.constructor === Date)) {
|
|
$throwRuntimeError("cannot internalize time.Time from " + typeof v + ", must be Date");
|
|
}
|
|
return timePkg.Unix(new $Int64(0, 0), new $Int64(0, v.getTime() * 1000000));
|
|
}
|
|
switch (t.kind) {
|
|
case $kindBool:
|
|
return !!v;
|
|
case $kindInt:
|
|
return parseInt(v);
|
|
case $kindInt8:
|
|
return parseInt(v) << 24 >> 24;
|
|
case $kindInt16:
|
|
return parseInt(v) << 16 >> 16;
|
|
case $kindInt32:
|
|
return parseInt(v) >> 0;
|
|
case $kindUint:
|
|
return parseInt(v);
|
|
case $kindUint8:
|
|
return parseInt(v) << 24 >>> 24;
|
|
case $kindUint16:
|
|
return parseInt(v) << 16 >>> 16;
|
|
case $kindUint32:
|
|
case $kindUintptr:
|
|
return parseInt(v) >>> 0;
|
|
case $kindInt64:
|
|
case $kindUint64:
|
|
return new t(0, v);
|
|
case $kindFloat32:
|
|
case $kindFloat64:
|
|
return parseFloat(v);
|
|
case $kindArray:
|
|
if (v.length !== t.len) {
|
|
$throwRuntimeError("got array with wrong size from JavaScript native");
|
|
}
|
|
return $mapArray(v, function(e) { return $internalize(e, t.elem); });
|
|
case $kindFunc:
|
|
return function() {
|
|
var args = [];
|
|
for (var i = 0; i < t.params.length; i++) {
|
|
if (t.variadic && i === t.params.length - 1) {
|
|
var vt = t.params[i].elem, varargs = arguments[i];
|
|
for (var j = 0; j < varargs.$length; j++) {
|
|
args.push($externalize(varargs.$array[varargs.$offset + j], vt));
|
|
}
|
|
break;
|
|
}
|
|
args.push($externalize(arguments[i], t.params[i]));
|
|
}
|
|
var result = v.apply(recv, args);
|
|
switch (t.results.length) {
|
|
case 0:
|
|
return;
|
|
case 1:
|
|
return $internalize(result, t.results[0]);
|
|
default:
|
|
for (var i = 0; i < t.results.length; i++) {
|
|
result[i] = $internalize(result[i], t.results[i]);
|
|
}
|
|
return result;
|
|
}
|
|
};
|
|
case $kindInterface:
|
|
if (t.methods.length !== 0) {
|
|
$throwRuntimeError("cannot internalize " + t.string);
|
|
}
|
|
if (v === null) {
|
|
return $ifaceNil;
|
|
}
|
|
if (v === undefined) {
|
|
return new $jsObjectPtr(undefined);
|
|
}
|
|
switch (v.constructor) {
|
|
case Int8Array:
|
|
return new ($sliceType($Int8))(v);
|
|
case Int16Array:
|
|
return new ($sliceType($Int16))(v);
|
|
case Int32Array:
|
|
return new ($sliceType($Int))(v);
|
|
case Uint8Array:
|
|
return new ($sliceType($Uint8))(v);
|
|
case Uint16Array:
|
|
return new ($sliceType($Uint16))(v);
|
|
case Uint32Array:
|
|
return new ($sliceType($Uint))(v);
|
|
case Float32Array:
|
|
return new ($sliceType($Float32))(v);
|
|
case Float64Array:
|
|
return new ($sliceType($Float64))(v);
|
|
case Array:
|
|
return $internalize(v, $sliceType($emptyInterface));
|
|
case Boolean:
|
|
return new $Bool(!!v);
|
|
case Date:
|
|
if (timePkg === undefined) {
|
|
/* time package is not present, internalize as &js.Object{Date} so it can be externalized into original Date. */
|
|
return new $jsObjectPtr(v);
|
|
}
|
|
return new timePkg.Time($internalize(v, timePkg.Time));
|
|
case Function:
|
|
var funcType = $funcType([$sliceType($emptyInterface)], [$jsObjectPtr], true);
|
|
return new funcType($internalize(v, funcType));
|
|
case Number:
|
|
return new $Float64(parseFloat(v));
|
|
case String:
|
|
return new $String($internalize(v, $String));
|
|
default:
|
|
if ($global.Node && v instanceof $global.Node) {
|
|
return new $jsObjectPtr(v);
|
|
}
|
|
var mapType = $mapType($String, $emptyInterface);
|
|
return new mapType($internalize(v, mapType));
|
|
}
|
|
case $kindMap:
|
|
var m = {};
|
|
var keys = $keys(v);
|
|
for (var i = 0; i < keys.length; i++) {
|
|
var k = $internalize(keys[i], t.key);
|
|
m[t.key.keyFor(k)] = { k: k, v: $internalize(v[keys[i]], t.elem) };
|
|
}
|
|
return m;
|
|
case $kindPtr:
|
|
if (t.elem.kind === $kindStruct) {
|
|
return $internalize(v, t.elem);
|
|
}
|
|
case $kindSlice:
|
|
return new t($mapArray(v, function(e) { return $internalize(e, t.elem); }));
|
|
case $kindString:
|
|
v = String(v);
|
|
if ($isASCII(v)) {
|
|
return v;
|
|
}
|
|
var s = "";
|
|
var i = 0;
|
|
while (i < v.length) {
|
|
var h = v.charCodeAt(i);
|
|
if (0xD800 <= h && h <= 0xDBFF) {
|
|
var l = v.charCodeAt(i + 1);
|
|
var c = (h - 0xD800) * 0x400 + l - 0xDC00 + 0x10000;
|
|
s += $encodeRune(c);
|
|
i += 2;
|
|
continue;
|
|
}
|
|
s += $encodeRune(h);
|
|
i++;
|
|
}
|
|
return s;
|
|
case $kindStruct:
|
|
var noJsObject = {};
|
|
var searchJsObject = function(t) {
|
|
if (t === $jsObjectPtr) {
|
|
return v;
|
|
}
|
|
if (t === $jsObjectPtr.elem) {
|
|
$throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
|
|
}
|
|
switch (t.kind) {
|
|
case $kindPtr:
|
|
return searchJsObject(t.elem);
|
|
case $kindStruct:
|
|
var f = t.fields[0];
|
|
var o = searchJsObject(f.typ);
|
|
if (o !== noJsObject) {
|
|
var n = new t.ptr();
|
|
n[f.prop] = o;
|
|
return n;
|
|
}
|
|
return noJsObject;
|
|
default:
|
|
return noJsObject;
|
|
}
|
|
};
|
|
var o = searchJsObject(t);
|
|
if (o !== noJsObject) {
|
|
return o;
|
|
}
|
|
}
|
|
$throwRuntimeError("cannot internalize " + t.string);
|
|
};
|
|
|
|
/* $isASCII reports whether string s contains only ASCII characters. */
|
|
var $isASCII = function(s) {
|
|
for (var i = 0; i < s.length; i++) {
|
|
if (s.charCodeAt(i) >= 128) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|
|
$packages["github.com/gopherjs/gopherjs/js"] = (function() {
|
|
var $pkg = {}, $init, Object, Error, sliceType, ptrType, ptrType$1, MakeFunc, init;
|
|
Object = $pkg.Object = $newType(0, $kindStruct, "js.Object", true, "github.com/gopherjs/gopherjs/js", true, function(object_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.object = null;
|
|
return;
|
|
}
|
|
this.object = object_;
|
|
});
|
|
Error = $pkg.Error = $newType(0, $kindStruct, "js.Error", true, "github.com/gopherjs/gopherjs/js", true, function(Object_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Object = null;
|
|
return;
|
|
}
|
|
this.Object = Object_;
|
|
});
|
|
sliceType = $sliceType($emptyInterface);
|
|
ptrType = $ptrType(Object);
|
|
ptrType$1 = $ptrType(Error);
|
|
Object.ptr.prototype.Get = function(key) {
|
|
var key, o;
|
|
o = this;
|
|
return o.object[$externalize(key, $String)];
|
|
};
|
|
Object.prototype.Get = function(key) { return this.$val.Get(key); };
|
|
Object.ptr.prototype.Set = function(key, value) {
|
|
var key, o, value;
|
|
o = this;
|
|
o.object[$externalize(key, $String)] = $externalize(value, $emptyInterface);
|
|
};
|
|
Object.prototype.Set = function(key, value) { return this.$val.Set(key, value); };
|
|
Object.ptr.prototype.Delete = function(key) {
|
|
var key, o;
|
|
o = this;
|
|
delete o.object[$externalize(key, $String)];
|
|
};
|
|
Object.prototype.Delete = function(key) { return this.$val.Delete(key); };
|
|
Object.ptr.prototype.Length = function() {
|
|
var o;
|
|
o = this;
|
|
return $parseInt(o.object.length);
|
|
};
|
|
Object.prototype.Length = function() { return this.$val.Length(); };
|
|
Object.ptr.prototype.Index = function(i) {
|
|
var i, o;
|
|
o = this;
|
|
return o.object[i];
|
|
};
|
|
Object.prototype.Index = function(i) { return this.$val.Index(i); };
|
|
Object.ptr.prototype.SetIndex = function(i, value) {
|
|
var i, o, value;
|
|
o = this;
|
|
o.object[i] = $externalize(value, $emptyInterface);
|
|
};
|
|
Object.prototype.SetIndex = function(i, value) { return this.$val.SetIndex(i, value); };
|
|
Object.ptr.prototype.Call = function(name, args) {
|
|
var args, name, o, obj;
|
|
o = this;
|
|
return (obj = o.object, obj[$externalize(name, $String)].apply(obj, $externalize(args, sliceType)));
|
|
};
|
|
Object.prototype.Call = function(name, args) { return this.$val.Call(name, args); };
|
|
Object.ptr.prototype.Invoke = function(args) {
|
|
var args, o;
|
|
o = this;
|
|
return o.object.apply(undefined, $externalize(args, sliceType));
|
|
};
|
|
Object.prototype.Invoke = function(args) { return this.$val.Invoke(args); };
|
|
Object.ptr.prototype.New = function(args) {
|
|
var args, o;
|
|
o = this;
|
|
return new ($global.Function.prototype.bind.apply(o.object, [undefined].concat($externalize(args, sliceType))));
|
|
};
|
|
Object.prototype.New = function(args) { return this.$val.New(args); };
|
|
Object.ptr.prototype.Bool = function() {
|
|
var o;
|
|
o = this;
|
|
return !!(o.object);
|
|
};
|
|
Object.prototype.Bool = function() { return this.$val.Bool(); };
|
|
Object.ptr.prototype.String = function() {
|
|
var o;
|
|
o = this;
|
|
return $internalize(o.object, $String);
|
|
};
|
|
Object.prototype.String = function() { return this.$val.String(); };
|
|
Object.ptr.prototype.Int = function() {
|
|
var o;
|
|
o = this;
|
|
return $parseInt(o.object) >> 0;
|
|
};
|
|
Object.prototype.Int = function() { return this.$val.Int(); };
|
|
Object.ptr.prototype.Int64 = function() {
|
|
var o;
|
|
o = this;
|
|
return $internalize(o.object, $Int64);
|
|
};
|
|
Object.prototype.Int64 = function() { return this.$val.Int64(); };
|
|
Object.ptr.prototype.Uint64 = function() {
|
|
var o;
|
|
o = this;
|
|
return $internalize(o.object, $Uint64);
|
|
};
|
|
Object.prototype.Uint64 = function() { return this.$val.Uint64(); };
|
|
Object.ptr.prototype.Float = function() {
|
|
var o;
|
|
o = this;
|
|
return $parseFloat(o.object);
|
|
};
|
|
Object.prototype.Float = function() { return this.$val.Float(); };
|
|
Object.ptr.prototype.Interface = function() {
|
|
var o;
|
|
o = this;
|
|
return $internalize(o.object, $emptyInterface);
|
|
};
|
|
Object.prototype.Interface = function() { return this.$val.Interface(); };
|
|
Object.ptr.prototype.Unsafe = function() {
|
|
var o;
|
|
o = this;
|
|
return o.object;
|
|
};
|
|
Object.prototype.Unsafe = function() { return this.$val.Unsafe(); };
|
|
Error.ptr.prototype.Error = function() {
|
|
var err;
|
|
err = this;
|
|
return "JavaScript error: " + $internalize(err.Object.message, $String);
|
|
};
|
|
Error.prototype.Error = function() { return this.$val.Error(); };
|
|
Error.ptr.prototype.Stack = function() {
|
|
var err;
|
|
err = this;
|
|
return $internalize(err.Object.stack, $String);
|
|
};
|
|
Error.prototype.Stack = function() { return this.$val.Stack(); };
|
|
MakeFunc = function(fn) {
|
|
var fn;
|
|
return $makeFunc(fn);
|
|
};
|
|
$pkg.MakeFunc = MakeFunc;
|
|
init = function() {
|
|
var e;
|
|
e = new Error.ptr(null);
|
|
$unused(e);
|
|
};
|
|
ptrType.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$String], [ptrType], false)}, {prop: "Set", name: "Set", pkg: "", typ: $funcType([$String, $emptyInterface], [], false)}, {prop: "Delete", name: "Delete", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Length", name: "Length", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Index", name: "Index", pkg: "", typ: $funcType([$Int], [ptrType], false)}, {prop: "SetIndex", name: "SetIndex", pkg: "", typ: $funcType([$Int, $emptyInterface], [], false)}, {prop: "Call", name: "Call", pkg: "", typ: $funcType([$String, sliceType], [ptrType], true)}, {prop: "Invoke", name: "Invoke", pkg: "", typ: $funcType([sliceType], [ptrType], true)}, {prop: "New", name: "New", pkg: "", typ: $funcType([sliceType], [ptrType], true)}, {prop: "Bool", name: "Bool", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Int64", name: "Int64", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Float", name: "Float", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Interface", name: "Interface", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Unsafe", name: "Unsafe", pkg: "", typ: $funcType([], [$Uintptr], false)}];
|
|
ptrType$1.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Stack", name: "Stack", pkg: "", typ: $funcType([], [$String], false)}];
|
|
Object.init("github.com/gopherjs/gopherjs/js", [{prop: "object", name: "object", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
|
Error.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/cpu"] = (function() {
|
|
var $pkg = {}, $init;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/bytealg"] = (function() {
|
|
var $pkg = {}, $init, cpu, Equal, Index, Cutover, IndexByteString;
|
|
cpu = $packages["internal/cpu"];
|
|
Equal = function(a, b) {
|
|
var _i, _ref, a, b, c, i;
|
|
if (!((a.$length === b.$length))) {
|
|
return false;
|
|
}
|
|
_ref = a;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!((c === ((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i])))) {
|
|
return false;
|
|
}
|
|
_i++;
|
|
}
|
|
return true;
|
|
};
|
|
$pkg.Equal = Equal;
|
|
Index = function(a, b) {
|
|
var a, b;
|
|
$panic(new $String("unimplemented"));
|
|
};
|
|
$pkg.Index = Index;
|
|
Cutover = function(n) {
|
|
var n;
|
|
$panic(new $String("unimplemented"));
|
|
};
|
|
$pkg.Cutover = Cutover;
|
|
IndexByteString = function(s, c) {
|
|
var c, i, s;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (s.charCodeAt(i) === c) {
|
|
return i;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.IndexByteString = IndexByteString;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = cpu.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.MaxLen = 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["runtime/internal/sys"] = (function() {
|
|
var $pkg = {}, $init;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["runtime"] = (function() {
|
|
var $pkg = {}, $init, js, bytealg, sys, _type, TypeAssertionError, errorString, ptrType, ptrType$4, init, GOROOT, Caller, Goexit, SetFinalizer, KeepAlive, throw$1;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
bytealg = $packages["internal/bytealg"];
|
|
sys = $packages["runtime/internal/sys"];
|
|
_type = $pkg._type = $newType(0, $kindStruct, "runtime._type", true, "runtime", false, function(str_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.str = "";
|
|
return;
|
|
}
|
|
this.str = str_;
|
|
});
|
|
TypeAssertionError = $pkg.TypeAssertionError = $newType(0, $kindStruct, "runtime.TypeAssertionError", true, "runtime", true, function(_interface_, concrete_, asserted_, missingMethod_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this._interface = ptrType.nil;
|
|
this.concrete = ptrType.nil;
|
|
this.asserted = ptrType.nil;
|
|
this.missingMethod = "";
|
|
return;
|
|
}
|
|
this._interface = _interface_;
|
|
this.concrete = concrete_;
|
|
this.asserted = asserted_;
|
|
this.missingMethod = missingMethod_;
|
|
});
|
|
errorString = $pkg.errorString = $newType(8, $kindString, "runtime.errorString", true, "runtime", false, null);
|
|
ptrType = $ptrType(_type);
|
|
ptrType$4 = $ptrType(TypeAssertionError);
|
|
_type.ptr.prototype.string = function() {
|
|
var t;
|
|
t = this;
|
|
return t.str;
|
|
};
|
|
_type.prototype.string = function() { return this.$val.string(); };
|
|
_type.ptr.prototype.pkgpath = function() {
|
|
var t;
|
|
t = this;
|
|
return "";
|
|
};
|
|
_type.prototype.pkgpath = function() { return this.$val.pkgpath(); };
|
|
init = function() {
|
|
var e, jsPkg;
|
|
jsPkg = $packages[$externalize("github.com/gopherjs/gopherjs/js", $String)];
|
|
$jsObjectPtr = jsPkg.Object.ptr;
|
|
$jsErrorPtr = jsPkg.Error.ptr;
|
|
$throwRuntimeError = throw$1;
|
|
e = $ifaceNil;
|
|
e = new TypeAssertionError.ptr(ptrType.nil, ptrType.nil, ptrType.nil, "");
|
|
$unused(e);
|
|
};
|
|
GOROOT = function() {
|
|
var process, v, v$1;
|
|
process = $global.process;
|
|
if (process === undefined) {
|
|
return "/";
|
|
}
|
|
v = process.env.GOPHERJS_GOROOT;
|
|
if (!(v === undefined)) {
|
|
return $internalize(v, $String);
|
|
} else {
|
|
v$1 = process.env.GOROOT;
|
|
if (!(v$1 === undefined)) {
|
|
return $internalize(v$1, $String);
|
|
}
|
|
}
|
|
return "/usr/local/go";
|
|
};
|
|
$pkg.GOROOT = GOROOT;
|
|
Caller = function(skip) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, file, info, line, ok, parts, pc, skip;
|
|
pc = 0;
|
|
file = "";
|
|
line = 0;
|
|
ok = false;
|
|
info = new ($global.Error)().stack.split($externalize("\n", $String))[(skip + 2 >> 0)];
|
|
if (info === undefined) {
|
|
_tmp = 0;
|
|
_tmp$1 = "";
|
|
_tmp$2 = 0;
|
|
_tmp$3 = false;
|
|
pc = _tmp;
|
|
file = _tmp$1;
|
|
line = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [pc, file, line, ok];
|
|
}
|
|
parts = info.substring(($parseInt(info.indexOf($externalize("(", $String))) >> 0) + 1 >> 0, $parseInt(info.indexOf($externalize(")", $String))) >> 0).split($externalize(":", $String));
|
|
_tmp$4 = 0;
|
|
_tmp$5 = $internalize(parts[0], $String);
|
|
_tmp$6 = $parseInt(parts[1]) >> 0;
|
|
_tmp$7 = true;
|
|
pc = _tmp$4;
|
|
file = _tmp$5;
|
|
line = _tmp$6;
|
|
ok = _tmp$7;
|
|
return [pc, file, line, ok];
|
|
};
|
|
$pkg.Caller = Caller;
|
|
Goexit = function() {
|
|
$curGoroutine.exit = $externalize(true, $Bool);
|
|
$throw(null);
|
|
};
|
|
$pkg.Goexit = Goexit;
|
|
SetFinalizer = function(x, f) {
|
|
var f, x;
|
|
};
|
|
$pkg.SetFinalizer = SetFinalizer;
|
|
KeepAlive = function(param) {
|
|
var param;
|
|
};
|
|
$pkg.KeepAlive = KeepAlive;
|
|
throw$1 = function(s) {
|
|
var s;
|
|
$panic(new errorString((s)));
|
|
};
|
|
TypeAssertionError.ptr.prototype.RuntimeError = function() {
|
|
};
|
|
TypeAssertionError.prototype.RuntimeError = function() { return this.$val.RuntimeError(); };
|
|
TypeAssertionError.ptr.prototype.Error = function() {
|
|
var as, cs, e, inter, msg;
|
|
e = this;
|
|
inter = "interface";
|
|
if (!(e._interface === ptrType.nil)) {
|
|
inter = e._interface.string();
|
|
}
|
|
as = e.asserted.string();
|
|
if (e.concrete === ptrType.nil) {
|
|
return "interface conversion: " + inter + " is nil, not " + as;
|
|
}
|
|
cs = e.concrete.string();
|
|
if (e.missingMethod === "") {
|
|
msg = "interface conversion: " + inter + " is " + cs + ", not " + as;
|
|
if (cs === as) {
|
|
if (!(e.concrete.pkgpath() === e.asserted.pkgpath())) {
|
|
msg = msg + (" (types from different packages)");
|
|
} else {
|
|
msg = msg + (" (types from different scopes)");
|
|
}
|
|
}
|
|
return msg;
|
|
}
|
|
return "interface conversion: " + cs + " is not " + as + ": missing method " + e.missingMethod;
|
|
};
|
|
TypeAssertionError.prototype.Error = function() { return this.$val.Error(); };
|
|
errorString.prototype.RuntimeError = function() {
|
|
var e;
|
|
e = this.$val;
|
|
};
|
|
$ptrType(errorString).prototype.RuntimeError = function() { return new errorString(this.$get()).RuntimeError(); };
|
|
errorString.prototype.Error = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return "runtime error: " + (e);
|
|
};
|
|
$ptrType(errorString).prototype.Error = function() { return new errorString(this.$get()).Error(); };
|
|
ptrType.methods = [{prop: "string", name: "string", pkg: "runtime", typ: $funcType([], [$String], false)}, {prop: "pkgpath", name: "pkgpath", pkg: "runtime", typ: $funcType([], [$String], false)}];
|
|
ptrType$4.methods = [{prop: "RuntimeError", name: "RuntimeError", pkg: "", typ: $funcType([], [], false)}, {prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
errorString.methods = [{prop: "RuntimeError", name: "RuntimeError", pkg: "", typ: $funcType([], [], false)}, {prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
_type.init("runtime", [{prop: "str", name: "str", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
TypeAssertionError.init("runtime", [{prop: "_interface", name: "_interface", embedded: false, exported: false, typ: ptrType, tag: ""}, {prop: "concrete", name: "concrete", embedded: false, exported: false, typ: ptrType, tag: ""}, {prop: "asserted", name: "asserted", embedded: false, exported: false, typ: ptrType, tag: ""}, {prop: "missingMethod", name: "missingMethod", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bytealg.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sys.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["errors"] = (function() {
|
|
var $pkg = {}, $init, errorString, ptrType, New;
|
|
errorString = $pkg.errorString = $newType(0, $kindStruct, "errors.errorString", true, "errors", false, function(s_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.s = "";
|
|
return;
|
|
}
|
|
this.s = s_;
|
|
});
|
|
ptrType = $ptrType(errorString);
|
|
New = function(text) {
|
|
var text;
|
|
return new errorString.ptr(text);
|
|
};
|
|
$pkg.New = New;
|
|
errorString.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
return e.s;
|
|
};
|
|
errorString.prototype.Error = function() { return this.$val.Error(); };
|
|
ptrType.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
errorString.init("errors", [{prop: "s", name: "s", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["math/bits"] = (function() {
|
|
var $pkg = {}, $init, deBruijn32tab, deBruijn64tab, len8tab, LeadingZeros64, TrailingZeros, TrailingZeros32, TrailingZeros64, Len64;
|
|
LeadingZeros64 = function(x) {
|
|
var x;
|
|
return 64 - Len64(x) >> 0;
|
|
};
|
|
$pkg.LeadingZeros64 = LeadingZeros64;
|
|
TrailingZeros = function(x) {
|
|
var x;
|
|
if (true) {
|
|
return TrailingZeros32(((x >>> 0)));
|
|
}
|
|
return TrailingZeros64((new $Uint64(0, x)));
|
|
};
|
|
$pkg.TrailingZeros = TrailingZeros;
|
|
TrailingZeros32 = function(x) {
|
|
var x, x$1;
|
|
if (x === 0) {
|
|
return 32;
|
|
}
|
|
return (((x$1 = ($imul((((x & (-x >>> 0)) >>> 0)), 125613361) >>> 0) >>> 27 >>> 0, ((x$1 < 0 || x$1 >= deBruijn32tab.length) ? ($throwRuntimeError("index out of range"), undefined) : deBruijn32tab[x$1])) >> 0));
|
|
};
|
|
$pkg.TrailingZeros32 = TrailingZeros32;
|
|
TrailingZeros64 = function(x) {
|
|
var x, x$1, x$2;
|
|
if ((x.$high === 0 && x.$low === 0)) {
|
|
return 64;
|
|
}
|
|
return (((x$1 = $shiftRightUint64($mul64(((x$2 = new $Uint64(-x.$high, -x.$low), new $Uint64(x.$high & x$2.$high, (x.$low & x$2.$low) >>> 0))), new $Uint64(66559345, 3033172745)), 58), (($flatten64(x$1) < 0 || $flatten64(x$1) >= deBruijn64tab.length) ? ($throwRuntimeError("index out of range"), undefined) : deBruijn64tab[$flatten64(x$1)])) >> 0));
|
|
};
|
|
$pkg.TrailingZeros64 = TrailingZeros64;
|
|
Len64 = function(x) {
|
|
var n, x;
|
|
n = 0;
|
|
if ((x.$high > 1 || (x.$high === 1 && x.$low >= 0))) {
|
|
x = $shiftRightUint64(x, (32));
|
|
n = 32;
|
|
}
|
|
if ((x.$high > 0 || (x.$high === 0 && x.$low >= 65536))) {
|
|
x = $shiftRightUint64(x, (16));
|
|
n = n + (16) >> 0;
|
|
}
|
|
if ((x.$high > 0 || (x.$high === 0 && x.$low >= 256))) {
|
|
x = $shiftRightUint64(x, (8));
|
|
n = n + (8) >> 0;
|
|
}
|
|
n = n + (((($flatten64(x) < 0 || $flatten64(x) >= len8tab.length) ? ($throwRuntimeError("index out of range"), undefined) : len8tab[$flatten64(x)]) >> 0)) >> 0;
|
|
return n;
|
|
};
|
|
$pkg.Len64 = Len64;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
deBruijn32tab = $toNativeArray($kindUint8, [0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9]);
|
|
deBruijn64tab = $toNativeArray($kindUint8, [0, 1, 56, 2, 57, 49, 28, 3, 61, 58, 42, 50, 38, 29, 17, 4, 62, 47, 59, 36, 45, 43, 51, 22, 53, 39, 33, 30, 24, 18, 12, 5, 63, 55, 48, 27, 60, 41, 37, 16, 46, 35, 44, 21, 52, 32, 23, 11, 54, 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6]);
|
|
len8tab = $toNativeArray($kindUint8, [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["math"] = (function() {
|
|
var $pkg = {}, $init, js, bits, arrayType, arrayType$1, arrayType$2, structType, math, zero, nan, buf, Exp, Log, init, Float32bits, Float32frombits, Float64bits, Float64frombits;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
bits = $packages["math/bits"];
|
|
arrayType = $arrayType($Uint32, 2);
|
|
arrayType$1 = $arrayType($Float32, 2);
|
|
arrayType$2 = $arrayType($Float64, 1);
|
|
structType = $structType("math", [{prop: "uint32array", name: "uint32array", embedded: false, exported: false, typ: arrayType, tag: ""}, {prop: "float32array", name: "float32array", embedded: false, exported: false, typ: arrayType$1, tag: ""}, {prop: "float64array", name: "float64array", embedded: false, exported: false, typ: arrayType$2, tag: ""}]);
|
|
Exp = function(x) {
|
|
var x;
|
|
return $parseFloat(math.exp(x));
|
|
};
|
|
$pkg.Exp = Exp;
|
|
Log = function(x) {
|
|
var x;
|
|
if (!((x === x))) {
|
|
return nan;
|
|
}
|
|
return $parseFloat(math.log(x));
|
|
};
|
|
$pkg.Log = Log;
|
|
init = function() {
|
|
var ab;
|
|
ab = new ($global.ArrayBuffer)(8);
|
|
buf.uint32array = new ($global.Uint32Array)(ab);
|
|
buf.float32array = new ($global.Float32Array)(ab);
|
|
buf.float64array = new ($global.Float64Array)(ab);
|
|
};
|
|
Float32bits = function(f) {
|
|
var f;
|
|
buf.float32array[0] = f;
|
|
return buf.uint32array[0];
|
|
};
|
|
$pkg.Float32bits = Float32bits;
|
|
Float32frombits = function(b) {
|
|
var b;
|
|
buf.uint32array[0] = b;
|
|
return buf.float32array[0];
|
|
};
|
|
$pkg.Float32frombits = Float32frombits;
|
|
Float64bits = function(f) {
|
|
var f, x, x$1;
|
|
buf.float64array[0] = f;
|
|
return (x = $shiftLeft64((new $Uint64(0, buf.uint32array[1])), 32), x$1 = (new $Uint64(0, buf.uint32array[0])), new $Uint64(x.$high + x$1.$high, x.$low + x$1.$low));
|
|
};
|
|
$pkg.Float64bits = Float64bits;
|
|
Float64frombits = function(b) {
|
|
var b;
|
|
buf.uint32array[0] = ((b.$low >>> 0));
|
|
buf.uint32array[1] = (($shiftRightUint64(b, 32).$low >>> 0));
|
|
return buf.float64array[0];
|
|
};
|
|
$pkg.Float64frombits = Float64frombits;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bits.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
buf = new structType.ptr(arrayType.zero(), arrayType$1.zero(), arrayType$2.zero());
|
|
math = $global.Math;
|
|
zero = 0;
|
|
nan = 0 / zero;
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["unicode/utf8"] = (function() {
|
|
var $pkg = {}, $init, acceptRange, first, acceptRanges, DecodeRune, DecodeRuneInString, DecodeLastRune, DecodeLastRuneInString, RuneLen, EncodeRune, RuneCount, RuneCountInString, RuneStart, ValidString, ValidRune;
|
|
acceptRange = $pkg.acceptRange = $newType(0, $kindStruct, "utf8.acceptRange", true, "unicode/utf8", false, function(lo_, hi_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.lo = 0;
|
|
this.hi = 0;
|
|
return;
|
|
}
|
|
this.lo = lo_;
|
|
this.hi = hi_;
|
|
});
|
|
DecodeRune = function(p) {
|
|
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, accept, b1, b2, b3, mask, n, p, p0, r, size, sz, x, x$1;
|
|
r = 0;
|
|
size = 0;
|
|
n = p.$length;
|
|
if (n < 1) {
|
|
_tmp = 65533;
|
|
_tmp$1 = 0;
|
|
r = _tmp;
|
|
size = _tmp$1;
|
|
return [r, size];
|
|
}
|
|
p0 = (0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0]);
|
|
x = ((p0 < 0 || p0 >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[p0]);
|
|
if (x >= 240) {
|
|
mask = (((x >> 0)) << 31 >> 0) >> 31 >> 0;
|
|
_tmp$2 = (((((0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0]) >> 0)) & ~mask) >> 0) | (65533 & mask);
|
|
_tmp$3 = 1;
|
|
r = _tmp$2;
|
|
size = _tmp$3;
|
|
return [r, size];
|
|
}
|
|
sz = (x & 7) >>> 0;
|
|
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
|
|
if (n < ((sz >> 0))) {
|
|
_tmp$4 = 65533;
|
|
_tmp$5 = 1;
|
|
r = _tmp$4;
|
|
size = _tmp$5;
|
|
return [r, size];
|
|
}
|
|
b1 = (1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1]);
|
|
if (b1 < accept.lo || accept.hi < b1) {
|
|
_tmp$6 = 65533;
|
|
_tmp$7 = 1;
|
|
r = _tmp$6;
|
|
size = _tmp$7;
|
|
return [r, size];
|
|
}
|
|
if (sz === 2) {
|
|
_tmp$8 = (((((p0 & 31) >>> 0) >> 0)) << 6 >> 0) | ((((b1 & 63) >>> 0) >> 0));
|
|
_tmp$9 = 2;
|
|
r = _tmp$8;
|
|
size = _tmp$9;
|
|
return [r, size];
|
|
}
|
|
b2 = (2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2]);
|
|
if (b2 < 128 || 191 < b2) {
|
|
_tmp$10 = 65533;
|
|
_tmp$11 = 1;
|
|
r = _tmp$10;
|
|
size = _tmp$11;
|
|
return [r, size];
|
|
}
|
|
if (sz === 3) {
|
|
_tmp$12 = ((((((p0 & 15) >>> 0) >> 0)) << 12 >> 0) | (((((b1 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((b2 & 63) >>> 0) >> 0));
|
|
_tmp$13 = 3;
|
|
r = _tmp$12;
|
|
size = _tmp$13;
|
|
return [r, size];
|
|
}
|
|
b3 = (3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3]);
|
|
if (b3 < 128 || 191 < b3) {
|
|
_tmp$14 = 65533;
|
|
_tmp$15 = 1;
|
|
r = _tmp$14;
|
|
size = _tmp$15;
|
|
return [r, size];
|
|
}
|
|
_tmp$16 = (((((((p0 & 7) >>> 0) >> 0)) << 18 >> 0) | (((((b1 & 63) >>> 0) >> 0)) << 12 >> 0)) | (((((b2 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((b3 & 63) >>> 0) >> 0));
|
|
_tmp$17 = 4;
|
|
r = _tmp$16;
|
|
size = _tmp$17;
|
|
return [r, size];
|
|
};
|
|
$pkg.DecodeRune = DecodeRune;
|
|
DecodeRuneInString = function(s) {
|
|
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, accept, mask, n, r, s, s0, s1, s2, s3, size, sz, x, x$1;
|
|
r = 0;
|
|
size = 0;
|
|
n = s.length;
|
|
if (n < 1) {
|
|
_tmp = 65533;
|
|
_tmp$1 = 0;
|
|
r = _tmp;
|
|
size = _tmp$1;
|
|
return [r, size];
|
|
}
|
|
s0 = s.charCodeAt(0);
|
|
x = ((s0 < 0 || s0 >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[s0]);
|
|
if (x >= 240) {
|
|
mask = (((x >> 0)) << 31 >> 0) >> 31 >> 0;
|
|
_tmp$2 = ((((s.charCodeAt(0) >> 0)) & ~mask) >> 0) | (65533 & mask);
|
|
_tmp$3 = 1;
|
|
r = _tmp$2;
|
|
size = _tmp$3;
|
|
return [r, size];
|
|
}
|
|
sz = (x & 7) >>> 0;
|
|
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
|
|
if (n < ((sz >> 0))) {
|
|
_tmp$4 = 65533;
|
|
_tmp$5 = 1;
|
|
r = _tmp$4;
|
|
size = _tmp$5;
|
|
return [r, size];
|
|
}
|
|
s1 = s.charCodeAt(1);
|
|
if (s1 < accept.lo || accept.hi < s1) {
|
|
_tmp$6 = 65533;
|
|
_tmp$7 = 1;
|
|
r = _tmp$6;
|
|
size = _tmp$7;
|
|
return [r, size];
|
|
}
|
|
if (sz === 2) {
|
|
_tmp$8 = (((((s0 & 31) >>> 0) >> 0)) << 6 >> 0) | ((((s1 & 63) >>> 0) >> 0));
|
|
_tmp$9 = 2;
|
|
r = _tmp$8;
|
|
size = _tmp$9;
|
|
return [r, size];
|
|
}
|
|
s2 = s.charCodeAt(2);
|
|
if (s2 < 128 || 191 < s2) {
|
|
_tmp$10 = 65533;
|
|
_tmp$11 = 1;
|
|
r = _tmp$10;
|
|
size = _tmp$11;
|
|
return [r, size];
|
|
}
|
|
if (sz === 3) {
|
|
_tmp$12 = ((((((s0 & 15) >>> 0) >> 0)) << 12 >> 0) | (((((s1 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((s2 & 63) >>> 0) >> 0));
|
|
_tmp$13 = 3;
|
|
r = _tmp$12;
|
|
size = _tmp$13;
|
|
return [r, size];
|
|
}
|
|
s3 = s.charCodeAt(3);
|
|
if (s3 < 128 || 191 < s3) {
|
|
_tmp$14 = 65533;
|
|
_tmp$15 = 1;
|
|
r = _tmp$14;
|
|
size = _tmp$15;
|
|
return [r, size];
|
|
}
|
|
_tmp$16 = (((((((s0 & 7) >>> 0) >> 0)) << 18 >> 0) | (((((s1 & 63) >>> 0) >> 0)) << 12 >> 0)) | (((((s2 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((s3 & 63) >>> 0) >> 0));
|
|
_tmp$17 = 4;
|
|
r = _tmp$16;
|
|
size = _tmp$17;
|
|
return [r, size];
|
|
};
|
|
$pkg.DecodeRuneInString = DecodeRuneInString;
|
|
DecodeLastRune = function(p) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, end, lim, p, r, size, start;
|
|
r = 0;
|
|
size = 0;
|
|
end = p.$length;
|
|
if (end === 0) {
|
|
_tmp = 65533;
|
|
_tmp$1 = 0;
|
|
r = _tmp;
|
|
size = _tmp$1;
|
|
return [r, size];
|
|
}
|
|
start = end - 1 >> 0;
|
|
r = ((((start < 0 || start >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + start]) >> 0));
|
|
if (r < 128) {
|
|
_tmp$2 = r;
|
|
_tmp$3 = 1;
|
|
r = _tmp$2;
|
|
size = _tmp$3;
|
|
return [r, size];
|
|
}
|
|
lim = end - 4 >> 0;
|
|
if (lim < 0) {
|
|
lim = 0;
|
|
}
|
|
start = start - (1) >> 0;
|
|
while (true) {
|
|
if (!(start >= lim)) { break; }
|
|
if (RuneStart(((start < 0 || start >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + start]))) {
|
|
break;
|
|
}
|
|
start = start - (1) >> 0;
|
|
}
|
|
if (start < 0) {
|
|
start = 0;
|
|
}
|
|
_tuple = DecodeRune($subslice(p, start, end));
|
|
r = _tuple[0];
|
|
size = _tuple[1];
|
|
if (!(((start + size >> 0) === end))) {
|
|
_tmp$4 = 65533;
|
|
_tmp$5 = 1;
|
|
r = _tmp$4;
|
|
size = _tmp$5;
|
|
return [r, size];
|
|
}
|
|
_tmp$6 = r;
|
|
_tmp$7 = size;
|
|
r = _tmp$6;
|
|
size = _tmp$7;
|
|
return [r, size];
|
|
};
|
|
$pkg.DecodeLastRune = DecodeLastRune;
|
|
DecodeLastRuneInString = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, end, lim, r, s, size, start;
|
|
r = 0;
|
|
size = 0;
|
|
end = s.length;
|
|
if (end === 0) {
|
|
_tmp = 65533;
|
|
_tmp$1 = 0;
|
|
r = _tmp;
|
|
size = _tmp$1;
|
|
return [r, size];
|
|
}
|
|
start = end - 1 >> 0;
|
|
r = ((s.charCodeAt(start) >> 0));
|
|
if (r < 128) {
|
|
_tmp$2 = r;
|
|
_tmp$3 = 1;
|
|
r = _tmp$2;
|
|
size = _tmp$3;
|
|
return [r, size];
|
|
}
|
|
lim = end - 4 >> 0;
|
|
if (lim < 0) {
|
|
lim = 0;
|
|
}
|
|
start = start - (1) >> 0;
|
|
while (true) {
|
|
if (!(start >= lim)) { break; }
|
|
if (RuneStart(s.charCodeAt(start))) {
|
|
break;
|
|
}
|
|
start = start - (1) >> 0;
|
|
}
|
|
if (start < 0) {
|
|
start = 0;
|
|
}
|
|
_tuple = DecodeRuneInString($substring(s, start, end));
|
|
r = _tuple[0];
|
|
size = _tuple[1];
|
|
if (!(((start + size >> 0) === end))) {
|
|
_tmp$4 = 65533;
|
|
_tmp$5 = 1;
|
|
r = _tmp$4;
|
|
size = _tmp$5;
|
|
return [r, size];
|
|
}
|
|
_tmp$6 = r;
|
|
_tmp$7 = size;
|
|
r = _tmp$6;
|
|
size = _tmp$7;
|
|
return [r, size];
|
|
};
|
|
$pkg.DecodeLastRuneInString = DecodeLastRuneInString;
|
|
RuneLen = function(r) {
|
|
var r;
|
|
if (r < 0) {
|
|
return -1;
|
|
} else if (r <= 127) {
|
|
return 1;
|
|
} else if (r <= 2047) {
|
|
return 2;
|
|
} else if (55296 <= r && r <= 57343) {
|
|
return -1;
|
|
} else if (r <= 65535) {
|
|
return 3;
|
|
} else if (r <= 1114111) {
|
|
return 4;
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.RuneLen = RuneLen;
|
|
EncodeRune = function(p, r) {
|
|
var i, p, r;
|
|
i = ((r >>> 0));
|
|
if (i <= 127) {
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((r << 24 >>> 24)));
|
|
return 1;
|
|
} else if (i <= 2047) {
|
|
$unused((1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1]));
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((192 | (((r >> 6 >> 0) << 24 >>> 24))) >>> 0));
|
|
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
return 2;
|
|
} else if ((i > 1114111) || (55296 <= i && i <= 57343)) {
|
|
r = 65533;
|
|
$unused((2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2]));
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((224 | (((r >> 12 >> 0) << 24 >>> 24))) >>> 0));
|
|
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
return 3;
|
|
} else if (i <= 65535) {
|
|
$unused((2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2]));
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((224 | (((r >> 12 >> 0) << 24 >>> 24))) >>> 0));
|
|
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
return 3;
|
|
} else {
|
|
$unused((3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3]));
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((240 | (((r >> 18 >> 0) << 24 >>> 24))) >>> 0));
|
|
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 12 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
(3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
|
|
return 4;
|
|
}
|
|
};
|
|
$pkg.EncodeRune = EncodeRune;
|
|
RuneCount = function(p) {
|
|
var accept, c, c$1, c$2, c$3, i, n, np, p, size, x, x$1, x$2, x$3, x$4;
|
|
np = p.$length;
|
|
n = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < np)) { break; }
|
|
n = n + (1) >> 0;
|
|
c = ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]);
|
|
if (c < 128) {
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
x = ((c < 0 || c >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[c]);
|
|
if (x === 241) {
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
size = ((((x & 7) >>> 0) >> 0));
|
|
if ((i + size >> 0) > np) {
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
|
|
c$1 = (x$2 = i + 1 >> 0, ((x$2 < 0 || x$2 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$2]));
|
|
if (c$1 < accept.lo || accept.hi < c$1) {
|
|
size = 1;
|
|
} else if (size === 2) {
|
|
} else {
|
|
c$2 = (x$3 = i + 2 >> 0, ((x$3 < 0 || x$3 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$3]));
|
|
if (c$2 < 128 || 191 < c$2) {
|
|
size = 1;
|
|
} else if (size === 3) {
|
|
} else {
|
|
c$3 = (x$4 = i + 3 >> 0, ((x$4 < 0 || x$4 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$4]));
|
|
if (c$3 < 128 || 191 < c$3) {
|
|
size = 1;
|
|
}
|
|
}
|
|
}
|
|
i = i + (size) >> 0;
|
|
}
|
|
return n;
|
|
};
|
|
$pkg.RuneCount = RuneCount;
|
|
RuneCountInString = function(s) {
|
|
var accept, c, c$1, c$2, c$3, i, n, ns, s, size, x, x$1;
|
|
n = 0;
|
|
ns = s.length;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < ns)) { break; }
|
|
c = s.charCodeAt(i);
|
|
if (c < 128) {
|
|
i = i + (1) >> 0;
|
|
n = n + (1) >> 0;
|
|
continue;
|
|
}
|
|
x = ((c < 0 || c >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[c]);
|
|
if (x === 241) {
|
|
i = i + (1) >> 0;
|
|
n = n + (1) >> 0;
|
|
continue;
|
|
}
|
|
size = ((((x & 7) >>> 0) >> 0));
|
|
if ((i + size >> 0) > ns) {
|
|
i = i + (1) >> 0;
|
|
n = n + (1) >> 0;
|
|
continue;
|
|
}
|
|
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
|
|
c$1 = s.charCodeAt((i + 1 >> 0));
|
|
if (c$1 < accept.lo || accept.hi < c$1) {
|
|
size = 1;
|
|
} else if (size === 2) {
|
|
} else {
|
|
c$2 = s.charCodeAt((i + 2 >> 0));
|
|
if (c$2 < 128 || 191 < c$2) {
|
|
size = 1;
|
|
} else if (size === 3) {
|
|
} else {
|
|
c$3 = s.charCodeAt((i + 3 >> 0));
|
|
if (c$3 < 128 || 191 < c$3) {
|
|
size = 1;
|
|
}
|
|
}
|
|
}
|
|
i = i + (size) >> 0;
|
|
n = n + (1) >> 0;
|
|
}
|
|
n = n;
|
|
return n;
|
|
};
|
|
$pkg.RuneCountInString = RuneCountInString;
|
|
RuneStart = function(b) {
|
|
var b;
|
|
return !((((b & 192) >>> 0) === 128));
|
|
};
|
|
$pkg.RuneStart = RuneStart;
|
|
ValidString = function(s) {
|
|
var accept, c, c$1, c$2, i, n, s, si, size, x, x$1;
|
|
n = s.length;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < n)) { break; }
|
|
si = s.charCodeAt(i);
|
|
if (si < 128) {
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
x = ((si < 0 || si >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[si]);
|
|
if (x === 241) {
|
|
return false;
|
|
}
|
|
size = ((((x & 7) >>> 0) >> 0));
|
|
if ((i + size >> 0) > n) {
|
|
return false;
|
|
}
|
|
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
|
|
c = s.charCodeAt((i + 1 >> 0));
|
|
if (c < accept.lo || accept.hi < c) {
|
|
return false;
|
|
} else if (size === 2) {
|
|
} else {
|
|
c$1 = s.charCodeAt((i + 2 >> 0));
|
|
if (c$1 < 128 || 191 < c$1) {
|
|
return false;
|
|
} else if (size === 3) {
|
|
} else {
|
|
c$2 = s.charCodeAt((i + 3 >> 0));
|
|
if (c$2 < 128 || 191 < c$2) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
i = i + (size) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
$pkg.ValidString = ValidString;
|
|
ValidRune = function(r) {
|
|
var r;
|
|
if (0 <= r && r < 55296) {
|
|
return true;
|
|
} else if (57343 < r && r <= 1114111) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
$pkg.ValidRune = ValidRune;
|
|
acceptRange.init("unicode/utf8", [{prop: "lo", name: "lo", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "hi", name: "hi", embedded: false, exported: false, typ: $Uint8, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
first = $toNativeArray($kindUint8, [240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 35, 3, 3, 52, 4, 4, 4, 68, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241]);
|
|
acceptRanges = $toNativeArray($kindStruct, [new acceptRange.ptr(128, 191), new acceptRange.ptr(160, 191), new acceptRange.ptr(128, 159), new acceptRange.ptr(144, 191), new acceptRange.ptr(128, 143)]);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["strconv"] = (function() {
|
|
var $pkg = {}, $init, errors, bytealg, math, bits, utf8, NumError, decimal, leftCheat, extFloat, floatInfo, decimalSlice, sliceType$3, sliceType$4, sliceType$5, arrayType, sliceType$6, ptrType, arrayType$1, arrayType$2, ptrType$1, arrayType$3, arrayType$4, ptrType$2, ptrType$3, ptrType$4, optimize, leftcheats, smallPowersOfTen, powersOfTen, uint64pow10, float32info, float32info$24ptr, float64info, float64info$24ptr, isPrint16, isNotPrint16, isPrint32, isNotPrint32, isGraphic, syntaxError, rangeError, baseError, bitSizeError, ParseUint, ParseInt, Atoi, digitZero, trim, rightShift, prefixIsLessThan, leftShift, shouldRoundUp, frexp10Many, adjustLastDigitFixed, adjustLastDigit, AppendFloat, genericFtoa, bigFtoa, formatDigits, roundShortest, fmtE, fmtF, fmtB, min, max, FormatUint, FormatInt, Itoa, small, formatBits, isPowerOfTwo, quoteWith, appendQuotedWith, appendQuotedRuneWith, appendEscapedRune, Quote, AppendQuote, QuoteToASCII, AppendQuoteToASCII, AppendQuoteRune, AppendQuoteRuneToASCII, CanBackquote, unhex, UnquoteChar, Unquote, contains, bsearch16, bsearch32, IsPrint, isInGraphicList;
|
|
errors = $packages["errors"];
|
|
bytealg = $packages["internal/bytealg"];
|
|
math = $packages["math"];
|
|
bits = $packages["math/bits"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
NumError = $pkg.NumError = $newType(0, $kindStruct, "strconv.NumError", true, "strconv", true, function(Func_, Num_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Func = "";
|
|
this.Num = "";
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Func = Func_;
|
|
this.Num = Num_;
|
|
this.Err = Err_;
|
|
});
|
|
decimal = $pkg.decimal = $newType(0, $kindStruct, "strconv.decimal", true, "strconv", false, function(d_, nd_, dp_, neg_, trunc_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.d = arrayType.zero();
|
|
this.nd = 0;
|
|
this.dp = 0;
|
|
this.neg = false;
|
|
this.trunc = false;
|
|
return;
|
|
}
|
|
this.d = d_;
|
|
this.nd = nd_;
|
|
this.dp = dp_;
|
|
this.neg = neg_;
|
|
this.trunc = trunc_;
|
|
});
|
|
leftCheat = $pkg.leftCheat = $newType(0, $kindStruct, "strconv.leftCheat", true, "strconv", false, function(delta_, cutoff_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.delta = 0;
|
|
this.cutoff = "";
|
|
return;
|
|
}
|
|
this.delta = delta_;
|
|
this.cutoff = cutoff_;
|
|
});
|
|
extFloat = $pkg.extFloat = $newType(0, $kindStruct, "strconv.extFloat", true, "strconv", false, function(mant_, exp_, neg_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.mant = new $Uint64(0, 0);
|
|
this.exp = 0;
|
|
this.neg = false;
|
|
return;
|
|
}
|
|
this.mant = mant_;
|
|
this.exp = exp_;
|
|
this.neg = neg_;
|
|
});
|
|
floatInfo = $pkg.floatInfo = $newType(0, $kindStruct, "strconv.floatInfo", true, "strconv", false, function(mantbits_, expbits_, bias_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.mantbits = 0;
|
|
this.expbits = 0;
|
|
this.bias = 0;
|
|
return;
|
|
}
|
|
this.mantbits = mantbits_;
|
|
this.expbits = expbits_;
|
|
this.bias = bias_;
|
|
});
|
|
decimalSlice = $pkg.decimalSlice = $newType(0, $kindStruct, "strconv.decimalSlice", true, "strconv", false, function(d_, nd_, dp_, neg_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.d = sliceType$6.nil;
|
|
this.nd = 0;
|
|
this.dp = 0;
|
|
this.neg = false;
|
|
return;
|
|
}
|
|
this.d = d_;
|
|
this.nd = nd_;
|
|
this.dp = dp_;
|
|
this.neg = neg_;
|
|
});
|
|
sliceType$3 = $sliceType(leftCheat);
|
|
sliceType$4 = $sliceType($Uint16);
|
|
sliceType$5 = $sliceType($Uint32);
|
|
arrayType = $arrayType($Uint8, 800);
|
|
sliceType$6 = $sliceType($Uint8);
|
|
ptrType = $ptrType(NumError);
|
|
arrayType$1 = $arrayType($Uint8, 24);
|
|
arrayType$2 = $arrayType($Uint8, 32);
|
|
ptrType$1 = $ptrType(floatInfo);
|
|
arrayType$3 = $arrayType($Uint8, 65);
|
|
arrayType$4 = $arrayType($Uint8, 4);
|
|
ptrType$2 = $ptrType(decimal);
|
|
ptrType$3 = $ptrType(decimalSlice);
|
|
ptrType$4 = $ptrType(extFloat);
|
|
NumError.ptr.prototype.Error = function() {
|
|
var _r, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return "strconv." + e.Func + ": " + "parsing " + Quote(e.Num) + ": " + _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: NumError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
NumError.prototype.Error = function() { return this.$val.Error(); };
|
|
syntaxError = function(fn, str) {
|
|
var fn, str;
|
|
return new NumError.ptr(fn, str, $pkg.ErrSyntax);
|
|
};
|
|
rangeError = function(fn, str) {
|
|
var fn, str;
|
|
return new NumError.ptr(fn, str, $pkg.ErrRange);
|
|
};
|
|
baseError = function(fn, str, base) {
|
|
var base, fn, str;
|
|
return new NumError.ptr(fn, str, errors.New("invalid base " + Itoa(base)));
|
|
};
|
|
bitSizeError = function(fn, str, bitSize) {
|
|
var bitSize, fn, str;
|
|
return new NumError.ptr(fn, str, errors.New("invalid bit size " + Itoa(bitSize)));
|
|
};
|
|
ParseUint = function(s, base, bitSize) {
|
|
var _1, _i, _ref, base, bitSize, c, cutoff, d, maxVal, n, n1, s, s0, x, x$1, x$2;
|
|
if (s.length === 0) {
|
|
return [new $Uint64(0, 0), syntaxError("ParseUint", s)];
|
|
}
|
|
s0 = s;
|
|
if (2 <= base && base <= 36) {
|
|
} else if ((base === 0)) {
|
|
if ((s.charCodeAt(0) === 48) && s.length > 1 && ((s.charCodeAt(1) === 120) || (s.charCodeAt(1) === 88))) {
|
|
if (s.length < 3) {
|
|
return [new $Uint64(0, 0), syntaxError("ParseUint", s0)];
|
|
}
|
|
base = 16;
|
|
s = $substring(s, 2);
|
|
} else if ((s.charCodeAt(0) === 48)) {
|
|
base = 8;
|
|
s = $substring(s, 1);
|
|
} else {
|
|
base = 10;
|
|
}
|
|
} else {
|
|
return [new $Uint64(0, 0), baseError("ParseUint", s0, base)];
|
|
}
|
|
if (bitSize === 0) {
|
|
bitSize = 32;
|
|
} else if (bitSize < 0 || bitSize > 64) {
|
|
return [new $Uint64(0, 0), bitSizeError("ParseUint", s0, bitSize)];
|
|
}
|
|
cutoff = new $Uint64(0, 0);
|
|
_1 = base;
|
|
if (_1 === (10)) {
|
|
cutoff = new $Uint64(429496729, 2576980378);
|
|
} else if (_1 === (16)) {
|
|
cutoff = new $Uint64(268435456, 0);
|
|
} else {
|
|
cutoff = (x = $div64(new $Uint64(4294967295, 4294967295), (new $Uint64(0, base)), false), new $Uint64(x.$high + 0, x.$low + 1));
|
|
}
|
|
maxVal = (x$1 = $shiftLeft64(new $Uint64(0, 1), ((bitSize >>> 0))), new $Uint64(x$1.$high - 0, x$1.$low - 1));
|
|
n = new $Uint64(0, 0);
|
|
_ref = (new sliceType$6($stringToBytes(s)));
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
d = 0;
|
|
if (48 <= c && c <= 57) {
|
|
d = c - 48 << 24 >>> 24;
|
|
} else if (97 <= c && c <= 122) {
|
|
d = (c - 97 << 24 >>> 24) + 10 << 24 >>> 24;
|
|
} else if (65 <= c && c <= 90) {
|
|
d = (c - 65 << 24 >>> 24) + 10 << 24 >>> 24;
|
|
} else {
|
|
return [new $Uint64(0, 0), syntaxError("ParseUint", s0)];
|
|
}
|
|
if (d >= ((base << 24 >>> 24))) {
|
|
return [new $Uint64(0, 0), syntaxError("ParseUint", s0)];
|
|
}
|
|
if ((n.$high > cutoff.$high || (n.$high === cutoff.$high && n.$low >= cutoff.$low))) {
|
|
return [maxVal, rangeError("ParseUint", s0)];
|
|
}
|
|
n = $mul64(n, ((new $Uint64(0, base))));
|
|
n1 = (x$2 = (new $Uint64(0, d)), new $Uint64(n.$high + x$2.$high, n.$low + x$2.$low));
|
|
if ((n1.$high < n.$high || (n1.$high === n.$high && n1.$low < n.$low)) || (n1.$high > maxVal.$high || (n1.$high === maxVal.$high && n1.$low > maxVal.$low))) {
|
|
return [maxVal, rangeError("ParseUint", s0)];
|
|
}
|
|
n = n1;
|
|
_i++;
|
|
}
|
|
return [n, $ifaceNil];
|
|
};
|
|
$pkg.ParseUint = ParseUint;
|
|
ParseInt = function(s, base, bitSize) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, base, bitSize, cutoff, err, i, n, neg, s, s0, un, x, x$1;
|
|
i = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
if (s.length === 0) {
|
|
_tmp = new $Int64(0, 0);
|
|
_tmp$1 = syntaxError("ParseInt", s);
|
|
i = _tmp;
|
|
err = _tmp$1;
|
|
return [i, err];
|
|
}
|
|
s0 = s;
|
|
neg = false;
|
|
if (s.charCodeAt(0) === 43) {
|
|
s = $substring(s, 1);
|
|
} else if (s.charCodeAt(0) === 45) {
|
|
neg = true;
|
|
s = $substring(s, 1);
|
|
}
|
|
un = new $Uint64(0, 0);
|
|
_tuple = ParseUint(s, base, bitSize);
|
|
un = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil)) && !($interfaceIsEqual($assertType(err, ptrType).Err, $pkg.ErrRange))) {
|
|
$assertType(err, ptrType).Func = "ParseInt";
|
|
$assertType(err, ptrType).Num = s0;
|
|
_tmp$2 = new $Int64(0, 0);
|
|
_tmp$3 = err;
|
|
i = _tmp$2;
|
|
err = _tmp$3;
|
|
return [i, err];
|
|
}
|
|
if (bitSize === 0) {
|
|
bitSize = 32;
|
|
}
|
|
cutoff = ($shiftLeft64(new $Uint64(0, 1), (((bitSize - 1 >> 0) >>> 0))));
|
|
if (!neg && (un.$high > cutoff.$high || (un.$high === cutoff.$high && un.$low >= cutoff.$low))) {
|
|
_tmp$4 = ((x = new $Uint64(cutoff.$high - 0, cutoff.$low - 1), new $Int64(x.$high, x.$low)));
|
|
_tmp$5 = rangeError("ParseInt", s0);
|
|
i = _tmp$4;
|
|
err = _tmp$5;
|
|
return [i, err];
|
|
}
|
|
if (neg && (un.$high > cutoff.$high || (un.$high === cutoff.$high && un.$low > cutoff.$low))) {
|
|
_tmp$6 = (x$1 = (new $Int64(cutoff.$high, cutoff.$low)), new $Int64(-x$1.$high, -x$1.$low));
|
|
_tmp$7 = rangeError("ParseInt", s0);
|
|
i = _tmp$6;
|
|
err = _tmp$7;
|
|
return [i, err];
|
|
}
|
|
n = (new $Int64(un.$high, un.$low));
|
|
if (neg) {
|
|
n = new $Int64(-n.$high, -n.$low);
|
|
}
|
|
_tmp$8 = n;
|
|
_tmp$9 = $ifaceNil;
|
|
i = _tmp$8;
|
|
err = _tmp$9;
|
|
return [i, err];
|
|
};
|
|
$pkg.ParseInt = ParseInt;
|
|
Atoi = function(s) {
|
|
var _i, _ref, _tuple, _tuple$1, ch, err, i64, n, nerr, ok, s, s0, sLen;
|
|
sLen = s.length;
|
|
if (true && (0 < sLen && sLen < 10) || false && (0 < sLen && sLen < 19)) {
|
|
s0 = s;
|
|
if ((s.charCodeAt(0) === 45) || (s.charCodeAt(0) === 43)) {
|
|
s = $substring(s, 1);
|
|
if (s.length < 1) {
|
|
return [0, new NumError.ptr("Atoi", s0, $pkg.ErrSyntax)];
|
|
}
|
|
}
|
|
n = 0;
|
|
_ref = (new sliceType$6($stringToBytes(s)));
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
ch = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
ch = ch - (48) << 24 >>> 24;
|
|
if (ch > 9) {
|
|
return [0, new NumError.ptr("Atoi", s0, $pkg.ErrSyntax)];
|
|
}
|
|
n = ($imul(n, 10)) + ((ch >> 0)) >> 0;
|
|
_i++;
|
|
}
|
|
if (s0.charCodeAt(0) === 45) {
|
|
n = -n;
|
|
}
|
|
return [n, $ifaceNil];
|
|
}
|
|
_tuple = ParseInt(s, 10, 0);
|
|
i64 = _tuple[0];
|
|
err = _tuple[1];
|
|
_tuple$1 = $assertType(err, ptrType, true);
|
|
nerr = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
if (ok) {
|
|
nerr.Func = "Atoi";
|
|
}
|
|
return [(((i64.$low + ((i64.$high >> 31) * 4294967296)) >> 0)), err];
|
|
};
|
|
$pkg.Atoi = Atoi;
|
|
decimal.ptr.prototype.String = function() {
|
|
var a, buf, n, w;
|
|
a = this;
|
|
n = 10 + a.nd >> 0;
|
|
if (a.dp > 0) {
|
|
n = n + (a.dp) >> 0;
|
|
}
|
|
if (a.dp < 0) {
|
|
n = n + (-a.dp) >> 0;
|
|
}
|
|
buf = $makeSlice(sliceType$6, n);
|
|
w = 0;
|
|
if ((a.nd === 0)) {
|
|
return "0";
|
|
} else if (a.dp <= 0) {
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 48);
|
|
w = w + (1) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 46);
|
|
w = w + (1) >> 0;
|
|
w = w + (digitZero($subslice(buf, w, (w + -a.dp >> 0)))) >> 0;
|
|
w = w + ($copySlice($subslice(buf, w), $subslice(new sliceType$6(a.d), 0, a.nd))) >> 0;
|
|
} else if (a.dp < a.nd) {
|
|
w = w + ($copySlice($subslice(buf, w), $subslice(new sliceType$6(a.d), 0, a.dp))) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 46);
|
|
w = w + (1) >> 0;
|
|
w = w + ($copySlice($subslice(buf, w), $subslice(new sliceType$6(a.d), a.dp, a.nd))) >> 0;
|
|
} else {
|
|
w = w + ($copySlice($subslice(buf, w), $subslice(new sliceType$6(a.d), 0, a.nd))) >> 0;
|
|
w = w + (digitZero($subslice(buf, w, ((w + a.dp >> 0) - a.nd >> 0)))) >> 0;
|
|
}
|
|
return ($bytesToString($subslice(buf, 0, w)));
|
|
};
|
|
decimal.prototype.String = function() { return this.$val.String(); };
|
|
digitZero = function(dst) {
|
|
var _i, _ref, dst, i;
|
|
_ref = dst;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
((i < 0 || i >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + i] = 48);
|
|
_i++;
|
|
}
|
|
return dst.$length;
|
|
};
|
|
trim = function(a) {
|
|
var a, x, x$1;
|
|
while (true) {
|
|
if (!(a.nd > 0 && ((x = a.d, x$1 = a.nd - 1 >> 0, ((x$1 < 0 || x$1 >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[x$1])) === 48))) { break; }
|
|
a.nd = a.nd - (1) >> 0;
|
|
}
|
|
if (a.nd === 0) {
|
|
a.dp = 0;
|
|
}
|
|
};
|
|
decimal.ptr.prototype.Assign = function(v) {
|
|
var a, buf, n, v, v1, x, x$1, x$2;
|
|
a = this;
|
|
buf = arrayType$1.zero();
|
|
n = 0;
|
|
while (true) {
|
|
if (!((v.$high > 0 || (v.$high === 0 && v.$low > 0)))) { break; }
|
|
v1 = $div64(v, new $Uint64(0, 10), false);
|
|
v = (x = $mul64(new $Uint64(0, 10), v1), new $Uint64(v.$high - x.$high, v.$low - x.$low));
|
|
((n < 0 || n >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[n] = ((new $Uint64(v.$high + 0, v.$low + 48).$low << 24 >>> 24)));
|
|
n = n + (1) >> 0;
|
|
v = v1;
|
|
}
|
|
a.nd = 0;
|
|
n = n - (1) >> 0;
|
|
while (true) {
|
|
if (!(n >= 0)) { break; }
|
|
(x$1 = a.d, x$2 = a.nd, ((x$2 < 0 || x$2 >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[x$2] = ((n < 0 || n >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[n])));
|
|
a.nd = a.nd + (1) >> 0;
|
|
n = n - (1) >> 0;
|
|
}
|
|
a.dp = a.nd;
|
|
trim(a);
|
|
};
|
|
decimal.prototype.Assign = function(v) { return this.$val.Assign(v); };
|
|
rightShift = function(a, k) {
|
|
var a, c, c$1, dig, dig$1, k, mask, n, r, w, x, x$1, x$2, x$3, y, y$1, y$2, y$3, y$4;
|
|
r = 0;
|
|
w = 0;
|
|
n = 0;
|
|
while (true) {
|
|
if (!(((y = k, y < 32 ? (n >>> y) : 0) >>> 0) === 0)) { break; }
|
|
if (r >= a.nd) {
|
|
if (n === 0) {
|
|
a.nd = 0;
|
|
return;
|
|
}
|
|
while (true) {
|
|
if (!(((y$1 = k, y$1 < 32 ? (n >>> y$1) : 0) >>> 0) === 0)) { break; }
|
|
n = n * 10 >>> 0;
|
|
r = r + (1) >> 0;
|
|
}
|
|
break;
|
|
}
|
|
c = (((x = a.d, ((r < 0 || r >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[r])) >>> 0));
|
|
n = ((n * 10 >>> 0) + c >>> 0) - 48 >>> 0;
|
|
r = r + (1) >> 0;
|
|
}
|
|
a.dp = a.dp - ((r - 1 >> 0)) >> 0;
|
|
mask = (((y$2 = k, y$2 < 32 ? (1 << y$2) : 0) >>> 0)) - 1 >>> 0;
|
|
while (true) {
|
|
if (!(r < a.nd)) { break; }
|
|
c$1 = (((x$1 = a.d, ((r < 0 || r >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[r])) >>> 0));
|
|
dig = (y$3 = k, y$3 < 32 ? (n >>> y$3) : 0) >>> 0;
|
|
n = (n & (mask)) >>> 0;
|
|
(x$2 = a.d, ((w < 0 || w >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[w] = (((dig + 48 >>> 0) << 24 >>> 24))));
|
|
w = w + (1) >> 0;
|
|
n = ((n * 10 >>> 0) + c$1 >>> 0) - 48 >>> 0;
|
|
r = r + (1) >> 0;
|
|
}
|
|
while (true) {
|
|
if (!(n > 0)) { break; }
|
|
dig$1 = (y$4 = k, y$4 < 32 ? (n >>> y$4) : 0) >>> 0;
|
|
n = (n & (mask)) >>> 0;
|
|
if (w < 800) {
|
|
(x$3 = a.d, ((w < 0 || w >= x$3.length) ? ($throwRuntimeError("index out of range"), undefined) : x$3[w] = (((dig$1 + 48 >>> 0) << 24 >>> 24))));
|
|
w = w + (1) >> 0;
|
|
} else if (dig$1 > 0) {
|
|
a.trunc = true;
|
|
}
|
|
n = n * 10 >>> 0;
|
|
}
|
|
a.nd = w;
|
|
trim(a);
|
|
};
|
|
prefixIsLessThan = function(b, s) {
|
|
var b, i, s;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (i >= b.$length) {
|
|
return true;
|
|
}
|
|
if (!((((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i]) === s.charCodeAt(i)))) {
|
|
return ((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i]) < s.charCodeAt(i);
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return false;
|
|
};
|
|
leftShift = function(a, k) {
|
|
var _q, _q$1, a, delta, k, n, quo, quo$1, r, rem, rem$1, w, x, x$1, x$2, y;
|
|
delta = ((k < 0 || k >= leftcheats.$length) ? ($throwRuntimeError("index out of range"), undefined) : leftcheats.$array[leftcheats.$offset + k]).delta;
|
|
if (prefixIsLessThan($subslice(new sliceType$6(a.d), 0, a.nd), ((k < 0 || k >= leftcheats.$length) ? ($throwRuntimeError("index out of range"), undefined) : leftcheats.$array[leftcheats.$offset + k]).cutoff)) {
|
|
delta = delta - (1) >> 0;
|
|
}
|
|
r = a.nd;
|
|
w = a.nd + delta >> 0;
|
|
n = 0;
|
|
r = r - (1) >> 0;
|
|
while (true) {
|
|
if (!(r >= 0)) { break; }
|
|
n = n + (((y = k, y < 32 ? ((((((x = a.d, ((r < 0 || r >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[r])) >>> 0)) - 48 >>> 0)) << y) : 0) >>> 0)) >>> 0;
|
|
quo = (_q = n / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
rem = n - (10 * quo >>> 0) >>> 0;
|
|
w = w - (1) >> 0;
|
|
if (w < 800) {
|
|
(x$1 = a.d, ((w < 0 || w >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[w] = (((rem + 48 >>> 0) << 24 >>> 24))));
|
|
} else if (!((rem === 0))) {
|
|
a.trunc = true;
|
|
}
|
|
n = quo;
|
|
r = r - (1) >> 0;
|
|
}
|
|
while (true) {
|
|
if (!(n > 0)) { break; }
|
|
quo$1 = (_q$1 = n / 10, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
rem$1 = n - (10 * quo$1 >>> 0) >>> 0;
|
|
w = w - (1) >> 0;
|
|
if (w < 800) {
|
|
(x$2 = a.d, ((w < 0 || w >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[w] = (((rem$1 + 48 >>> 0) << 24 >>> 24))));
|
|
} else if (!((rem$1 === 0))) {
|
|
a.trunc = true;
|
|
}
|
|
n = quo$1;
|
|
}
|
|
a.nd = a.nd + (delta) >> 0;
|
|
if (a.nd >= 800) {
|
|
a.nd = 800;
|
|
}
|
|
a.dp = a.dp + (delta) >> 0;
|
|
trim(a);
|
|
};
|
|
decimal.ptr.prototype.Shift = function(k) {
|
|
var a, k;
|
|
a = this;
|
|
if ((a.nd === 0)) {
|
|
} else if (k > 0) {
|
|
while (true) {
|
|
if (!(k > 28)) { break; }
|
|
leftShift(a, 28);
|
|
k = k - (28) >> 0;
|
|
}
|
|
leftShift(a, ((k >>> 0)));
|
|
} else if (k < 0) {
|
|
while (true) {
|
|
if (!(k < -28)) { break; }
|
|
rightShift(a, 28);
|
|
k = k + (28) >> 0;
|
|
}
|
|
rightShift(a, ((-k >>> 0)));
|
|
}
|
|
};
|
|
decimal.prototype.Shift = function(k) { return this.$val.Shift(k); };
|
|
shouldRoundUp = function(a, nd) {
|
|
var _r, a, nd, x, x$1, x$2, x$3;
|
|
if (nd < 0 || nd >= a.nd) {
|
|
return false;
|
|
}
|
|
if (((x = a.d, ((nd < 0 || nd >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[nd])) === 53) && ((nd + 1 >> 0) === a.nd)) {
|
|
if (a.trunc) {
|
|
return true;
|
|
}
|
|
return nd > 0 && !(((_r = (((x$1 = a.d, x$2 = nd - 1 >> 0, ((x$2 < 0 || x$2 >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[x$2])) - 48 << 24 >>> 24)) % 2, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0));
|
|
}
|
|
return (x$3 = a.d, ((nd < 0 || nd >= x$3.length) ? ($throwRuntimeError("index out of range"), undefined) : x$3[nd])) >= 53;
|
|
};
|
|
decimal.ptr.prototype.Round = function(nd) {
|
|
var a, nd;
|
|
a = this;
|
|
if (nd < 0 || nd >= a.nd) {
|
|
return;
|
|
}
|
|
if (shouldRoundUp(a, nd)) {
|
|
a.RoundUp(nd);
|
|
} else {
|
|
a.RoundDown(nd);
|
|
}
|
|
};
|
|
decimal.prototype.Round = function(nd) { return this.$val.Round(nd); };
|
|
decimal.ptr.prototype.RoundDown = function(nd) {
|
|
var a, nd;
|
|
a = this;
|
|
if (nd < 0 || nd >= a.nd) {
|
|
return;
|
|
}
|
|
a.nd = nd;
|
|
trim(a);
|
|
};
|
|
decimal.prototype.RoundDown = function(nd) { return this.$val.RoundDown(nd); };
|
|
decimal.ptr.prototype.RoundUp = function(nd) {
|
|
var a, c, i, nd, x, x$1, x$2;
|
|
a = this;
|
|
if (nd < 0 || nd >= a.nd) {
|
|
return;
|
|
}
|
|
i = nd - 1 >> 0;
|
|
while (true) {
|
|
if (!(i >= 0)) { break; }
|
|
c = (x = a.d, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i]));
|
|
if (c < 57) {
|
|
(x$2 = a.d, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i] = ((x$1 = a.d, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i])) + (1) << 24 >>> 24)));
|
|
a.nd = i + 1 >> 0;
|
|
return;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
a.d[0] = 49;
|
|
a.nd = 1;
|
|
a.dp = a.dp + (1) >> 0;
|
|
};
|
|
decimal.prototype.RoundUp = function(nd) { return this.$val.RoundUp(nd); };
|
|
decimal.ptr.prototype.RoundedInteger = function() {
|
|
var a, i, n, x, x$1, x$2, x$3;
|
|
a = this;
|
|
if (a.dp > 20) {
|
|
return new $Uint64(4294967295, 4294967295);
|
|
}
|
|
i = 0;
|
|
n = new $Uint64(0, 0);
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < a.dp && i < a.nd)) { break; }
|
|
n = (x = $mul64(n, new $Uint64(0, 10)), x$1 = (new $Uint64(0, ((x$2 = a.d, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i])) - 48 << 24 >>> 24))), new $Uint64(x.$high + x$1.$high, x.$low + x$1.$low));
|
|
i = i + (1) >> 0;
|
|
}
|
|
while (true) {
|
|
if (!(i < a.dp)) { break; }
|
|
n = $mul64(n, (new $Uint64(0, 10)));
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (shouldRoundUp(a, a.dp)) {
|
|
n = (x$3 = new $Uint64(0, 1), new $Uint64(n.$high + x$3.$high, n.$low + x$3.$low));
|
|
}
|
|
return n;
|
|
};
|
|
decimal.prototype.RoundedInteger = function() { return this.$val.RoundedInteger(); };
|
|
extFloat.ptr.prototype.AssignComputeBounds = function(mant, exp, neg, flt) {
|
|
var _tmp, _tmp$1, exp, expBiased, f, flt, lower, mant, neg, upper, x, x$1, x$2, x$3, x$4;
|
|
lower = new extFloat.ptr(new $Uint64(0, 0), 0, false);
|
|
upper = new extFloat.ptr(new $Uint64(0, 0), 0, false);
|
|
f = this;
|
|
f.mant = mant;
|
|
f.exp = exp - ((flt.mantbits >> 0)) >> 0;
|
|
f.neg = neg;
|
|
if (f.exp <= 0 && (x = $shiftLeft64(($shiftRightUint64(mant, ((-f.exp >>> 0)))), ((-f.exp >>> 0))), (mant.$high === x.$high && mant.$low === x.$low))) {
|
|
f.mant = $shiftRightUint64(f.mant, (((-f.exp >>> 0))));
|
|
f.exp = 0;
|
|
_tmp = $clone(f, extFloat);
|
|
_tmp$1 = $clone(f, extFloat);
|
|
extFloat.copy(lower, _tmp);
|
|
extFloat.copy(upper, _tmp$1);
|
|
return [lower, upper];
|
|
}
|
|
expBiased = exp - flt.bias >> 0;
|
|
extFloat.copy(upper, new extFloat.ptr((x$1 = $mul64(new $Uint64(0, 2), f.mant), new $Uint64(x$1.$high + 0, x$1.$low + 1)), f.exp - 1 >> 0, f.neg));
|
|
if (!((x$2 = $shiftLeft64(new $Uint64(0, 1), flt.mantbits), (mant.$high === x$2.$high && mant.$low === x$2.$low))) || (expBiased === 1)) {
|
|
extFloat.copy(lower, new extFloat.ptr((x$3 = $mul64(new $Uint64(0, 2), f.mant), new $Uint64(x$3.$high - 0, x$3.$low - 1)), f.exp - 1 >> 0, f.neg));
|
|
} else {
|
|
extFloat.copy(lower, new extFloat.ptr((x$4 = $mul64(new $Uint64(0, 4), f.mant), new $Uint64(x$4.$high - 0, x$4.$low - 1)), f.exp - 2 >> 0, f.neg));
|
|
}
|
|
return [lower, upper];
|
|
};
|
|
extFloat.prototype.AssignComputeBounds = function(mant, exp, neg, flt) { return this.$val.AssignComputeBounds(mant, exp, neg, flt); };
|
|
extFloat.ptr.prototype.Normalize = function() {
|
|
var f, shift, x;
|
|
f = this;
|
|
if ((x = f.mant, (x.$high === 0 && x.$low === 0))) {
|
|
return 0;
|
|
}
|
|
shift = bits.LeadingZeros64(f.mant);
|
|
f.mant = $shiftLeft64(f.mant, (((shift >>> 0))));
|
|
f.exp = f.exp - (shift) >> 0;
|
|
return ((shift >>> 0));
|
|
};
|
|
extFloat.prototype.Normalize = function() { return this.$val.Normalize(); };
|
|
extFloat.ptr.prototype.Multiply = function(g) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, cross1, cross2, f, fhi, flo, g, ghi, glo, rem, x, x$1, x$10, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
f = this;
|
|
_tmp = $shiftRightUint64(f.mant, 32);
|
|
_tmp$1 = (new $Uint64(0, ((f.mant.$low >>> 0))));
|
|
fhi = _tmp;
|
|
flo = _tmp$1;
|
|
_tmp$2 = $shiftRightUint64(g.mant, 32);
|
|
_tmp$3 = (new $Uint64(0, ((g.mant.$low >>> 0))));
|
|
ghi = _tmp$2;
|
|
glo = _tmp$3;
|
|
cross1 = $mul64(fhi, glo);
|
|
cross2 = $mul64(flo, ghi);
|
|
f.mant = (x = (x$1 = $mul64(fhi, ghi), x$2 = $shiftRightUint64(cross1, 32), new $Uint64(x$1.$high + x$2.$high, x$1.$low + x$2.$low)), x$3 = $shiftRightUint64(cross2, 32), new $Uint64(x.$high + x$3.$high, x.$low + x$3.$low));
|
|
rem = (x$4 = (x$5 = (new $Uint64(0, ((cross1.$low >>> 0)))), x$6 = (new $Uint64(0, ((cross2.$low >>> 0)))), new $Uint64(x$5.$high + x$6.$high, x$5.$low + x$6.$low)), x$7 = $shiftRightUint64(($mul64(flo, glo)), 32), new $Uint64(x$4.$high + x$7.$high, x$4.$low + x$7.$low));
|
|
rem = (x$8 = new $Uint64(0, 2147483648), new $Uint64(rem.$high + x$8.$high, rem.$low + x$8.$low));
|
|
f.mant = (x$9 = f.mant, x$10 = ($shiftRightUint64(rem, 32)), new $Uint64(x$9.$high + x$10.$high, x$9.$low + x$10.$low));
|
|
f.exp = (f.exp + g.exp >> 0) + 64 >> 0;
|
|
};
|
|
extFloat.prototype.Multiply = function(g) { return this.$val.Multiply(g); };
|
|
extFloat.ptr.prototype.AssignDecimal = function(mantissa, exp10, neg, trunc, flt) {
|
|
var _q, _r, adjExp, denormalExp, errors$1, exp10, extrabits, f, flt, halfway, i, mant_extra, mantissa, neg, ok, shift, trunc, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, y;
|
|
ok = false;
|
|
f = this;
|
|
errors$1 = 0;
|
|
if (trunc) {
|
|
errors$1 = errors$1 + (4) >> 0;
|
|
}
|
|
f.mant = mantissa;
|
|
f.exp = 0;
|
|
f.neg = neg;
|
|
i = (_q = ((exp10 - -348 >> 0)) / 8, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
if (exp10 < -348 || i >= 87) {
|
|
ok = false;
|
|
return ok;
|
|
}
|
|
adjExp = (_r = ((exp10 - -348 >> 0)) % 8, _r === _r ? _r : $throwRuntimeError("integer divide by zero"));
|
|
if (adjExp < 19 && (x = (x$1 = 19 - adjExp >> 0, ((x$1 < 0 || x$1 >= uint64pow10.length) ? ($throwRuntimeError("index out of range"), undefined) : uint64pow10[x$1])), (mantissa.$high < x.$high || (mantissa.$high === x.$high && mantissa.$low < x.$low)))) {
|
|
f.mant = $mul64(f.mant, (((adjExp < 0 || adjExp >= uint64pow10.length) ? ($throwRuntimeError("index out of range"), undefined) : uint64pow10[adjExp])));
|
|
f.Normalize();
|
|
} else {
|
|
f.Normalize();
|
|
f.Multiply($clone(((adjExp < 0 || adjExp >= smallPowersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : smallPowersOfTen[adjExp]), extFloat));
|
|
errors$1 = errors$1 + (4) >> 0;
|
|
}
|
|
f.Multiply($clone(((i < 0 || i >= powersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : powersOfTen[i]), extFloat));
|
|
if (errors$1 > 0) {
|
|
errors$1 = errors$1 + (1) >> 0;
|
|
}
|
|
errors$1 = errors$1 + (4) >> 0;
|
|
shift = f.Normalize();
|
|
errors$1 = (y = (shift), y < 32 ? (errors$1 << y) : 0) >> 0;
|
|
denormalExp = flt.bias - 63 >> 0;
|
|
extrabits = 0;
|
|
if (f.exp <= denormalExp) {
|
|
extrabits = ((63 - flt.mantbits >>> 0) + 1 >>> 0) + (((denormalExp - f.exp >> 0) >>> 0)) >>> 0;
|
|
} else {
|
|
extrabits = 63 - flt.mantbits >>> 0;
|
|
}
|
|
halfway = $shiftLeft64(new $Uint64(0, 1), ((extrabits - 1 >>> 0)));
|
|
mant_extra = (x$2 = f.mant, x$3 = (x$4 = $shiftLeft64(new $Uint64(0, 1), extrabits), new $Uint64(x$4.$high - 0, x$4.$low - 1)), new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0));
|
|
if ((x$5 = (x$6 = (new $Int64(halfway.$high, halfway.$low)), x$7 = (new $Int64(0, errors$1)), new $Int64(x$6.$high - x$7.$high, x$6.$low - x$7.$low)), x$8 = (new $Int64(mant_extra.$high, mant_extra.$low)), (x$5.$high < x$8.$high || (x$5.$high === x$8.$high && x$5.$low < x$8.$low))) && (x$9 = (new $Int64(mant_extra.$high, mant_extra.$low)), x$10 = (x$11 = (new $Int64(halfway.$high, halfway.$low)), x$12 = (new $Int64(0, errors$1)), new $Int64(x$11.$high + x$12.$high, x$11.$low + x$12.$low)), (x$9.$high < x$10.$high || (x$9.$high === x$10.$high && x$9.$low < x$10.$low)))) {
|
|
ok = false;
|
|
return ok;
|
|
}
|
|
ok = true;
|
|
return ok;
|
|
};
|
|
extFloat.prototype.AssignDecimal = function(mantissa, exp10, neg, trunc, flt) { return this.$val.AssignDecimal(mantissa, exp10, neg, trunc, flt); };
|
|
extFloat.ptr.prototype.frexp10 = function() {
|
|
var _q, _q$1, _tmp, _tmp$1, approxExp10, exp, exp10, f, i, index;
|
|
exp10 = 0;
|
|
index = 0;
|
|
f = this;
|
|
approxExp10 = (_q = ($imul(((-46 - f.exp >> 0)), 28)) / 93, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
i = (_q$1 = ((approxExp10 - -348 >> 0)) / 8, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
Loop:
|
|
while (true) {
|
|
exp = (f.exp + ((i < 0 || i >= powersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : powersOfTen[i]).exp >> 0) + 64 >> 0;
|
|
if (exp < -60) {
|
|
i = i + (1) >> 0;
|
|
} else if (exp > -32) {
|
|
i = i - (1) >> 0;
|
|
} else {
|
|
break Loop;
|
|
}
|
|
}
|
|
f.Multiply($clone(((i < 0 || i >= powersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : powersOfTen[i]), extFloat));
|
|
_tmp = -((-348 + ($imul(i, 8)) >> 0));
|
|
_tmp$1 = i;
|
|
exp10 = _tmp;
|
|
index = _tmp$1;
|
|
return [exp10, index];
|
|
};
|
|
extFloat.prototype.frexp10 = function() { return this.$val.frexp10(); };
|
|
frexp10Many = function(a, b, c) {
|
|
var _tuple, a, b, c, exp10, i;
|
|
exp10 = 0;
|
|
_tuple = c.frexp10();
|
|
exp10 = _tuple[0];
|
|
i = _tuple[1];
|
|
a.Multiply($clone(((i < 0 || i >= powersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : powersOfTen[i]), extFloat));
|
|
b.Multiply($clone(((i < 0 || i >= powersOfTen.length) ? ($throwRuntimeError("index out of range"), undefined) : powersOfTen[i]), extFloat));
|
|
return exp10;
|
|
};
|
|
extFloat.ptr.prototype.FixedDecimal = function(d, n) {
|
|
var $CE$B5, _q, _q$1, _tmp, _tmp$1, _tuple, buf, d, digit, exp10, f, fraction, i, i$1, i$2, integer, integerDigits, n, nd, needed, ok, pos, pow, pow10, rest, shift, v, v1, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
f = this;
|
|
if ((x = f.mant, (x.$high === 0 && x.$low === 0))) {
|
|
d.nd = 0;
|
|
d.dp = 0;
|
|
d.neg = f.neg;
|
|
return true;
|
|
}
|
|
if (n === 0) {
|
|
$panic(new $String("strconv: internal error: extFloat.FixedDecimal called with n == 0"));
|
|
}
|
|
f.Normalize();
|
|
_tuple = f.frexp10();
|
|
exp10 = _tuple[0];
|
|
shift = ((-f.exp >>> 0));
|
|
integer = (($shiftRightUint64(f.mant, shift).$low >>> 0));
|
|
fraction = (x$1 = f.mant, x$2 = $shiftLeft64((new $Uint64(0, integer)), shift), new $Uint64(x$1.$high - x$2.$high, x$1.$low - x$2.$low));
|
|
$CE$B5 = new $Uint64(0, 1);
|
|
needed = n;
|
|
integerDigits = 0;
|
|
pow10 = new $Uint64(0, 1);
|
|
_tmp = 0;
|
|
_tmp$1 = new $Uint64(0, 1);
|
|
i = _tmp;
|
|
pow = _tmp$1;
|
|
while (true) {
|
|
if (!(i < 20)) { break; }
|
|
if ((x$3 = (new $Uint64(0, integer)), (pow.$high > x$3.$high || (pow.$high === x$3.$high && pow.$low > x$3.$low)))) {
|
|
integerDigits = i;
|
|
break;
|
|
}
|
|
pow = $mul64(pow, (new $Uint64(0, 10)));
|
|
i = i + (1) >> 0;
|
|
}
|
|
rest = integer;
|
|
if (integerDigits > needed) {
|
|
pow10 = (x$4 = integerDigits - needed >> 0, ((x$4 < 0 || x$4 >= uint64pow10.length) ? ($throwRuntimeError("index out of range"), undefined) : uint64pow10[x$4]));
|
|
integer = (_q = integer / (((pow10.$low >>> 0))), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
rest = rest - (($imul(integer, ((pow10.$low >>> 0))) >>> 0)) >>> 0;
|
|
} else {
|
|
rest = 0;
|
|
}
|
|
buf = arrayType$2.zero();
|
|
pos = 32;
|
|
v = integer;
|
|
while (true) {
|
|
if (!(v > 0)) { break; }
|
|
v1 = (_q$1 = v / 10, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
v = v - (($imul(10, v1) >>> 0)) >>> 0;
|
|
pos = pos - (1) >> 0;
|
|
((pos < 0 || pos >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[pos] = (((v + 48 >>> 0) << 24 >>> 24)));
|
|
v = v1;
|
|
}
|
|
i$1 = pos;
|
|
while (true) {
|
|
if (!(i$1 < 32)) { break; }
|
|
(x$5 = d.d, x$6 = i$1 - pos >> 0, ((x$6 < 0 || x$6 >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + x$6] = ((i$1 < 0 || i$1 >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i$1])));
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
nd = 32 - pos >> 0;
|
|
d.nd = nd;
|
|
d.dp = integerDigits + exp10 >> 0;
|
|
needed = needed - (nd) >> 0;
|
|
if (needed > 0) {
|
|
if (!((rest === 0)) || !((pow10.$high === 0 && pow10.$low === 1))) {
|
|
$panic(new $String("strconv: internal error, rest != 0 but needed > 0"));
|
|
}
|
|
while (true) {
|
|
if (!(needed > 0)) { break; }
|
|
fraction = $mul64(fraction, (new $Uint64(0, 10)));
|
|
$CE$B5 = $mul64($CE$B5, (new $Uint64(0, 10)));
|
|
if ((x$7 = $mul64(new $Uint64(0, 2), $CE$B5), x$8 = $shiftLeft64(new $Uint64(0, 1), shift), (x$7.$high > x$8.$high || (x$7.$high === x$8.$high && x$7.$low > x$8.$low)))) {
|
|
return false;
|
|
}
|
|
digit = $shiftRightUint64(fraction, shift);
|
|
(x$9 = d.d, ((nd < 0 || nd >= x$9.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + nd] = ((new $Uint64(digit.$high + 0, digit.$low + 48).$low << 24 >>> 24))));
|
|
fraction = (x$10 = $shiftLeft64(digit, shift), new $Uint64(fraction.$high - x$10.$high, fraction.$low - x$10.$low));
|
|
nd = nd + (1) >> 0;
|
|
needed = needed - (1) >> 0;
|
|
}
|
|
d.nd = nd;
|
|
}
|
|
ok = adjustLastDigitFixed(d, (x$11 = $shiftLeft64((new $Uint64(0, rest)), shift), new $Uint64(x$11.$high | fraction.$high, (x$11.$low | fraction.$low) >>> 0)), pow10, shift, $CE$B5);
|
|
if (!ok) {
|
|
return false;
|
|
}
|
|
i$2 = d.nd - 1 >> 0;
|
|
while (true) {
|
|
if (!(i$2 >= 0)) { break; }
|
|
if (!(((x$12 = d.d, ((i$2 < 0 || i$2 >= x$12.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$12.$array[x$12.$offset + i$2])) === 48))) {
|
|
d.nd = i$2 + 1 >> 0;
|
|
break;
|
|
}
|
|
i$2 = i$2 - (1) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
extFloat.prototype.FixedDecimal = function(d, n) { return this.$val.FixedDecimal(d, n); };
|
|
adjustLastDigitFixed = function(d, num, den, shift, $CE$B5) {
|
|
var $CE$B5, d, den, i, num, shift, x, x$1, x$10, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
if ((x = $shiftLeft64(den, shift), (num.$high > x.$high || (num.$high === x.$high && num.$low > x.$low)))) {
|
|
$panic(new $String("strconv: num > den<<shift in adjustLastDigitFixed"));
|
|
}
|
|
if ((x$1 = $mul64(new $Uint64(0, 2), $CE$B5), x$2 = $shiftLeft64(den, shift), (x$1.$high > x$2.$high || (x$1.$high === x$2.$high && x$1.$low > x$2.$low)))) {
|
|
$panic(new $String("strconv: \xCE\xB5 > (den<<shift)/2"));
|
|
}
|
|
if ((x$3 = $mul64(new $Uint64(0, 2), (new $Uint64(num.$high + $CE$B5.$high, num.$low + $CE$B5.$low))), x$4 = $shiftLeft64(den, shift), (x$3.$high < x$4.$high || (x$3.$high === x$4.$high && x$3.$low < x$4.$low)))) {
|
|
return true;
|
|
}
|
|
if ((x$5 = $mul64(new $Uint64(0, 2), (new $Uint64(num.$high - $CE$B5.$high, num.$low - $CE$B5.$low))), x$6 = $shiftLeft64(den, shift), (x$5.$high > x$6.$high || (x$5.$high === x$6.$high && x$5.$low > x$6.$low)))) {
|
|
i = d.nd - 1 >> 0;
|
|
while (true) {
|
|
if (!(i >= 0)) { break; }
|
|
if ((x$7 = d.d, ((i < 0 || i >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + i])) === 57) {
|
|
d.nd = d.nd - (1) >> 0;
|
|
} else {
|
|
break;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
if (i < 0) {
|
|
(x$8 = d.d, (0 >= x$8.$length ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + 0] = 49));
|
|
d.nd = 1;
|
|
d.dp = d.dp + (1) >> 0;
|
|
} else {
|
|
(x$10 = d.d, ((i < 0 || i >= x$10.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + i] = ((x$9 = d.d, ((i < 0 || i >= x$9.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + i])) + (1) << 24 >>> 24)));
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
extFloat.ptr.prototype.ShortestDecimal = function(d, lower, upper) {
|
|
var _q, _tmp, _tmp$1, _tmp$2, _tmp$3, allowance, buf, currentDiff, d, digit, digit$1, exp10, f, fraction, i, i$1, i$2, integer, integerDigits, lower, multiplier, n, nd, pow, pow$1, shift, targetDiff, upper, v, v1, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$22, x$23, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
f = this;
|
|
if ((x = f.mant, (x.$high === 0 && x.$low === 0))) {
|
|
d.nd = 0;
|
|
d.dp = 0;
|
|
d.neg = f.neg;
|
|
return true;
|
|
}
|
|
if ((f.exp === 0) && $equal(lower, f, extFloat) && $equal(lower, upper, extFloat)) {
|
|
buf = arrayType$1.zero();
|
|
n = 23;
|
|
v = f.mant;
|
|
while (true) {
|
|
if (!((v.$high > 0 || (v.$high === 0 && v.$low > 0)))) { break; }
|
|
v1 = $div64(v, new $Uint64(0, 10), false);
|
|
v = (x$1 = $mul64(new $Uint64(0, 10), v1), new $Uint64(v.$high - x$1.$high, v.$low - x$1.$low));
|
|
((n < 0 || n >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[n] = ((new $Uint64(v.$high + 0, v.$low + 48).$low << 24 >>> 24)));
|
|
n = n - (1) >> 0;
|
|
v = v1;
|
|
}
|
|
nd = (24 - n >> 0) - 1 >> 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < nd)) { break; }
|
|
(x$3 = d.d, ((i < 0 || i >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + i] = (x$2 = (n + 1 >> 0) + i >> 0, ((x$2 < 0 || x$2 >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[x$2]))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp = nd;
|
|
_tmp$1 = nd;
|
|
d.nd = _tmp;
|
|
d.dp = _tmp$1;
|
|
while (true) {
|
|
if (!(d.nd > 0 && ((x$4 = d.d, x$5 = d.nd - 1 >> 0, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])) === 48))) { break; }
|
|
d.nd = d.nd - (1) >> 0;
|
|
}
|
|
if (d.nd === 0) {
|
|
d.dp = 0;
|
|
}
|
|
d.neg = f.neg;
|
|
return true;
|
|
}
|
|
upper.Normalize();
|
|
if (f.exp > upper.exp) {
|
|
f.mant = $shiftLeft64(f.mant, ((((f.exp - upper.exp >> 0) >>> 0))));
|
|
f.exp = upper.exp;
|
|
}
|
|
if (lower.exp > upper.exp) {
|
|
lower.mant = $shiftLeft64(lower.mant, ((((lower.exp - upper.exp >> 0) >>> 0))));
|
|
lower.exp = upper.exp;
|
|
}
|
|
exp10 = frexp10Many(lower, f, upper);
|
|
upper.mant = (x$6 = upper.mant, x$7 = new $Uint64(0, 1), new $Uint64(x$6.$high + x$7.$high, x$6.$low + x$7.$low));
|
|
lower.mant = (x$8 = lower.mant, x$9 = new $Uint64(0, 1), new $Uint64(x$8.$high - x$9.$high, x$8.$low - x$9.$low));
|
|
shift = ((-upper.exp >>> 0));
|
|
integer = (($shiftRightUint64(upper.mant, shift).$low >>> 0));
|
|
fraction = (x$10 = upper.mant, x$11 = $shiftLeft64((new $Uint64(0, integer)), shift), new $Uint64(x$10.$high - x$11.$high, x$10.$low - x$11.$low));
|
|
allowance = (x$12 = upper.mant, x$13 = lower.mant, new $Uint64(x$12.$high - x$13.$high, x$12.$low - x$13.$low));
|
|
targetDiff = (x$14 = upper.mant, x$15 = f.mant, new $Uint64(x$14.$high - x$15.$high, x$14.$low - x$15.$low));
|
|
integerDigits = 0;
|
|
_tmp$2 = 0;
|
|
_tmp$3 = new $Uint64(0, 1);
|
|
i$1 = _tmp$2;
|
|
pow = _tmp$3;
|
|
while (true) {
|
|
if (!(i$1 < 20)) { break; }
|
|
if ((x$16 = (new $Uint64(0, integer)), (pow.$high > x$16.$high || (pow.$high === x$16.$high && pow.$low > x$16.$low)))) {
|
|
integerDigits = i$1;
|
|
break;
|
|
}
|
|
pow = $mul64(pow, (new $Uint64(0, 10)));
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
i$2 = 0;
|
|
while (true) {
|
|
if (!(i$2 < integerDigits)) { break; }
|
|
pow$1 = (x$17 = (integerDigits - i$2 >> 0) - 1 >> 0, ((x$17 < 0 || x$17 >= uint64pow10.length) ? ($throwRuntimeError("index out of range"), undefined) : uint64pow10[x$17]));
|
|
digit = (_q = integer / ((pow$1.$low >>> 0)), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
(x$18 = d.d, ((i$2 < 0 || i$2 >= x$18.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$18.$array[x$18.$offset + i$2] = (((digit + 48 >>> 0) << 24 >>> 24))));
|
|
integer = integer - (($imul(digit, ((pow$1.$low >>> 0))) >>> 0)) >>> 0;
|
|
currentDiff = (x$19 = $shiftLeft64((new $Uint64(0, integer)), shift), new $Uint64(x$19.$high + fraction.$high, x$19.$low + fraction.$low));
|
|
if ((currentDiff.$high < allowance.$high || (currentDiff.$high === allowance.$high && currentDiff.$low < allowance.$low))) {
|
|
d.nd = i$2 + 1 >> 0;
|
|
d.dp = integerDigits + exp10 >> 0;
|
|
d.neg = f.neg;
|
|
return adjustLastDigit(d, currentDiff, targetDiff, allowance, $shiftLeft64(pow$1, shift), new $Uint64(0, 2));
|
|
}
|
|
i$2 = i$2 + (1) >> 0;
|
|
}
|
|
d.nd = integerDigits;
|
|
d.dp = d.nd + exp10 >> 0;
|
|
d.neg = f.neg;
|
|
digit$1 = 0;
|
|
multiplier = new $Uint64(0, 1);
|
|
while (true) {
|
|
fraction = $mul64(fraction, (new $Uint64(0, 10)));
|
|
multiplier = $mul64(multiplier, (new $Uint64(0, 10)));
|
|
digit$1 = (($shiftRightUint64(fraction, shift).$low >> 0));
|
|
(x$20 = d.d, x$21 = d.nd, ((x$21 < 0 || x$21 >= x$20.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$20.$array[x$20.$offset + x$21] = (((digit$1 + 48 >> 0) << 24 >>> 24))));
|
|
d.nd = d.nd + (1) >> 0;
|
|
fraction = (x$22 = $shiftLeft64((new $Uint64(0, digit$1)), shift), new $Uint64(fraction.$high - x$22.$high, fraction.$low - x$22.$low));
|
|
if ((x$23 = $mul64(allowance, multiplier), (fraction.$high < x$23.$high || (fraction.$high === x$23.$high && fraction.$low < x$23.$low)))) {
|
|
return adjustLastDigit(d, fraction, $mul64(targetDiff, multiplier), $mul64(allowance, multiplier), $shiftLeft64(new $Uint64(0, 1), shift), $mul64(multiplier, new $Uint64(0, 2)));
|
|
}
|
|
}
|
|
};
|
|
extFloat.prototype.ShortestDecimal = function(d, lower, upper) { return this.$val.ShortestDecimal(d, lower, upper); };
|
|
adjustLastDigit = function(d, currentDiff, targetDiff, maxDiff, ulpDecimal, ulpBinary) {
|
|
var _index, currentDiff, d, maxDiff, targetDiff, ulpBinary, ulpDecimal, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
if ((x = $mul64(new $Uint64(0, 2), ulpBinary), (ulpDecimal.$high < x.$high || (ulpDecimal.$high === x.$high && ulpDecimal.$low < x.$low)))) {
|
|
return false;
|
|
}
|
|
while (true) {
|
|
if (!((x$1 = (x$2 = (x$3 = $div64(ulpDecimal, new $Uint64(0, 2), false), new $Uint64(currentDiff.$high + x$3.$high, currentDiff.$low + x$3.$low)), new $Uint64(x$2.$high + ulpBinary.$high, x$2.$low + ulpBinary.$low)), (x$1.$high < targetDiff.$high || (x$1.$high === targetDiff.$high && x$1.$low < targetDiff.$low))))) { break; }
|
|
_index = d.nd - 1 >> 0;
|
|
(x$5 = d.d, ((_index < 0 || _index >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + _index] = ((x$4 = d.d, ((_index < 0 || _index >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + _index])) - (1) << 24 >>> 24)));
|
|
currentDiff = (x$6 = ulpDecimal, new $Uint64(currentDiff.$high + x$6.$high, currentDiff.$low + x$6.$low));
|
|
}
|
|
if ((x$7 = new $Uint64(currentDiff.$high + ulpDecimal.$high, currentDiff.$low + ulpDecimal.$low), x$8 = (x$9 = (x$10 = $div64(ulpDecimal, new $Uint64(0, 2), false), new $Uint64(targetDiff.$high + x$10.$high, targetDiff.$low + x$10.$low)), new $Uint64(x$9.$high + ulpBinary.$high, x$9.$low + ulpBinary.$low)), (x$7.$high < x$8.$high || (x$7.$high === x$8.$high && x$7.$low <= x$8.$low)))) {
|
|
return false;
|
|
}
|
|
if ((currentDiff.$high < ulpBinary.$high || (currentDiff.$high === ulpBinary.$high && currentDiff.$low < ulpBinary.$low)) || (x$11 = new $Uint64(maxDiff.$high - ulpBinary.$high, maxDiff.$low - ulpBinary.$low), (currentDiff.$high > x$11.$high || (currentDiff.$high === x$11.$high && currentDiff.$low > x$11.$low)))) {
|
|
return false;
|
|
}
|
|
if ((d.nd === 1) && ((x$12 = d.d, (0 >= x$12.$length ? ($throwRuntimeError("index out of range"), undefined) : x$12.$array[x$12.$offset + 0])) === 48)) {
|
|
d.nd = 0;
|
|
d.dp = 0;
|
|
}
|
|
return true;
|
|
};
|
|
AppendFloat = function(dst, f, fmt, prec, bitSize) {
|
|
var bitSize, dst, f, fmt, prec;
|
|
return genericFtoa(dst, f, fmt, prec, bitSize);
|
|
};
|
|
$pkg.AppendFloat = AppendFloat;
|
|
genericFtoa = function(dst, val, fmt, prec, bitSize) {
|
|
var _1, _2, _3, _4, _tuple, bitSize, bits$1, buf, buf$1, digits, digs, dst, exp, f, f$1, flt, fmt, lower, mant, neg, ok, prec, s, shortest, upper, val, x, x$1, x$2, x$3, y, y$1;
|
|
bits$1 = new $Uint64(0, 0);
|
|
flt = ptrType$1.nil;
|
|
_1 = bitSize;
|
|
if (_1 === (32)) {
|
|
bits$1 = (new $Uint64(0, math.Float32bits(($fround(val)))));
|
|
flt = float32info;
|
|
} else if (_1 === (64)) {
|
|
bits$1 = math.Float64bits(val);
|
|
flt = float64info;
|
|
} else {
|
|
$panic(new $String("strconv: illegal AppendFloat/FormatFloat bitSize"));
|
|
}
|
|
neg = !((x = $shiftRightUint64(bits$1, ((flt.expbits + flt.mantbits >>> 0))), (x.$high === 0 && x.$low === 0)));
|
|
exp = (($shiftRightUint64(bits$1, flt.mantbits).$low >> 0)) & ((((y = flt.expbits, y < 32 ? (1 << y) : 0) >> 0) - 1 >> 0));
|
|
mant = (x$1 = (x$2 = $shiftLeft64(new $Uint64(0, 1), flt.mantbits), new $Uint64(x$2.$high - 0, x$2.$low - 1)), new $Uint64(bits$1.$high & x$1.$high, (bits$1.$low & x$1.$low) >>> 0));
|
|
_2 = exp;
|
|
if (_2 === ((((y$1 = flt.expbits, y$1 < 32 ? (1 << y$1) : 0) >> 0) - 1 >> 0))) {
|
|
s = "";
|
|
if (!((mant.$high === 0 && mant.$low === 0))) {
|
|
s = "NaN";
|
|
} else if (neg) {
|
|
s = "-Inf";
|
|
} else {
|
|
s = "+Inf";
|
|
}
|
|
return $appendSlice(dst, s);
|
|
} else if (_2 === (0)) {
|
|
exp = exp + (1) >> 0;
|
|
} else {
|
|
mant = (x$3 = $shiftLeft64(new $Uint64(0, 1), flt.mantbits), new $Uint64(mant.$high | x$3.$high, (mant.$low | x$3.$low) >>> 0));
|
|
}
|
|
exp = exp + (flt.bias) >> 0;
|
|
if (fmt === 98) {
|
|
return fmtB(dst, neg, mant, exp, flt);
|
|
}
|
|
if (!optimize) {
|
|
return bigFtoa(dst, prec, fmt, neg, mant, exp, flt);
|
|
}
|
|
digs = new decimalSlice.ptr(sliceType$6.nil, 0, 0, false);
|
|
ok = false;
|
|
shortest = prec < 0;
|
|
if (shortest) {
|
|
f = new extFloat.ptr(new $Uint64(0, 0), 0, false);
|
|
_tuple = f.AssignComputeBounds(mant, exp, neg, flt);
|
|
lower = $clone(_tuple[0], extFloat);
|
|
upper = $clone(_tuple[1], extFloat);
|
|
buf = arrayType$2.zero();
|
|
digs.d = new sliceType$6(buf);
|
|
ok = f.ShortestDecimal(digs, lower, upper);
|
|
if (!ok) {
|
|
return bigFtoa(dst, prec, fmt, neg, mant, exp, flt);
|
|
}
|
|
_3 = fmt;
|
|
if ((_3 === (101)) || (_3 === (69))) {
|
|
prec = max(digs.nd - 1 >> 0, 0);
|
|
} else if (_3 === (102)) {
|
|
prec = max(digs.nd - digs.dp >> 0, 0);
|
|
} else if ((_3 === (103)) || (_3 === (71))) {
|
|
prec = digs.nd;
|
|
}
|
|
} else if (!((fmt === 102))) {
|
|
digits = prec;
|
|
_4 = fmt;
|
|
if ((_4 === (101)) || (_4 === (69))) {
|
|
digits = digits + (1) >> 0;
|
|
} else if ((_4 === (103)) || (_4 === (71))) {
|
|
if (prec === 0) {
|
|
prec = 1;
|
|
}
|
|
digits = prec;
|
|
}
|
|
if (digits <= 15) {
|
|
buf$1 = arrayType$1.zero();
|
|
digs.d = new sliceType$6(buf$1);
|
|
f$1 = new extFloat.ptr(mant, exp - ((flt.mantbits >> 0)) >> 0, neg);
|
|
ok = f$1.FixedDecimal(digs, digits);
|
|
}
|
|
}
|
|
if (!ok) {
|
|
return bigFtoa(dst, prec, fmt, neg, mant, exp, flt);
|
|
}
|
|
return formatDigits(dst, shortest, neg, $clone(digs, decimalSlice), prec, fmt);
|
|
};
|
|
bigFtoa = function(dst, prec, fmt, neg, mant, exp, flt) {
|
|
var _1, _2, d, digs, dst, exp, flt, fmt, mant, neg, prec, shortest;
|
|
d = new decimal.ptr(arrayType.zero(), 0, 0, false, false);
|
|
d.Assign(mant);
|
|
d.Shift(exp - ((flt.mantbits >> 0)) >> 0);
|
|
digs = new decimalSlice.ptr(sliceType$6.nil, 0, 0, false);
|
|
shortest = prec < 0;
|
|
if (shortest) {
|
|
roundShortest(d, mant, exp, flt);
|
|
decimalSlice.copy(digs, new decimalSlice.ptr(new sliceType$6(d.d), d.nd, d.dp, false));
|
|
_1 = fmt;
|
|
if ((_1 === (101)) || (_1 === (69))) {
|
|
prec = digs.nd - 1 >> 0;
|
|
} else if (_1 === (102)) {
|
|
prec = max(digs.nd - digs.dp >> 0, 0);
|
|
} else if ((_1 === (103)) || (_1 === (71))) {
|
|
prec = digs.nd;
|
|
}
|
|
} else {
|
|
_2 = fmt;
|
|
if ((_2 === (101)) || (_2 === (69))) {
|
|
d.Round(prec + 1 >> 0);
|
|
} else if (_2 === (102)) {
|
|
d.Round(d.dp + prec >> 0);
|
|
} else if ((_2 === (103)) || (_2 === (71))) {
|
|
if (prec === 0) {
|
|
prec = 1;
|
|
}
|
|
d.Round(prec);
|
|
}
|
|
decimalSlice.copy(digs, new decimalSlice.ptr(new sliceType$6(d.d), d.nd, d.dp, false));
|
|
}
|
|
return formatDigits(dst, shortest, neg, $clone(digs, decimalSlice), prec, fmt);
|
|
};
|
|
formatDigits = function(dst, shortest, neg, digs, prec, fmt) {
|
|
var _1, digs, dst, eprec, exp, fmt, neg, prec, shortest;
|
|
_1 = fmt;
|
|
if ((_1 === (101)) || (_1 === (69))) {
|
|
return fmtE(dst, neg, $clone(digs, decimalSlice), prec, fmt);
|
|
} else if (_1 === (102)) {
|
|
return fmtF(dst, neg, $clone(digs, decimalSlice), prec);
|
|
} else if ((_1 === (103)) || (_1 === (71))) {
|
|
eprec = prec;
|
|
if (eprec > digs.nd && digs.nd >= digs.dp) {
|
|
eprec = digs.nd;
|
|
}
|
|
if (shortest) {
|
|
eprec = 6;
|
|
}
|
|
exp = digs.dp - 1 >> 0;
|
|
if (exp < -4 || exp >= eprec) {
|
|
if (prec > digs.nd) {
|
|
prec = digs.nd;
|
|
}
|
|
return fmtE(dst, neg, $clone(digs, decimalSlice), prec - 1 >> 0, (fmt + 101 << 24 >>> 24) - 103 << 24 >>> 24);
|
|
}
|
|
if (prec > digs.dp) {
|
|
prec = digs.nd;
|
|
}
|
|
return fmtF(dst, neg, $clone(digs, decimalSlice), max(prec - digs.dp >> 0, 0));
|
|
}
|
|
return $append(dst, 37, fmt);
|
|
};
|
|
roundShortest = function(d, mant, exp, flt) {
|
|
var d, exp, explo, flt, i, inclusive, l, lower, m, mant, mantlo, minexp, okdown, okup, u, upper, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7;
|
|
if ((mant.$high === 0 && mant.$low === 0)) {
|
|
d.nd = 0;
|
|
return;
|
|
}
|
|
minexp = flt.bias + 1 >> 0;
|
|
if (exp > minexp && ($imul(332, ((d.dp - d.nd >> 0)))) >= ($imul(100, ((exp - ((flt.mantbits >> 0)) >> 0))))) {
|
|
return;
|
|
}
|
|
upper = new decimal.ptr(arrayType.zero(), 0, 0, false, false);
|
|
upper.Assign((x = $mul64(mant, new $Uint64(0, 2)), new $Uint64(x.$high + 0, x.$low + 1)));
|
|
upper.Shift((exp - ((flt.mantbits >> 0)) >> 0) - 1 >> 0);
|
|
mantlo = new $Uint64(0, 0);
|
|
explo = 0;
|
|
if ((x$1 = $shiftLeft64(new $Uint64(0, 1), flt.mantbits), (mant.$high > x$1.$high || (mant.$high === x$1.$high && mant.$low > x$1.$low))) || (exp === minexp)) {
|
|
mantlo = new $Uint64(mant.$high - 0, mant.$low - 1);
|
|
explo = exp;
|
|
} else {
|
|
mantlo = (x$2 = $mul64(mant, new $Uint64(0, 2)), new $Uint64(x$2.$high - 0, x$2.$low - 1));
|
|
explo = exp - 1 >> 0;
|
|
}
|
|
lower = new decimal.ptr(arrayType.zero(), 0, 0, false, false);
|
|
lower.Assign((x$3 = $mul64(mantlo, new $Uint64(0, 2)), new $Uint64(x$3.$high + 0, x$3.$low + 1)));
|
|
lower.Shift((explo - ((flt.mantbits >> 0)) >> 0) - 1 >> 0);
|
|
inclusive = (x$4 = $div64(mant, new $Uint64(0, 2), true), (x$4.$high === 0 && x$4.$low === 0));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < d.nd)) { break; }
|
|
l = 48;
|
|
if (i < lower.nd) {
|
|
l = (x$5 = lower.d, ((i < 0 || i >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i]));
|
|
}
|
|
m = (x$6 = d.d, ((i < 0 || i >= x$6.length) ? ($throwRuntimeError("index out of range"), undefined) : x$6[i]));
|
|
u = 48;
|
|
if (i < upper.nd) {
|
|
u = (x$7 = upper.d, ((i < 0 || i >= x$7.length) ? ($throwRuntimeError("index out of range"), undefined) : x$7[i]));
|
|
}
|
|
okdown = !((l === m)) || inclusive && ((i + 1 >> 0) === lower.nd);
|
|
okup = !((m === u)) && (inclusive || (m + 1 << 24 >>> 24) < u || (i + 1 >> 0) < upper.nd);
|
|
if (okdown && okup) {
|
|
d.Round(i + 1 >> 0);
|
|
return;
|
|
} else if (okdown) {
|
|
d.RoundDown(i + 1 >> 0);
|
|
return;
|
|
} else if (okup) {
|
|
d.RoundUp(i + 1 >> 0);
|
|
return;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
};
|
|
fmtE = function(dst, neg, d, prec, fmt) {
|
|
var _q, _q$1, _q$2, _r, _r$1, _r$2, ch, d, dst, exp, fmt, i, m, neg, prec, x;
|
|
if (neg) {
|
|
dst = $append(dst, 45);
|
|
}
|
|
ch = 48;
|
|
if (!((d.nd === 0))) {
|
|
ch = (x = d.d, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
}
|
|
dst = $append(dst, ch);
|
|
if (prec > 0) {
|
|
dst = $append(dst, 46);
|
|
i = 1;
|
|
m = min(d.nd, prec + 1 >> 0);
|
|
if (i < m) {
|
|
dst = $appendSlice(dst, $subslice(d.d, i, m));
|
|
i = m;
|
|
}
|
|
while (true) {
|
|
if (!(i <= prec)) { break; }
|
|
dst = $append(dst, 48);
|
|
i = i + (1) >> 0;
|
|
}
|
|
}
|
|
dst = $append(dst, fmt);
|
|
exp = d.dp - 1 >> 0;
|
|
if (d.nd === 0) {
|
|
exp = 0;
|
|
}
|
|
if (exp < 0) {
|
|
ch = 45;
|
|
exp = -exp;
|
|
} else {
|
|
ch = 43;
|
|
}
|
|
dst = $append(dst, ch);
|
|
if (exp < 10) {
|
|
dst = $append(dst, 48, ((exp << 24 >>> 24)) + 48 << 24 >>> 24);
|
|
} else if (exp < 100) {
|
|
dst = $append(dst, (((_q = exp / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) << 24 >>> 24)) + 48 << 24 >>> 24, (((_r = exp % 10, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) << 24 >>> 24)) + 48 << 24 >>> 24);
|
|
} else {
|
|
dst = $append(dst, (((_q$1 = exp / 100, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero")) << 24 >>> 24)) + 48 << 24 >>> 24, (_r$1 = (((_q$2 = exp / 10, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >> 0 : $throwRuntimeError("integer divide by zero")) << 24 >>> 24)) % 10, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24, (((_r$2 = exp % 10, _r$2 === _r$2 ? _r$2 : $throwRuntimeError("integer divide by zero")) << 24 >>> 24)) + 48 << 24 >>> 24);
|
|
}
|
|
return dst;
|
|
};
|
|
fmtF = function(dst, neg, d, prec) {
|
|
var ch, d, dst, i, j, m, neg, prec, x;
|
|
if (neg) {
|
|
dst = $append(dst, 45);
|
|
}
|
|
if (d.dp > 0) {
|
|
m = min(d.nd, d.dp);
|
|
dst = $appendSlice(dst, $subslice(d.d, 0, m));
|
|
while (true) {
|
|
if (!(m < d.dp)) { break; }
|
|
dst = $append(dst, 48);
|
|
m = m + (1) >> 0;
|
|
}
|
|
} else {
|
|
dst = $append(dst, 48);
|
|
}
|
|
if (prec > 0) {
|
|
dst = $append(dst, 46);
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < prec)) { break; }
|
|
ch = 48;
|
|
j = d.dp + i >> 0;
|
|
if (0 <= j && j < d.nd) {
|
|
ch = (x = d.d, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j]));
|
|
}
|
|
dst = $append(dst, ch);
|
|
i = i + (1) >> 0;
|
|
}
|
|
}
|
|
return dst;
|
|
};
|
|
fmtB = function(dst, neg, mant, exp, flt) {
|
|
var _tuple, _tuple$1, dst, exp, flt, mant, neg;
|
|
if (neg) {
|
|
dst = $append(dst, 45);
|
|
}
|
|
_tuple = formatBits(dst, mant, 10, false, true);
|
|
dst = _tuple[0];
|
|
dst = $append(dst, 112);
|
|
exp = exp - (((flt.mantbits >> 0))) >> 0;
|
|
if (exp >= 0) {
|
|
dst = $append(dst, 43);
|
|
}
|
|
_tuple$1 = formatBits(dst, (new $Uint64(0, exp)), 10, exp < 0, true);
|
|
dst = _tuple$1[0];
|
|
return dst;
|
|
};
|
|
min = function(a, b) {
|
|
var a, b;
|
|
if (a < b) {
|
|
return a;
|
|
}
|
|
return b;
|
|
};
|
|
max = function(a, b) {
|
|
var a, b;
|
|
if (a > b) {
|
|
return a;
|
|
}
|
|
return b;
|
|
};
|
|
FormatUint = function(i, base) {
|
|
var _tuple, base, i, s;
|
|
if (true && (i.$high < 0 || (i.$high === 0 && i.$low < 100)) && (base === 10)) {
|
|
return small(((i.$low >> 0)));
|
|
}
|
|
_tuple = formatBits(sliceType$6.nil, i, base, false, false);
|
|
s = _tuple[1];
|
|
return s;
|
|
};
|
|
$pkg.FormatUint = FormatUint;
|
|
FormatInt = function(i, base) {
|
|
var _tuple, base, i, s;
|
|
if (true && (0 < i.$high || (0 === i.$high && 0 <= i.$low)) && (i.$high < 0 || (i.$high === 0 && i.$low < 100)) && (base === 10)) {
|
|
return small((((i.$low + ((i.$high >> 31) * 4294967296)) >> 0)));
|
|
}
|
|
_tuple = formatBits(sliceType$6.nil, (new $Uint64(i.$high, i.$low)), base, (i.$high < 0 || (i.$high === 0 && i.$low < 0)), false);
|
|
s = _tuple[1];
|
|
return s;
|
|
};
|
|
$pkg.FormatInt = FormatInt;
|
|
Itoa = function(i) {
|
|
var i;
|
|
return FormatInt((new $Int64(0, i)), 10);
|
|
};
|
|
$pkg.Itoa = Itoa;
|
|
small = function(i) {
|
|
var i;
|
|
if (i < 10) {
|
|
return $substring("0123456789abcdefghijklmnopqrstuvwxyz", i, (i + 1 >> 0));
|
|
}
|
|
return $substring("00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899", ($imul(i, 2)), (($imul(i, 2)) + 2 >> 0));
|
|
};
|
|
formatBits = function(dst, u, base, neg, append_) {
|
|
var _q, _q$1, _r, _r$1, a, append_, b, b$1, base, d, dst, i, is, is$1, is$2, j, m, neg, q, q$1, s, shift, u, us, us$1, x, x$1, x$2, x$3, x$4, x$5;
|
|
d = sliceType$6.nil;
|
|
s = "";
|
|
if (base < 2 || base > 36) {
|
|
$panic(new $String("strconv: illegal AppendInt/FormatInt base"));
|
|
}
|
|
a = arrayType$3.zero();
|
|
i = 65;
|
|
if (neg) {
|
|
u = new $Uint64(-u.$high, -u.$low);
|
|
}
|
|
if (base === 10) {
|
|
if (true) {
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 1000000000)))) { break; }
|
|
q = $div64(u, new $Uint64(0, 1000000000), false);
|
|
us = (((x = $mul64(q, new $Uint64(0, 1000000000)), new $Uint64(u.$high - x.$high, u.$low - x.$low)).$low >>> 0));
|
|
j = 4;
|
|
while (true) {
|
|
if (!(j > 0)) { break; }
|
|
is = (_r = us % 100, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) * 2 >>> 0;
|
|
us = (_q = us / (100), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
i = i - (2) >> 0;
|
|
(x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$1] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is + 1 >>> 0))));
|
|
(x$2 = i + 0 >> 0, ((x$2 < 0 || x$2 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$2] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is + 0 >>> 0))));
|
|
j = j - (1) >> 0;
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt(((us * 2 >>> 0) + 1 >>> 0)));
|
|
u = q;
|
|
}
|
|
}
|
|
us$1 = ((u.$low >>> 0));
|
|
while (true) {
|
|
if (!(us$1 >= 100)) { break; }
|
|
is$1 = (_r$1 = us$1 % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) * 2 >>> 0;
|
|
us$1 = (_q$1 = us$1 / (100), (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
i = i - (2) >> 0;
|
|
(x$3 = i + 1 >> 0, ((x$3 < 0 || x$3 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$3] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$1 + 1 >>> 0))));
|
|
(x$4 = i + 0 >> 0, ((x$4 < 0 || x$4 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$4] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$1 + 0 >>> 0))));
|
|
}
|
|
is$2 = us$1 * 2 >>> 0;
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$2 + 1 >>> 0)));
|
|
if (us$1 >= 10) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt(is$2));
|
|
}
|
|
} else if (isPowerOfTwo(base)) {
|
|
shift = (((bits.TrailingZeros(((base >>> 0))) >>> 0)) & 7) >>> 0;
|
|
b = (new $Uint64(0, base));
|
|
m = ((base >>> 0)) - 1 >>> 0;
|
|
while (true) {
|
|
if (!((u.$high > b.$high || (u.$high === b.$high && u.$low >= b.$low)))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((((u.$low >>> 0)) & m) >>> 0)));
|
|
u = $shiftRightUint64(u, (shift));
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((u.$low >>> 0))));
|
|
} else {
|
|
b$1 = (new $Uint64(0, base));
|
|
while (true) {
|
|
if (!((u.$high > b$1.$high || (u.$high === b$1.$high && u.$low >= b$1.$low)))) { break; }
|
|
i = i - (1) >> 0;
|
|
q$1 = $div64(u, b$1, false);
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt((((x$5 = $mul64(q$1, b$1), new $Uint64(u.$high - x$5.$high, u.$low - x$5.$low)).$low >>> 0))));
|
|
u = q$1;
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((u.$low >>> 0))));
|
|
}
|
|
if (neg) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = 45);
|
|
}
|
|
if (append_) {
|
|
d = $appendSlice(dst, $subslice(new sliceType$6(a), i));
|
|
return [d, s];
|
|
}
|
|
s = ($bytesToString($subslice(new sliceType$6(a), i)));
|
|
return [d, s];
|
|
};
|
|
isPowerOfTwo = function(x) {
|
|
var x;
|
|
return (x & ((x - 1 >> 0))) === 0;
|
|
};
|
|
quoteWith = function(s, quote, ASCIIonly, graphicOnly) {
|
|
var ASCIIonly, _q, graphicOnly, quote, s;
|
|
return ($bytesToString(appendQuotedWith($makeSlice(sliceType$6, 0, (_q = ($imul(3, s.length)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"))), s, quote, ASCIIonly, graphicOnly)));
|
|
};
|
|
appendQuotedWith = function(buf, s, quote, ASCIIonly, graphicOnly) {
|
|
var ASCIIonly, _tuple, buf, graphicOnly, quote, r, s, width;
|
|
buf = $append(buf, quote);
|
|
width = 0;
|
|
while (true) {
|
|
if (!(s.length > 0)) { break; }
|
|
r = ((s.charCodeAt(0) >> 0));
|
|
width = 1;
|
|
if (r >= 128) {
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
r = _tuple[0];
|
|
width = _tuple[1];
|
|
}
|
|
if ((width === 1) && (r === 65533)) {
|
|
buf = $appendSlice(buf, "\\x");
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((s.charCodeAt(0) >>> 4 << 24 >>> 24)));
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt(((s.charCodeAt(0) & 15) >>> 0)));
|
|
s = $substring(s, width);
|
|
continue;
|
|
}
|
|
buf = appendEscapedRune(buf, r, quote, ASCIIonly, graphicOnly);
|
|
s = $substring(s, width);
|
|
}
|
|
buf = $append(buf, quote);
|
|
return buf;
|
|
};
|
|
appendQuotedRuneWith = function(buf, r, quote, ASCIIonly, graphicOnly) {
|
|
var ASCIIonly, buf, graphicOnly, quote, r;
|
|
buf = $append(buf, quote);
|
|
if (!utf8.ValidRune(r)) {
|
|
r = 65533;
|
|
}
|
|
buf = appendEscapedRune(buf, r, quote, ASCIIonly, graphicOnly);
|
|
buf = $append(buf, quote);
|
|
return buf;
|
|
};
|
|
appendEscapedRune = function(buf, r, quote, ASCIIonly, graphicOnly) {
|
|
var ASCIIonly, _1, buf, graphicOnly, n, quote, r, runeTmp, s, s$1;
|
|
runeTmp = arrayType$4.zero();
|
|
if ((r === ((quote >> 0))) || (r === 92)) {
|
|
buf = $append(buf, 92);
|
|
buf = $append(buf, ((r << 24 >>> 24)));
|
|
return buf;
|
|
}
|
|
if (ASCIIonly) {
|
|
if (r < 128 && IsPrint(r)) {
|
|
buf = $append(buf, ((r << 24 >>> 24)));
|
|
return buf;
|
|
}
|
|
} else if (IsPrint(r) || graphicOnly && isInGraphicList(r)) {
|
|
n = utf8.EncodeRune(new sliceType$6(runeTmp), r);
|
|
buf = $appendSlice(buf, $subslice(new sliceType$6(runeTmp), 0, n));
|
|
return buf;
|
|
}
|
|
_1 = r;
|
|
if (_1 === (7)) {
|
|
buf = $appendSlice(buf, "\\a");
|
|
} else if (_1 === (8)) {
|
|
buf = $appendSlice(buf, "\\b");
|
|
} else if (_1 === (12)) {
|
|
buf = $appendSlice(buf, "\\f");
|
|
} else if (_1 === (10)) {
|
|
buf = $appendSlice(buf, "\\n");
|
|
} else if (_1 === (13)) {
|
|
buf = $appendSlice(buf, "\\r");
|
|
} else if (_1 === (9)) {
|
|
buf = $appendSlice(buf, "\\t");
|
|
} else if (_1 === (11)) {
|
|
buf = $appendSlice(buf, "\\v");
|
|
} else {
|
|
if (r < 32) {
|
|
buf = $appendSlice(buf, "\\x");
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((((r << 24 >>> 24)) >>> 4 << 24 >>> 24)));
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt(((((r << 24 >>> 24)) & 15) >>> 0)));
|
|
} else if (r > 1114111) {
|
|
r = 65533;
|
|
buf = $appendSlice(buf, "\\u");
|
|
s = 12;
|
|
while (true) {
|
|
if (!(s >= 0)) { break; }
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((((r >> $min(((s >>> 0)), 31)) >> 0) & 15)));
|
|
s = s - (4) >> 0;
|
|
}
|
|
} else if (r < 65536) {
|
|
buf = $appendSlice(buf, "\\u");
|
|
s = 12;
|
|
while (true) {
|
|
if (!(s >= 0)) { break; }
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((((r >> $min(((s >>> 0)), 31)) >> 0) & 15)));
|
|
s = s - (4) >> 0;
|
|
}
|
|
} else {
|
|
buf = $appendSlice(buf, "\\U");
|
|
s$1 = 28;
|
|
while (true) {
|
|
if (!(s$1 >= 0)) { break; }
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((((r >> $min(((s$1 >>> 0)), 31)) >> 0) & 15)));
|
|
s$1 = s$1 - (4) >> 0;
|
|
}
|
|
}
|
|
}
|
|
return buf;
|
|
};
|
|
Quote = function(s) {
|
|
var s;
|
|
return quoteWith(s, 34, false, false);
|
|
};
|
|
$pkg.Quote = Quote;
|
|
AppendQuote = function(dst, s) {
|
|
var dst, s;
|
|
return appendQuotedWith(dst, s, 34, false, false);
|
|
};
|
|
$pkg.AppendQuote = AppendQuote;
|
|
QuoteToASCII = function(s) {
|
|
var s;
|
|
return quoteWith(s, 34, true, false);
|
|
};
|
|
$pkg.QuoteToASCII = QuoteToASCII;
|
|
AppendQuoteToASCII = function(dst, s) {
|
|
var dst, s;
|
|
return appendQuotedWith(dst, s, 34, true, false);
|
|
};
|
|
$pkg.AppendQuoteToASCII = AppendQuoteToASCII;
|
|
AppendQuoteRune = function(dst, r) {
|
|
var dst, r;
|
|
return appendQuotedRuneWith(dst, r, 39, false, false);
|
|
};
|
|
$pkg.AppendQuoteRune = AppendQuoteRune;
|
|
AppendQuoteRuneToASCII = function(dst, r) {
|
|
var dst, r;
|
|
return appendQuotedRuneWith(dst, r, 39, true, false);
|
|
};
|
|
$pkg.AppendQuoteRuneToASCII = AppendQuoteRuneToASCII;
|
|
CanBackquote = function(s) {
|
|
var _tuple, r, s, wid;
|
|
while (true) {
|
|
if (!(s.length > 0)) { break; }
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
r = _tuple[0];
|
|
wid = _tuple[1];
|
|
s = $substring(s, wid);
|
|
if (wid > 1) {
|
|
if (r === 65279) {
|
|
return false;
|
|
}
|
|
continue;
|
|
}
|
|
if (r === 65533) {
|
|
return false;
|
|
}
|
|
if ((r < 32 && !((r === 9))) || (r === 96) || (r === 127)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
$pkg.CanBackquote = CanBackquote;
|
|
unhex = function(b) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, b, c, ok, v;
|
|
v = 0;
|
|
ok = false;
|
|
c = ((b >> 0));
|
|
if (48 <= c && c <= 57) {
|
|
_tmp = c - 48 >> 0;
|
|
_tmp$1 = true;
|
|
v = _tmp;
|
|
ok = _tmp$1;
|
|
return [v, ok];
|
|
} else if (97 <= c && c <= 102) {
|
|
_tmp$2 = (c - 97 >> 0) + 10 >> 0;
|
|
_tmp$3 = true;
|
|
v = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [v, ok];
|
|
} else if (65 <= c && c <= 70) {
|
|
_tmp$4 = (c - 65 >> 0) + 10 >> 0;
|
|
_tmp$5 = true;
|
|
v = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [v, ok];
|
|
}
|
|
return [v, ok];
|
|
};
|
|
UnquoteChar = function(s, quote) {
|
|
var _1, _2, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, _tuple$1, c, c$1, err, j, j$1, multibyte, n, ok, quote, r, s, size, tail, v, v$1, value, x, x$1;
|
|
value = 0;
|
|
multibyte = false;
|
|
tail = "";
|
|
err = $ifaceNil;
|
|
if (s.length === 0) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
c = s.charCodeAt(0);
|
|
if ((c === quote) && ((quote === 39) || (quote === 34))) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
} else if (c >= 128) {
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
r = _tuple[0];
|
|
size = _tuple[1];
|
|
_tmp = r;
|
|
_tmp$1 = true;
|
|
_tmp$2 = $substring(s, size);
|
|
_tmp$3 = $ifaceNil;
|
|
value = _tmp;
|
|
multibyte = _tmp$1;
|
|
tail = _tmp$2;
|
|
err = _tmp$3;
|
|
return [value, multibyte, tail, err];
|
|
} else if (!((c === 92))) {
|
|
_tmp$4 = ((s.charCodeAt(0) >> 0));
|
|
_tmp$5 = false;
|
|
_tmp$6 = $substring(s, 1);
|
|
_tmp$7 = $ifaceNil;
|
|
value = _tmp$4;
|
|
multibyte = _tmp$5;
|
|
tail = _tmp$6;
|
|
err = _tmp$7;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
if (s.length <= 1) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
c$1 = s.charCodeAt(1);
|
|
s = $substring(s, 2);
|
|
switch (0) { default:
|
|
_1 = c$1;
|
|
if (_1 === (97)) {
|
|
value = 7;
|
|
} else if (_1 === (98)) {
|
|
value = 8;
|
|
} else if (_1 === (102)) {
|
|
value = 12;
|
|
} else if (_1 === (110)) {
|
|
value = 10;
|
|
} else if (_1 === (114)) {
|
|
value = 13;
|
|
} else if (_1 === (116)) {
|
|
value = 9;
|
|
} else if (_1 === (118)) {
|
|
value = 11;
|
|
} else if ((_1 === (120)) || (_1 === (117)) || (_1 === (85))) {
|
|
n = 0;
|
|
_2 = c$1;
|
|
if (_2 === (120)) {
|
|
n = 2;
|
|
} else if (_2 === (117)) {
|
|
n = 4;
|
|
} else if (_2 === (85)) {
|
|
n = 8;
|
|
}
|
|
v = 0;
|
|
if (s.length < n) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
j = 0;
|
|
while (true) {
|
|
if (!(j < n)) { break; }
|
|
_tuple$1 = unhex(s.charCodeAt(j));
|
|
x = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
if (!ok) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
v = (v << 4 >> 0) | x;
|
|
j = j + (1) >> 0;
|
|
}
|
|
s = $substring(s, n);
|
|
if (c$1 === 120) {
|
|
value = v;
|
|
break;
|
|
}
|
|
if (v > 1114111) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
value = v;
|
|
multibyte = true;
|
|
} else if ((_1 === (48)) || (_1 === (49)) || (_1 === (50)) || (_1 === (51)) || (_1 === (52)) || (_1 === (53)) || (_1 === (54)) || (_1 === (55))) {
|
|
v$1 = ((c$1 >> 0)) - 48 >> 0;
|
|
if (s.length < 2) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
j$1 = 0;
|
|
while (true) {
|
|
if (!(j$1 < 2)) { break; }
|
|
x$1 = ((s.charCodeAt(j$1) >> 0)) - 48 >> 0;
|
|
if (x$1 < 0 || x$1 > 7) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
v$1 = ((v$1 << 3 >> 0)) | x$1;
|
|
j$1 = j$1 + (1) >> 0;
|
|
}
|
|
s = $substring(s, 2);
|
|
if (v$1 > 255) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
value = v$1;
|
|
} else if (_1 === (92)) {
|
|
value = 92;
|
|
} else if ((_1 === (39)) || (_1 === (34))) {
|
|
if (!((c$1 === quote))) {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
value = ((c$1 >> 0));
|
|
} else {
|
|
err = $pkg.ErrSyntax;
|
|
return [value, multibyte, tail, err];
|
|
}
|
|
}
|
|
tail = s;
|
|
return [value, multibyte, tail, err];
|
|
};
|
|
$pkg.UnquoteChar = UnquoteChar;
|
|
Unquote = function(s) {
|
|
var _1, _q, _tuple, _tuple$1, buf, buf$1, c, err, i, multibyte, n, n$1, quote, r, runeTmp, s, size, ss;
|
|
n = s.length;
|
|
if (n < 2) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
quote = s.charCodeAt(0);
|
|
if (!((quote === s.charCodeAt((n - 1 >> 0))))) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
s = $substring(s, 1, (n - 1 >> 0));
|
|
if (quote === 96) {
|
|
if (contains(s, 96)) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
if (contains(s, 13)) {
|
|
buf = $makeSlice(sliceType$6, 0, (s.length - 1 >> 0));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (!((s.charCodeAt(i) === 13))) {
|
|
buf = $append(buf, s.charCodeAt(i));
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return [($bytesToString(buf)), $ifaceNil];
|
|
}
|
|
return [s, $ifaceNil];
|
|
}
|
|
if (!((quote === 34)) && !((quote === 39))) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
if (contains(s, 10)) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
if (!contains(s, 92) && !contains(s, quote)) {
|
|
_1 = quote;
|
|
if (_1 === (34)) {
|
|
if (utf8.ValidString(s)) {
|
|
return [s, $ifaceNil];
|
|
}
|
|
} else if (_1 === (39)) {
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
r = _tuple[0];
|
|
size = _tuple[1];
|
|
if ((size === s.length) && (!((r === 65533)) || !((size === 1)))) {
|
|
return [s, $ifaceNil];
|
|
}
|
|
}
|
|
}
|
|
runeTmp = arrayType$4.zero();
|
|
buf$1 = $makeSlice(sliceType$6, 0, (_q = ($imul(3, s.length)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")));
|
|
while (true) {
|
|
if (!(s.length > 0)) { break; }
|
|
_tuple$1 = UnquoteChar(s, quote);
|
|
c = _tuple$1[0];
|
|
multibyte = _tuple$1[1];
|
|
ss = _tuple$1[2];
|
|
err = _tuple$1[3];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return ["", err];
|
|
}
|
|
s = ss;
|
|
if (c < 128 || !multibyte) {
|
|
buf$1 = $append(buf$1, ((c << 24 >>> 24)));
|
|
} else {
|
|
n$1 = utf8.EncodeRune(new sliceType$6(runeTmp), c);
|
|
buf$1 = $appendSlice(buf$1, $subslice(new sliceType$6(runeTmp), 0, n$1));
|
|
}
|
|
if ((quote === 39) && !((s.length === 0))) {
|
|
return ["", $pkg.ErrSyntax];
|
|
}
|
|
}
|
|
return [($bytesToString(buf$1)), $ifaceNil];
|
|
};
|
|
$pkg.Unquote = Unquote;
|
|
contains = function(s, c) {
|
|
var c, s;
|
|
return !((bytealg.IndexByteString(s, c) === -1));
|
|
};
|
|
bsearch16 = function(a, x) {
|
|
var _q, _tmp, _tmp$1, a, h, i, j, x;
|
|
_tmp = 0;
|
|
_tmp$1 = a.$length;
|
|
i = _tmp;
|
|
j = _tmp$1;
|
|
while (true) {
|
|
if (!(i < j)) { break; }
|
|
h = i + (_q = ((j - i >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
if (((h < 0 || h >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + h]) < x) {
|
|
i = h + 1 >> 0;
|
|
} else {
|
|
j = h;
|
|
}
|
|
}
|
|
return i;
|
|
};
|
|
bsearch32 = function(a, x) {
|
|
var _q, _tmp, _tmp$1, a, h, i, j, x;
|
|
_tmp = 0;
|
|
_tmp$1 = a.$length;
|
|
i = _tmp;
|
|
j = _tmp$1;
|
|
while (true) {
|
|
if (!(i < j)) { break; }
|
|
h = i + (_q = ((j - i >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
if (((h < 0 || h >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + h]) < x) {
|
|
i = h + 1 >> 0;
|
|
} else {
|
|
j = h;
|
|
}
|
|
}
|
|
return i;
|
|
};
|
|
IsPrint = function(r) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, i, i$1, isNotPrint, isNotPrint$1, isPrint, isPrint$1, j, j$1, r, rr, rr$1, x, x$1, x$2, x$3;
|
|
if (r <= 255) {
|
|
if (32 <= r && r <= 126) {
|
|
return true;
|
|
}
|
|
if (161 <= r && r <= 255) {
|
|
return !((r === 173));
|
|
}
|
|
return false;
|
|
}
|
|
if (0 <= r && r < 65536) {
|
|
_tmp = ((r << 16 >>> 16));
|
|
_tmp$1 = isPrint16;
|
|
_tmp$2 = isNotPrint16;
|
|
rr = _tmp;
|
|
isPrint = _tmp$1;
|
|
isNotPrint = _tmp$2;
|
|
i = bsearch16(isPrint, rr);
|
|
if (i >= isPrint.$length || rr < (x = (i & ~1) >> 0, ((x < 0 || x >= isPrint.$length) ? ($throwRuntimeError("index out of range"), undefined) : isPrint.$array[isPrint.$offset + x])) || (x$1 = i | 1, ((x$1 < 0 || x$1 >= isPrint.$length) ? ($throwRuntimeError("index out of range"), undefined) : isPrint.$array[isPrint.$offset + x$1])) < rr) {
|
|
return false;
|
|
}
|
|
j = bsearch16(isNotPrint, rr);
|
|
return j >= isNotPrint.$length || !((((j < 0 || j >= isNotPrint.$length) ? ($throwRuntimeError("index out of range"), undefined) : isNotPrint.$array[isNotPrint.$offset + j]) === rr));
|
|
}
|
|
_tmp$3 = ((r >>> 0));
|
|
_tmp$4 = isPrint32;
|
|
_tmp$5 = isNotPrint32;
|
|
rr$1 = _tmp$3;
|
|
isPrint$1 = _tmp$4;
|
|
isNotPrint$1 = _tmp$5;
|
|
i$1 = bsearch32(isPrint$1, rr$1);
|
|
if (i$1 >= isPrint$1.$length || rr$1 < (x$2 = (i$1 & ~1) >> 0, ((x$2 < 0 || x$2 >= isPrint$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : isPrint$1.$array[isPrint$1.$offset + x$2])) || (x$3 = i$1 | 1, ((x$3 < 0 || x$3 >= isPrint$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : isPrint$1.$array[isPrint$1.$offset + x$3])) < rr$1) {
|
|
return false;
|
|
}
|
|
if (r >= 131072) {
|
|
return true;
|
|
}
|
|
r = r - (65536) >> 0;
|
|
j$1 = bsearch16(isNotPrint$1, ((r << 16 >>> 16)));
|
|
return j$1 >= isNotPrint$1.$length || !((((j$1 < 0 || j$1 >= isNotPrint$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : isNotPrint$1.$array[isNotPrint$1.$offset + j$1]) === ((r << 16 >>> 16))));
|
|
};
|
|
$pkg.IsPrint = IsPrint;
|
|
isInGraphicList = function(r) {
|
|
var i, r, rr;
|
|
if (r > 65535) {
|
|
return false;
|
|
}
|
|
rr = ((r << 16 >>> 16));
|
|
i = bsearch16(isGraphic, rr);
|
|
return i < isGraphic.$length && (rr === ((i < 0 || i >= isGraphic.$length) ? ($throwRuntimeError("index out of range"), undefined) : isGraphic.$array[isGraphic.$offset + i]));
|
|
};
|
|
ptrType.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$2.methods = [{prop: "set", name: "set", pkg: "strconv", typ: $funcType([$String], [$Bool], false)}, {prop: "floatBits", name: "floatBits", pkg: "strconv", typ: $funcType([ptrType$1], [$Uint64, $Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Assign", name: "Assign", pkg: "", typ: $funcType([$Uint64], [], false)}, {prop: "Shift", name: "Shift", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "Round", name: "Round", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "RoundDown", name: "RoundDown", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "RoundUp", name: "RoundUp", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "RoundedInteger", name: "RoundedInteger", pkg: "", typ: $funcType([], [$Uint64], false)}];
|
|
ptrType$4.methods = [{prop: "floatBits", name: "floatBits", pkg: "strconv", typ: $funcType([ptrType$1], [$Uint64, $Bool], false)}, {prop: "AssignComputeBounds", name: "AssignComputeBounds", pkg: "", typ: $funcType([$Uint64, $Int, $Bool, ptrType$1], [extFloat, extFloat], false)}, {prop: "Normalize", name: "Normalize", pkg: "", typ: $funcType([], [$Uint], false)}, {prop: "Multiply", name: "Multiply", pkg: "", typ: $funcType([extFloat], [], false)}, {prop: "AssignDecimal", name: "AssignDecimal", pkg: "", typ: $funcType([$Uint64, $Int, $Bool, $Bool, ptrType$1], [$Bool], false)}, {prop: "frexp10", name: "frexp10", pkg: "strconv", typ: $funcType([], [$Int, $Int], false)}, {prop: "FixedDecimal", name: "FixedDecimal", pkg: "", typ: $funcType([ptrType$3, $Int], [$Bool], false)}, {prop: "ShortestDecimal", name: "ShortestDecimal", pkg: "", typ: $funcType([ptrType$3, ptrType$4, ptrType$4], [$Bool], false)}];
|
|
NumError.init("", [{prop: "Func", name: "Func", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Num", name: "Num", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
decimal.init("strconv", [{prop: "d", name: "d", embedded: false, exported: false, typ: arrayType, tag: ""}, {prop: "nd", name: "nd", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "dp", name: "dp", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "neg", name: "neg", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "trunc", name: "trunc", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
leftCheat.init("strconv", [{prop: "delta", name: "delta", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "cutoff", name: "cutoff", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
extFloat.init("strconv", [{prop: "mant", name: "mant", embedded: false, exported: false, typ: $Uint64, tag: ""}, {prop: "exp", name: "exp", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "neg", name: "neg", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
floatInfo.init("strconv", [{prop: "mantbits", name: "mantbits", embedded: false, exported: false, typ: $Uint, tag: ""}, {prop: "expbits", name: "expbits", embedded: false, exported: false, typ: $Uint, tag: ""}, {prop: "bias", name: "bias", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
decimalSlice.init("strconv", [{prop: "d", name: "d", embedded: false, exported: false, typ: sliceType$6, tag: ""}, {prop: "nd", name: "nd", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "dp", name: "dp", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "neg", name: "neg", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bytealg.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bits.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
optimize = true;
|
|
$pkg.ErrRange = errors.New("value out of range");
|
|
$pkg.ErrSyntax = errors.New("invalid syntax");
|
|
leftcheats = new sliceType$3([new leftCheat.ptr(0, ""), new leftCheat.ptr(1, "5"), new leftCheat.ptr(1, "25"), new leftCheat.ptr(1, "125"), new leftCheat.ptr(2, "625"), new leftCheat.ptr(2, "3125"), new leftCheat.ptr(2, "15625"), new leftCheat.ptr(3, "78125"), new leftCheat.ptr(3, "390625"), new leftCheat.ptr(3, "1953125"), new leftCheat.ptr(4, "9765625"), new leftCheat.ptr(4, "48828125"), new leftCheat.ptr(4, "244140625"), new leftCheat.ptr(4, "1220703125"), new leftCheat.ptr(5, "6103515625"), new leftCheat.ptr(5, "30517578125"), new leftCheat.ptr(5, "152587890625"), new leftCheat.ptr(6, "762939453125"), new leftCheat.ptr(6, "3814697265625"), new leftCheat.ptr(6, "19073486328125"), new leftCheat.ptr(7, "95367431640625"), new leftCheat.ptr(7, "476837158203125"), new leftCheat.ptr(7, "2384185791015625"), new leftCheat.ptr(7, "11920928955078125"), new leftCheat.ptr(8, "59604644775390625"), new leftCheat.ptr(8, "298023223876953125"), new leftCheat.ptr(8, "1490116119384765625"), new leftCheat.ptr(9, "7450580596923828125"), new leftCheat.ptr(9, "37252902984619140625"), new leftCheat.ptr(9, "186264514923095703125"), new leftCheat.ptr(10, "931322574615478515625"), new leftCheat.ptr(10, "4656612873077392578125"), new leftCheat.ptr(10, "23283064365386962890625"), new leftCheat.ptr(10, "116415321826934814453125"), new leftCheat.ptr(11, "582076609134674072265625"), new leftCheat.ptr(11, "2910383045673370361328125"), new leftCheat.ptr(11, "14551915228366851806640625"), new leftCheat.ptr(12, "72759576141834259033203125"), new leftCheat.ptr(12, "363797880709171295166015625"), new leftCheat.ptr(12, "1818989403545856475830078125"), new leftCheat.ptr(13, "9094947017729282379150390625"), new leftCheat.ptr(13, "45474735088646411895751953125"), new leftCheat.ptr(13, "227373675443232059478759765625"), new leftCheat.ptr(13, "1136868377216160297393798828125"), new leftCheat.ptr(14, "5684341886080801486968994140625"), new leftCheat.ptr(14, "28421709430404007434844970703125"), new leftCheat.ptr(14, "142108547152020037174224853515625"), new leftCheat.ptr(15, "710542735760100185871124267578125"), new leftCheat.ptr(15, "3552713678800500929355621337890625"), new leftCheat.ptr(15, "17763568394002504646778106689453125"), new leftCheat.ptr(16, "88817841970012523233890533447265625"), new leftCheat.ptr(16, "444089209850062616169452667236328125"), new leftCheat.ptr(16, "2220446049250313080847263336181640625"), new leftCheat.ptr(16, "11102230246251565404236316680908203125"), new leftCheat.ptr(17, "55511151231257827021181583404541015625"), new leftCheat.ptr(17, "277555756156289135105907917022705078125"), new leftCheat.ptr(17, "1387778780781445675529539585113525390625"), new leftCheat.ptr(18, "6938893903907228377647697925567626953125"), new leftCheat.ptr(18, "34694469519536141888238489627838134765625"), new leftCheat.ptr(18, "173472347597680709441192448139190673828125"), new leftCheat.ptr(19, "867361737988403547205962240695953369140625")]);
|
|
smallPowersOfTen = $toNativeArray($kindStruct, [new extFloat.ptr(new $Uint64(2147483648, 0), -63, false), new extFloat.ptr(new $Uint64(2684354560, 0), -60, false), new extFloat.ptr(new $Uint64(3355443200, 0), -57, false), new extFloat.ptr(new $Uint64(4194304000, 0), -54, false), new extFloat.ptr(new $Uint64(2621440000, 0), -50, false), new extFloat.ptr(new $Uint64(3276800000, 0), -47, false), new extFloat.ptr(new $Uint64(4096000000, 0), -44, false), new extFloat.ptr(new $Uint64(2560000000, 0), -40, false)]);
|
|
powersOfTen = $toNativeArray($kindStruct, [new extFloat.ptr(new $Uint64(4203730336, 136053384), -1220, false), new extFloat.ptr(new $Uint64(3132023167, 2722021238), -1193, false), new extFloat.ptr(new $Uint64(2333539104, 810921078), -1166, false), new extFloat.ptr(new $Uint64(3477244234, 1573795306), -1140, false), new extFloat.ptr(new $Uint64(2590748842, 1432697645), -1113, false), new extFloat.ptr(new $Uint64(3860516611, 1025131999), -1087, false), new extFloat.ptr(new $Uint64(2876309015, 3348809418), -1060, false), new extFloat.ptr(new $Uint64(4286034428, 3200048207), -1034, false), new extFloat.ptr(new $Uint64(3193344495, 1097586188), -1007, false), new extFloat.ptr(new $Uint64(2379227053, 2424306748), -980, false), new extFloat.ptr(new $Uint64(3545324584, 827693699), -954, false), new extFloat.ptr(new $Uint64(2641472655, 2913388981), -927, false), new extFloat.ptr(new $Uint64(3936100983, 602835915), -901, false), new extFloat.ptr(new $Uint64(2932623761, 1081627501), -874, false), new extFloat.ptr(new $Uint64(2184974969, 1572261463), -847, false), new extFloat.ptr(new $Uint64(3255866422, 1308317239), -821, false), new extFloat.ptr(new $Uint64(2425809519, 944281679), -794, false), new extFloat.ptr(new $Uint64(3614737867, 629291719), -768, false), new extFloat.ptr(new $Uint64(2693189581, 2545915892), -741, false), new extFloat.ptr(new $Uint64(4013165208, 388672741), -715, false), new extFloat.ptr(new $Uint64(2990041083, 708162190), -688, false), new extFloat.ptr(new $Uint64(2227754207, 3536207675), -661, false), new extFloat.ptr(new $Uint64(3319612455, 450088378), -635, false), new extFloat.ptr(new $Uint64(2473304014, 3139815830), -608, false), new extFloat.ptr(new $Uint64(3685510180, 2103616900), -582, false), new extFloat.ptr(new $Uint64(2745919064, 224385782), -555, false), new extFloat.ptr(new $Uint64(4091738259, 3737383206), -529, false), new extFloat.ptr(new $Uint64(3048582568, 2868871352), -502, false), new extFloat.ptr(new $Uint64(2271371013, 1820084875), -475, false), new extFloat.ptr(new $Uint64(3384606560, 885076051), -449, false), new extFloat.ptr(new $Uint64(2521728396, 2444895829), -422, false), new extFloat.ptr(new $Uint64(3757668132, 1881767613), -396, false), new extFloat.ptr(new $Uint64(2799680927, 3102062735), -369, false), new extFloat.ptr(new $Uint64(4171849679, 2289335700), -343, false), new extFloat.ptr(new $Uint64(3108270227, 2410191823), -316, false), new extFloat.ptr(new $Uint64(2315841784, 3205436779), -289, false), new extFloat.ptr(new $Uint64(3450873173, 1697722806), -263, false), new extFloat.ptr(new $Uint64(2571100870, 3497754540), -236, false), new extFloat.ptr(new $Uint64(3831238852, 707476230), -210, false), new extFloat.ptr(new $Uint64(2854495385, 1769181907), -183, false), new extFloat.ptr(new $Uint64(4253529586, 2197867022), -157, false), new extFloat.ptr(new $Uint64(3169126500, 2450594539), -130, false), new extFloat.ptr(new $Uint64(2361183241, 1867548876), -103, false), new extFloat.ptr(new $Uint64(3518437208, 3793315116), -77, false), new extFloat.ptr(new $Uint64(2621440000, 0), -50, false), new extFloat.ptr(new $Uint64(3906250000, 0), -24, false), new extFloat.ptr(new $Uint64(2910383045, 2892103680), 3, false), new extFloat.ptr(new $Uint64(2168404344, 4170451332), 30, false), new extFloat.ptr(new $Uint64(3231174267, 3372684723), 56, false), new extFloat.ptr(new $Uint64(2407412430, 2078956656), 83, false), new extFloat.ptr(new $Uint64(3587324068, 2884206696), 109, false), new extFloat.ptr(new $Uint64(2672764710, 395977285), 136, false), new extFloat.ptr(new $Uint64(3982729777, 3569679143), 162, false), new extFloat.ptr(new $Uint64(2967364920, 2361961896), 189, false), new extFloat.ptr(new $Uint64(2210859150, 447440347), 216, false), new extFloat.ptr(new $Uint64(3294436857, 1114709402), 242, false), new extFloat.ptr(new $Uint64(2454546732, 2786846552), 269, false), new extFloat.ptr(new $Uint64(3657559652, 443583978), 295, false), new extFloat.ptr(new $Uint64(2725094297, 2599384906), 322, false), new extFloat.ptr(new $Uint64(4060706939, 3028118405), 348, false), new extFloat.ptr(new $Uint64(3025462433, 2044532855), 375, false), new extFloat.ptr(new $Uint64(2254145170, 1536935362), 402, false), new extFloat.ptr(new $Uint64(3358938053, 3365297469), 428, false), new extFloat.ptr(new $Uint64(2502603868, 4204241075), 455, false), new extFloat.ptr(new $Uint64(3729170365, 2577424355), 481, false), new extFloat.ptr(new $Uint64(2778448436, 3677981733), 508, false), new extFloat.ptr(new $Uint64(4140210802, 2744688476), 534, false), new extFloat.ptr(new $Uint64(3084697427, 1424604878), 561, false), new extFloat.ptr(new $Uint64(2298278679, 4062331362), 588, false), new extFloat.ptr(new $Uint64(3424702107, 3546052773), 614, false), new extFloat.ptr(new $Uint64(2551601907, 2065781727), 641, false), new extFloat.ptr(new $Uint64(3802183132, 2535403578), 667, false), new extFloat.ptr(new $Uint64(2832847187, 1558426518), 694, false), new extFloat.ptr(new $Uint64(4221271257, 2762425404), 720, false), new extFloat.ptr(new $Uint64(3145092172, 2812560400), 747, false), new extFloat.ptr(new $Uint64(2343276271, 3057687578), 774, false), new extFloat.ptr(new $Uint64(3491753744, 2790753324), 800, false), new extFloat.ptr(new $Uint64(2601559269, 3918606633), 827, false), new extFloat.ptr(new $Uint64(3876625403, 2711358621), 853, false), new extFloat.ptr(new $Uint64(2888311001, 1648096297), 880, false), new extFloat.ptr(new $Uint64(2151959390, 2057817989), 907, false), new extFloat.ptr(new $Uint64(3206669376, 61660461), 933, false), new extFloat.ptr(new $Uint64(2389154863, 1581580175), 960, false), new extFloat.ptr(new $Uint64(3560118173, 2626467905), 986, false), new extFloat.ptr(new $Uint64(2652494738, 3034782633), 1013, false), new extFloat.ptr(new $Uint64(3952525166, 3135207385), 1039, false), new extFloat.ptr(new $Uint64(2944860731, 2616258155), 1066, false)]);
|
|
uint64pow10 = $toNativeArray($kindUint64, [new $Uint64(0, 1), new $Uint64(0, 10), new $Uint64(0, 100), new $Uint64(0, 1000), new $Uint64(0, 10000), new $Uint64(0, 100000), new $Uint64(0, 1000000), new $Uint64(0, 10000000), new $Uint64(0, 100000000), new $Uint64(0, 1000000000), new $Uint64(2, 1410065408), new $Uint64(23, 1215752192), new $Uint64(232, 3567587328), new $Uint64(2328, 1316134912), new $Uint64(23283, 276447232), new $Uint64(232830, 2764472320), new $Uint64(2328306, 1874919424), new $Uint64(23283064, 1569325056), new $Uint64(232830643, 2808348672), new $Uint64(2328306436, 2313682944)]);
|
|
float32info = new floatInfo.ptr(23, 8, -127);
|
|
float64info = new floatInfo.ptr(52, 11, -1023);
|
|
isPrint16 = new sliceType$4([32, 126, 161, 887, 890, 895, 900, 1366, 1369, 1418, 1421, 1479, 1488, 1514, 1520, 1524, 1542, 1563, 1566, 1805, 1808, 1866, 1869, 1969, 1984, 2042, 2048, 2093, 2096, 2139, 2142, 2154, 2208, 2237, 2260, 2444, 2447, 2448, 2451, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2531, 2534, 2557, 2561, 2570, 2575, 2576, 2579, 2617, 2620, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2654, 2662, 2677, 2689, 2745, 2748, 2765, 2768, 2768, 2784, 2787, 2790, 2801, 2809, 2828, 2831, 2832, 2835, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2915, 2918, 2935, 2946, 2954, 2958, 2965, 2969, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3021, 3024, 3024, 3031, 3031, 3046, 3066, 3072, 3129, 3133, 3149, 3157, 3162, 3168, 3171, 3174, 3183, 3192, 3257, 3260, 3277, 3285, 3286, 3294, 3299, 3302, 3314, 3328, 3407, 3412, 3427, 3430, 3455, 3458, 3478, 3482, 3517, 3520, 3526, 3530, 3530, 3535, 3551, 3558, 3567, 3570, 3572, 3585, 3642, 3647, 3675, 3713, 3716, 3719, 3722, 3725, 3725, 3732, 3751, 3754, 3773, 3776, 3789, 3792, 3801, 3804, 3807, 3840, 3948, 3953, 4058, 4096, 4295, 4301, 4301, 4304, 4685, 4688, 4701, 4704, 4749, 4752, 4789, 4792, 4805, 4808, 4885, 4888, 4954, 4957, 4988, 4992, 5017, 5024, 5109, 5112, 5117, 5120, 5788, 5792, 5880, 5888, 5908, 5920, 5942, 5952, 5971, 5984, 6003, 6016, 6109, 6112, 6121, 6128, 6137, 6144, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6443, 6448, 6459, 6464, 6464, 6468, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6622, 6683, 6686, 6780, 6783, 6793, 6800, 6809, 6816, 6829, 6832, 6846, 6912, 6987, 6992, 7036, 7040, 7155, 7164, 7223, 7227, 7241, 7245, 7304, 7360, 7367, 7376, 7417, 7424, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8061, 8064, 8147, 8150, 8175, 8178, 8190, 8208, 8231, 8240, 8286, 8304, 8305, 8308, 8348, 8352, 8383, 8400, 8432, 8448, 8587, 8592, 9254, 9280, 9290, 9312, 11123, 11126, 11157, 11160, 11193, 11197, 11218, 11244, 11247, 11264, 11507, 11513, 11559, 11565, 11565, 11568, 11623, 11631, 11632, 11647, 11670, 11680, 11849, 11904, 12019, 12032, 12245, 12272, 12283, 12289, 12438, 12441, 12543, 12549, 12590, 12593, 12730, 12736, 12771, 12784, 19893, 19904, 40938, 40960, 42124, 42128, 42182, 42192, 42539, 42560, 42743, 42752, 42935, 42999, 43051, 43056, 43065, 43072, 43127, 43136, 43205, 43214, 43225, 43232, 43261, 43264, 43347, 43359, 43388, 43392, 43481, 43486, 43574, 43584, 43597, 43600, 43609, 43612, 43714, 43739, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43877, 43888, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64449, 64467, 64831, 64848, 64911, 64914, 64967, 65008, 65021, 65024, 65049, 65056, 65131, 65136, 65276, 65281, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65504, 65518, 65532, 65533]);
|
|
isNotPrint16 = new sliceType$4([173, 907, 909, 930, 1328, 1376, 1416, 1424, 1757, 2111, 2143, 2229, 2274, 2436, 2473, 2481, 2526, 2564, 2601, 2609, 2612, 2615, 2621, 2653, 2692, 2702, 2706, 2729, 2737, 2740, 2758, 2762, 2816, 2820, 2857, 2865, 2868, 2910, 2948, 2961, 2971, 2973, 3017, 3076, 3085, 3089, 3113, 3141, 3145, 3159, 3204, 3213, 3217, 3241, 3252, 3269, 3273, 3295, 3312, 3332, 3341, 3345, 3397, 3401, 3460, 3506, 3516, 3541, 3543, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3770, 3781, 3783, 3912, 3992, 4029, 4045, 4294, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, 4881, 5760, 5901, 5997, 6001, 6431, 6751, 7674, 8024, 8026, 8028, 8030, 8117, 8133, 8156, 8181, 8335, 11209, 11311, 11359, 11558, 11687, 11695, 11703, 11711, 11719, 11727, 11735, 11743, 11930, 12352, 12687, 12831, 13055, 42927, 43470, 43519, 43815, 43823, 64311, 64317, 64319, 64322, 64325, 65107, 65127, 65141, 65511]);
|
|
isPrint32 = new sliceType$5([65536, 65613, 65616, 65629, 65664, 65786, 65792, 65794, 65799, 65843, 65847, 65947, 65952, 65952, 66000, 66045, 66176, 66204, 66208, 66256, 66272, 66299, 66304, 66339, 66349, 66378, 66384, 66426, 66432, 66499, 66504, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 66927, 66927, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67640, 67644, 67644, 67647, 67742, 67751, 67759, 67808, 67829, 67835, 67867, 67871, 67897, 67903, 67903, 67968, 68023, 68028, 68047, 68050, 68102, 68108, 68147, 68152, 68154, 68159, 68167, 68176, 68184, 68192, 68255, 68288, 68326, 68331, 68342, 68352, 68405, 68409, 68437, 68440, 68466, 68472, 68497, 68505, 68508, 68521, 68527, 68608, 68680, 68736, 68786, 68800, 68850, 68858, 68863, 69216, 69246, 69632, 69709, 69714, 69743, 69759, 69825, 69840, 69864, 69872, 69881, 69888, 69955, 69968, 70006, 70016, 70093, 70096, 70132, 70144, 70206, 70272, 70313, 70320, 70378, 70384, 70393, 70400, 70412, 70415, 70416, 70419, 70457, 70460, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70749, 70784, 70855, 70864, 70873, 71040, 71093, 71096, 71133, 71168, 71236, 71248, 71257, 71264, 71276, 71296, 71351, 71360, 71369, 71424, 71449, 71453, 71467, 71472, 71487, 71840, 71922, 71935, 71935, 72192, 72263, 72272, 72323, 72326, 72354, 72384, 72440, 72704, 72773, 72784, 72812, 72816, 72847, 72850, 72886, 72960, 73014, 73018, 73031, 73040, 73049, 73728, 74649, 74752, 74868, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92777, 92782, 92783, 92880, 92909, 92912, 92917, 92928, 92997, 93008, 93047, 93053, 93071, 93952, 94020, 94032, 94078, 94095, 94111, 94176, 94177, 94208, 100332, 100352, 101106, 110592, 110878, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113820, 113823, 118784, 119029, 119040, 119078, 119081, 119154, 119163, 119272, 119296, 119365, 119552, 119638, 119648, 119665, 119808, 119967, 119970, 119970, 119973, 119974, 119977, 120074, 120077, 120134, 120138, 120485, 120488, 120779, 120782, 121483, 121499, 121519, 122880, 122904, 122907, 122922, 124928, 125124, 125127, 125142, 125184, 125258, 125264, 125273, 125278, 125279, 126464, 126500, 126503, 126523, 126530, 126530, 126535, 126548, 126551, 126564, 126567, 126619, 126625, 126651, 126704, 126705, 126976, 127019, 127024, 127123, 127136, 127150, 127153, 127221, 127232, 127244, 127248, 127339, 127344, 127404, 127462, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 128724, 128736, 128748, 128752, 128760, 128768, 128883, 128896, 128980, 129024, 129035, 129040, 129095, 129104, 129113, 129120, 129159, 129168, 129197, 129280, 129291, 129296, 129356, 129360, 129387, 129408, 129431, 129472, 129472, 129488, 129510, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999]);
|
|
isNotPrint32 = new sliceType$4([12, 39, 59, 62, 399, 926, 2057, 2102, 2134, 2291, 2564, 2580, 2584, 4285, 4405, 4576, 4626, 4743, 4745, 4750, 4766, 4868, 4905, 4913, 4916, 5210, 5212, 6813, 7177, 7223, 7336, 7431, 7434, 7483, 7486, 9327, 27231, 27482, 27490, 54357, 54429, 54445, 54458, 54460, 54468, 54534, 54549, 54557, 54586, 54591, 54597, 54609, 55968, 57351, 57378, 57381, 60932, 60960, 60963, 60968, 60979, 60984, 60986, 61000, 61002, 61004, 61008, 61011, 61016, 61018, 61020, 61022, 61024, 61027, 61035, 61043, 61048, 61053, 61055, 61066, 61092, 61098, 61632, 61648, 61743, 63807]);
|
|
isGraphic = new sliceType$4([160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288]);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/race"] = (function() {
|
|
var $pkg = {}, $init, Acquire, Release, ReleaseMerge, Disable, Enable, ReadRange, WriteRange;
|
|
Acquire = function(addr) {
|
|
var addr;
|
|
};
|
|
$pkg.Acquire = Acquire;
|
|
Release = function(addr) {
|
|
var addr;
|
|
};
|
|
$pkg.Release = Release;
|
|
ReleaseMerge = function(addr) {
|
|
var addr;
|
|
};
|
|
$pkg.ReleaseMerge = ReleaseMerge;
|
|
Disable = function() {
|
|
};
|
|
$pkg.Disable = Disable;
|
|
Enable = function() {
|
|
};
|
|
$pkg.Enable = Enable;
|
|
ReadRange = function(addr, len) {
|
|
var addr, len;
|
|
};
|
|
$pkg.ReadRange = ReadRange;
|
|
WriteRange = function(addr, len) {
|
|
var addr, len;
|
|
};
|
|
$pkg.WriteRange = WriteRange;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["sync/atomic"] = (function() {
|
|
var $pkg = {}, $init, js, Value, ptrType, CompareAndSwapInt32, CompareAndSwapUint64, AddInt32, AddUint32, LoadInt32, LoadUint32, LoadUint64, StoreInt32, StoreUint32;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
Value = $pkg.Value = $newType(0, $kindStruct, "atomic.Value", true, "sync/atomic", true, function(v_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.v = $ifaceNil;
|
|
return;
|
|
}
|
|
this.v = v_;
|
|
});
|
|
ptrType = $ptrType(Value);
|
|
CompareAndSwapInt32 = function(addr, old, new$1) {
|
|
var addr, new$1, old;
|
|
if (addr.$get() === old) {
|
|
addr.$set(new$1);
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
$pkg.CompareAndSwapInt32 = CompareAndSwapInt32;
|
|
CompareAndSwapUint64 = function(addr, old, new$1) {
|
|
var addr, new$1, old, x;
|
|
if ((x = addr.$get(), (x.$high === old.$high && x.$low === old.$low))) {
|
|
addr.$set(new$1);
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
$pkg.CompareAndSwapUint64 = CompareAndSwapUint64;
|
|
AddInt32 = function(addr, delta) {
|
|
var addr, delta, new$1;
|
|
new$1 = addr.$get() + delta >> 0;
|
|
addr.$set(new$1);
|
|
return new$1;
|
|
};
|
|
$pkg.AddInt32 = AddInt32;
|
|
AddUint32 = function(addr, delta) {
|
|
var addr, delta, new$1;
|
|
new$1 = addr.$get() + delta >>> 0;
|
|
addr.$set(new$1);
|
|
return new$1;
|
|
};
|
|
$pkg.AddUint32 = AddUint32;
|
|
LoadInt32 = function(addr) {
|
|
var addr;
|
|
return addr.$get();
|
|
};
|
|
$pkg.LoadInt32 = LoadInt32;
|
|
LoadUint32 = function(addr) {
|
|
var addr;
|
|
return addr.$get();
|
|
};
|
|
$pkg.LoadUint32 = LoadUint32;
|
|
LoadUint64 = function(addr) {
|
|
var addr;
|
|
return addr.$get();
|
|
};
|
|
$pkg.LoadUint64 = LoadUint64;
|
|
StoreInt32 = function(addr, val) {
|
|
var addr, val;
|
|
addr.$set(val);
|
|
};
|
|
$pkg.StoreInt32 = StoreInt32;
|
|
StoreUint32 = function(addr, val) {
|
|
var addr, val;
|
|
addr.$set(val);
|
|
};
|
|
$pkg.StoreUint32 = StoreUint32;
|
|
Value.ptr.prototype.Load = function() {
|
|
var v, x;
|
|
x = $ifaceNil;
|
|
v = this;
|
|
x = v.v;
|
|
return x;
|
|
};
|
|
Value.prototype.Load = function() { return this.$val.Load(); };
|
|
Value.ptr.prototype.Store = function(x) {
|
|
var v, x;
|
|
v = this;
|
|
if ($interfaceIsEqual(x, $ifaceNil)) {
|
|
$panic(new $String("sync/atomic: store of nil value into Value"));
|
|
}
|
|
if (!($interfaceIsEqual(v.v, $ifaceNil)) && !(x.constructor === v.v.constructor)) {
|
|
$panic(new $String("sync/atomic: store of inconsistently typed value into Value"));
|
|
}
|
|
v.v = x;
|
|
};
|
|
Value.prototype.Store = function(x) { return this.$val.Store(x); };
|
|
ptrType.methods = [{prop: "Load", name: "Load", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Store", name: "Store", pkg: "", typ: $funcType([$emptyInterface], [], false)}];
|
|
Value.init("sync/atomic", [{prop: "v", name: "v", embedded: false, exported: false, typ: $emptyInterface, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["sync"] = (function() {
|
|
var $pkg = {}, $init, js, race, runtime, atomic, Pool, Mutex, Locker, Once, poolLocalInternal, poolLocal, notifyList, RWMutex, rlocker, ptrType, sliceType, ptrType$1, chanType, sliceType$1, ptrType$6, ptrType$7, sliceType$4, ptrType$8, ptrType$9, funcType, ptrType$16, funcType$2, ptrType$17, arrayType$2, semWaiters, semAwoken, expunged, allPools, runtime_registerPoolCleanup, runtime_SemacquireMutex, runtime_Semrelease, runtime_notifyListCheck, runtime_canSpin, runtime_nanotime, throw$1, poolCleanup, init, indexLocal, init$1, runtime_doSpin;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
race = $packages["internal/race"];
|
|
runtime = $packages["runtime"];
|
|
atomic = $packages["sync/atomic"];
|
|
Pool = $pkg.Pool = $newType(0, $kindStruct, "sync.Pool", true, "sync", true, function(local_, localSize_, store_, New_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.local = 0;
|
|
this.localSize = 0;
|
|
this.store = sliceType$4.nil;
|
|
this.New = $throwNilPointerError;
|
|
return;
|
|
}
|
|
this.local = local_;
|
|
this.localSize = localSize_;
|
|
this.store = store_;
|
|
this.New = New_;
|
|
});
|
|
Mutex = $pkg.Mutex = $newType(0, $kindStruct, "sync.Mutex", true, "sync", true, function(state_, sema_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.state = 0;
|
|
this.sema = 0;
|
|
return;
|
|
}
|
|
this.state = state_;
|
|
this.sema = sema_;
|
|
});
|
|
Locker = $pkg.Locker = $newType(8, $kindInterface, "sync.Locker", true, "sync", true, null);
|
|
Once = $pkg.Once = $newType(0, $kindStruct, "sync.Once", true, "sync", true, function(m_, done_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.m = new Mutex.ptr(0, 0);
|
|
this.done = 0;
|
|
return;
|
|
}
|
|
this.m = m_;
|
|
this.done = done_;
|
|
});
|
|
poolLocalInternal = $pkg.poolLocalInternal = $newType(0, $kindStruct, "sync.poolLocalInternal", true, "sync", false, function(private$0_, shared_, Mutex_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.private$0 = $ifaceNil;
|
|
this.shared = sliceType$4.nil;
|
|
this.Mutex = new Mutex.ptr(0, 0);
|
|
return;
|
|
}
|
|
this.private$0 = private$0_;
|
|
this.shared = shared_;
|
|
this.Mutex = Mutex_;
|
|
});
|
|
poolLocal = $pkg.poolLocal = $newType(0, $kindStruct, "sync.poolLocal", true, "sync", false, function(poolLocalInternal_, pad_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.poolLocalInternal = new poolLocalInternal.ptr($ifaceNil, sliceType$4.nil, new Mutex.ptr(0, 0));
|
|
this.pad = arrayType$2.zero();
|
|
return;
|
|
}
|
|
this.poolLocalInternal = poolLocalInternal_;
|
|
this.pad = pad_;
|
|
});
|
|
notifyList = $pkg.notifyList = $newType(0, $kindStruct, "sync.notifyList", true, "sync", false, function(wait_, notify_, lock_, head_, tail_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.wait = 0;
|
|
this.notify = 0;
|
|
this.lock = 0;
|
|
this.head = 0;
|
|
this.tail = 0;
|
|
return;
|
|
}
|
|
this.wait = wait_;
|
|
this.notify = notify_;
|
|
this.lock = lock_;
|
|
this.head = head_;
|
|
this.tail = tail_;
|
|
});
|
|
RWMutex = $pkg.RWMutex = $newType(0, $kindStruct, "sync.RWMutex", true, "sync", true, function(w_, writerSem_, readerSem_, readerCount_, readerWait_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.w = new Mutex.ptr(0, 0);
|
|
this.writerSem = 0;
|
|
this.readerSem = 0;
|
|
this.readerCount = 0;
|
|
this.readerWait = 0;
|
|
return;
|
|
}
|
|
this.w = w_;
|
|
this.writerSem = writerSem_;
|
|
this.readerSem = readerSem_;
|
|
this.readerCount = readerCount_;
|
|
this.readerWait = readerWait_;
|
|
});
|
|
rlocker = $pkg.rlocker = $newType(0, $kindStruct, "sync.rlocker", true, "sync", false, function(w_, writerSem_, readerSem_, readerCount_, readerWait_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.w = new Mutex.ptr(0, 0);
|
|
this.writerSem = 0;
|
|
this.readerSem = 0;
|
|
this.readerCount = 0;
|
|
this.readerWait = 0;
|
|
return;
|
|
}
|
|
this.w = w_;
|
|
this.writerSem = writerSem_;
|
|
this.readerSem = readerSem_;
|
|
this.readerCount = readerCount_;
|
|
this.readerWait = readerWait_;
|
|
});
|
|
ptrType = $ptrType(Pool);
|
|
sliceType = $sliceType(ptrType);
|
|
ptrType$1 = $ptrType($Uint32);
|
|
chanType = $chanType($Bool, false, false);
|
|
sliceType$1 = $sliceType(chanType);
|
|
ptrType$6 = $ptrType($Int32);
|
|
ptrType$7 = $ptrType(poolLocal);
|
|
sliceType$4 = $sliceType($emptyInterface);
|
|
ptrType$8 = $ptrType(rlocker);
|
|
ptrType$9 = $ptrType(RWMutex);
|
|
funcType = $funcType([], [$emptyInterface], false);
|
|
ptrType$16 = $ptrType(Mutex);
|
|
funcType$2 = $funcType([], [], false);
|
|
ptrType$17 = $ptrType(Once);
|
|
arrayType$2 = $arrayType($Uint8, 100);
|
|
Pool.ptr.prototype.Get = function() {
|
|
var _r, p, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
/* */ if (p.store.$length === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (p.store.$length === 0) { */ case 1:
|
|
/* */ if (!(p.New === $throwNilPointerError)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!(p.New === $throwNilPointerError)) { */ case 3:
|
|
_r = p.New(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 2:
|
|
x$2 = (x = p.store, x$1 = p.store.$length - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
p.store = $subslice(p.store, 0, (p.store.$length - 1 >> 0));
|
|
$s = -1; return x$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Pool.ptr.prototype.Get }; } $f._r = _r; $f.p = p; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Pool.prototype.Get = function() { return this.$val.Get(); };
|
|
Pool.ptr.prototype.Put = function(x) {
|
|
var p, x;
|
|
p = this;
|
|
if ($interfaceIsEqual(x, $ifaceNil)) {
|
|
return;
|
|
}
|
|
p.store = $append(p.store, x);
|
|
};
|
|
Pool.prototype.Put = function(x) { return this.$val.Put(x); };
|
|
runtime_registerPoolCleanup = function(cleanup) {
|
|
var cleanup;
|
|
};
|
|
runtime_SemacquireMutex = function(s, lifo) {
|
|
var _entry, _entry$1, _entry$2, _entry$3, _entry$4, _key, _key$1, _key$2, _r, ch, lifo, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _entry$3 = $f._entry$3; _entry$4 = $f._entry$4; _key = $f._key; _key$1 = $f._key$1; _key$2 = $f._key$2; _r = $f._r; ch = $f.ch; lifo = $f.lifo; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if (((s.$get() - (_entry = semAwoken[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : 0) >>> 0)) === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (((s.$get() - (_entry = semAwoken[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : 0) >>> 0)) === 0) { */ case 1:
|
|
ch = new $Chan($Bool, 0);
|
|
if (lifo) {
|
|
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: $appendSlice(new sliceType$1([ch]), (_entry$1 = semWaiters[ptrType$1.keyFor(s)], _entry$1 !== undefined ? _entry$1.v : sliceType$1.nil)) };
|
|
} else {
|
|
_key$1 = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$1)] = { k: _key$1, v: $append((_entry$2 = semWaiters[ptrType$1.keyFor(s)], _entry$2 !== undefined ? _entry$2.v : sliceType$1.nil), ch) };
|
|
}
|
|
_r = $recv(ch); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r[0];
|
|
_key$2 = s; (semAwoken || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$2)] = { k: _key$2, v: (_entry$3 = semAwoken[ptrType$1.keyFor(s)], _entry$3 !== undefined ? _entry$3.v : 0) - (1) >>> 0 };
|
|
if ((_entry$4 = semAwoken[ptrType$1.keyFor(s)], _entry$4 !== undefined ? _entry$4.v : 0) === 0) {
|
|
delete semAwoken[ptrType$1.keyFor(s)];
|
|
}
|
|
/* } */ case 2:
|
|
s.$set(s.$get() - (1) >>> 0);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_SemacquireMutex }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._entry$3 = _entry$3; $f._entry$4 = _entry$4; $f._key = _key; $f._key$1 = _key$1; $f._key$2 = _key$2; $f._r = _r; $f.ch = ch; $f.lifo = lifo; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
runtime_Semrelease = function(s, handoff) {
|
|
var _entry, _entry$1, _key, _key$1, ch, handoff, s, w, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _key = $f._key; _key$1 = $f._key$1; ch = $f.ch; handoff = $f.handoff; s = $f.s; w = $f.w; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s.$set(s.$get() + (1) >>> 0);
|
|
w = (_entry = semWaiters[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : sliceType$1.nil);
|
|
if (w.$length === 0) {
|
|
$s = -1; return;
|
|
}
|
|
ch = (0 >= w.$length ? ($throwRuntimeError("index out of range"), undefined) : w.$array[w.$offset + 0]);
|
|
w = $subslice(w, 1);
|
|
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: w };
|
|
if (w.$length === 0) {
|
|
delete semWaiters[ptrType$1.keyFor(s)];
|
|
}
|
|
_key$1 = s; (semAwoken || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$1)] = { k: _key$1, v: (_entry$1 = semAwoken[ptrType$1.keyFor(s)], _entry$1 !== undefined ? _entry$1.v : 0) + (1) >>> 0 };
|
|
$r = $send(ch, true); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_Semrelease }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._key = _key; $f._key$1 = _key$1; $f.ch = ch; $f.handoff = handoff; $f.s = s; $f.w = w; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
runtime_notifyListCheck = function(size) {
|
|
var size;
|
|
};
|
|
runtime_canSpin = function(i) {
|
|
var i;
|
|
return false;
|
|
};
|
|
runtime_nanotime = function() {
|
|
return $mul64($internalize(new ($global.Date)().getTime(), $Int64), new $Int64(0, 1000000));
|
|
};
|
|
throw$1 = function(s) {
|
|
var s;
|
|
$throwRuntimeError($externalize(s, $String));
|
|
};
|
|
Mutex.ptr.prototype.Lock = function() {
|
|
var awoke, delta, iter, m, new$1, old, queueLifo, starving, waitStartTime, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; awoke = $f.awoke; delta = $f.delta; iter = $f.iter; m = $f.m; new$1 = $f.new$1; old = $f.old; queueLifo = $f.queueLifo; starving = $f.starving; waitStartTime = $f.waitStartTime; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
m = this;
|
|
if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), 0, 1)) {
|
|
if (false) {
|
|
race.Acquire((m));
|
|
}
|
|
$s = -1; return;
|
|
}
|
|
waitStartTime = new $Int64(0, 0);
|
|
starving = false;
|
|
awoke = false;
|
|
iter = 0;
|
|
old = m.state;
|
|
/* while (true) { */ case 1:
|
|
/* */ if (((old & 5) === 1) && runtime_canSpin(iter)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (((old & 5) === 1) && runtime_canSpin(iter)) { */ case 3:
|
|
if (!awoke && ((old & 2) === 0) && !(((old >> 3 >> 0) === 0)) && atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, old | 2)) {
|
|
awoke = true;
|
|
}
|
|
runtime_doSpin();
|
|
iter = iter + (1) >> 0;
|
|
old = m.state;
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 4:
|
|
new$1 = old;
|
|
if ((old & 4) === 0) {
|
|
new$1 = new$1 | (1);
|
|
}
|
|
if (!(((old & 5) === 0))) {
|
|
new$1 = new$1 + (8) >> 0;
|
|
}
|
|
if (starving && !(((old & 1) === 0))) {
|
|
new$1 = new$1 | (4);
|
|
}
|
|
if (awoke) {
|
|
if ((new$1 & 2) === 0) {
|
|
throw$1("sync: inconsistent mutex state");
|
|
}
|
|
new$1 = (new$1 & ~(2)) >> 0;
|
|
}
|
|
/* */ if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { */ case 5:
|
|
if ((old & 5) === 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
queueLifo = !((waitStartTime.$high === 0 && waitStartTime.$low === 0));
|
|
if ((waitStartTime.$high === 0 && waitStartTime.$low === 0)) {
|
|
waitStartTime = runtime_nanotime();
|
|
}
|
|
$r = runtime_SemacquireMutex((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), queueLifo); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
starving = starving || (x = (x$1 = runtime_nanotime(), new $Int64(x$1.$high - waitStartTime.$high, x$1.$low - waitStartTime.$low)), (x.$high > 0 || (x.$high === 0 && x.$low > 1000000)));
|
|
old = m.state;
|
|
if (!(((old & 4) === 0))) {
|
|
if (!(((old & 3) === 0)) || ((old >> 3 >> 0) === 0)) {
|
|
throw$1("sync: inconsistent mutex state");
|
|
}
|
|
delta = -7;
|
|
if (!starving || ((old >> 3 >> 0) === 1)) {
|
|
delta = delta - (4) >> 0;
|
|
}
|
|
atomic.AddInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), delta);
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
awoke = true;
|
|
iter = 0;
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
old = m.state;
|
|
/* } */ case 7:
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (false) {
|
|
race.Acquire((m));
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Mutex.ptr.prototype.Lock }; } $f.awoke = awoke; $f.delta = delta; $f.iter = iter; $f.m = m; $f.new$1 = new$1; $f.old = old; $f.queueLifo = queueLifo; $f.starving = starving; $f.waitStartTime = waitStartTime; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Mutex.prototype.Lock = function() { return this.$val.Lock(); };
|
|
Mutex.ptr.prototype.Unlock = function() {
|
|
var m, new$1, old, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; m = $f.m; new$1 = $f.new$1; old = $f.old; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
m = this;
|
|
if (false) {
|
|
$unused(m.state);
|
|
race.Release((m));
|
|
}
|
|
new$1 = atomic.AddInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), -1);
|
|
if ((((new$1 + 1 >> 0)) & 1) === 0) {
|
|
throw$1("sync: unlock of unlocked mutex");
|
|
}
|
|
/* */ if ((new$1 & 4) === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((new$1 & 4) === 0) { */ case 1:
|
|
old = new$1;
|
|
/* while (true) { */ case 4:
|
|
if (((old >> 3 >> 0) === 0) || !(((old & 7) === 0))) {
|
|
$s = -1; return;
|
|
}
|
|
new$1 = ((old - 8 >> 0)) | 2;
|
|
/* */ if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { */ case 6:
|
|
$r = runtime_Semrelease((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), false); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 7:
|
|
old = m.state;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
$r = runtime_Semrelease((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), true); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 3:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Mutex.ptr.prototype.Unlock }; } $f.m = m; $f.new$1 = new$1; $f.old = old; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Mutex.prototype.Unlock = function() { return this.$val.Unlock(); };
|
|
Once.ptr.prototype.Do = function(f) {
|
|
var f, o, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; f = $f.f; o = $f.o; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
o = this;
|
|
if (atomic.LoadUint32((o.$ptr_done || (o.$ptr_done = new ptrType$1(function() { return this.$target.done; }, function($v) { this.$target.done = $v; }, o)))) === 1) {
|
|
$s = -1; return;
|
|
}
|
|
$r = o.m.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(o.m, "Unlock"), []]);
|
|
/* */ if (o.done === 0) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (o.done === 0) { */ case 2:
|
|
$deferred.push([atomic.StoreUint32, [(o.$ptr_done || (o.$ptr_done = new ptrType$1(function() { return this.$target.done; }, function($v) { this.$target.done = $v; }, o))), 1]]);
|
|
$r = f(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 3:
|
|
$s = -1; return;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Once.ptr.prototype.Do }; } $f.f = f; $f.o = o; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Once.prototype.Do = function(f) { return this.$val.Do(f); };
|
|
poolCleanup = function() {
|
|
var _i, _i$1, _ref, _ref$1, i, i$1, j, l, p, x;
|
|
_ref = allPools;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
p = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
((i < 0 || i >= allPools.$length) ? ($throwRuntimeError("index out of range"), undefined) : allPools.$array[allPools.$offset + i] = ptrType.nil);
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < ((p.localSize >> 0)))) { break; }
|
|
l = indexLocal(p.local, i$1);
|
|
l.poolLocalInternal.private$0 = $ifaceNil;
|
|
_ref$1 = l.poolLocalInternal.shared;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
j = _i$1;
|
|
(x = l.poolLocalInternal.shared, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j] = $ifaceNil));
|
|
_i$1++;
|
|
}
|
|
l.poolLocalInternal.shared = sliceType$4.nil;
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
p.local = 0;
|
|
p.localSize = 0;
|
|
_i++;
|
|
}
|
|
allPools = new sliceType([]);
|
|
};
|
|
init = function() {
|
|
runtime_registerPoolCleanup(poolCleanup);
|
|
};
|
|
indexLocal = function(l, i) {
|
|
var i, l, lp;
|
|
lp = (((l) + ($imul(((i >>> 0)), 128) >>> 0) >>> 0));
|
|
return ($pointerOfStructConversion(lp, ptrType$7));
|
|
};
|
|
init$1 = function() {
|
|
var n;
|
|
n = new notifyList.ptr(0, 0, 0, 0, 0);
|
|
runtime_notifyListCheck(20);
|
|
};
|
|
runtime_doSpin = function() {
|
|
$throwRuntimeError("native function not implemented: sync.runtime_doSpin");
|
|
};
|
|
RWMutex.ptr.prototype.RLock = function() {
|
|
var rw, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; rw = $f.rw; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rw = this;
|
|
if (false) {
|
|
$unused(rw.w.state);
|
|
race.Disable();
|
|
}
|
|
/* */ if (atomic.AddInt32((rw.$ptr_readerCount || (rw.$ptr_readerCount = new ptrType$6(function() { return this.$target.readerCount; }, function($v) { this.$target.readerCount = $v; }, rw))), 1) < 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (atomic.AddInt32((rw.$ptr_readerCount || (rw.$ptr_readerCount = new ptrType$6(function() { return this.$target.readerCount; }, function($v) { this.$target.readerCount = $v; }, rw))), 1) < 0) { */ case 1:
|
|
$r = runtime_SemacquireMutex((rw.$ptr_readerSem || (rw.$ptr_readerSem = new ptrType$1(function() { return this.$target.readerSem; }, function($v) { this.$target.readerSem = $v; }, rw))), false); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
if (false) {
|
|
race.Enable();
|
|
race.Acquire(((rw.$ptr_readerSem || (rw.$ptr_readerSem = new ptrType$1(function() { return this.$target.readerSem; }, function($v) { this.$target.readerSem = $v; }, rw)))));
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: RWMutex.ptr.prototype.RLock }; } $f.rw = rw; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
RWMutex.prototype.RLock = function() { return this.$val.RLock(); };
|
|
RWMutex.ptr.prototype.RUnlock = function() {
|
|
var r, rw, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; rw = $f.rw; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rw = this;
|
|
if (false) {
|
|
$unused(rw.w.state);
|
|
race.ReleaseMerge(((rw.$ptr_writerSem || (rw.$ptr_writerSem = new ptrType$1(function() { return this.$target.writerSem; }, function($v) { this.$target.writerSem = $v; }, rw)))));
|
|
race.Disable();
|
|
}
|
|
r = atomic.AddInt32((rw.$ptr_readerCount || (rw.$ptr_readerCount = new ptrType$6(function() { return this.$target.readerCount; }, function($v) { this.$target.readerCount = $v; }, rw))), -1);
|
|
/* */ if (r < 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (r < 0) { */ case 1:
|
|
if (((r + 1 >> 0) === 0) || ((r + 1 >> 0) === -1073741824)) {
|
|
race.Enable();
|
|
throw$1("sync: RUnlock of unlocked RWMutex");
|
|
}
|
|
/* */ if (atomic.AddInt32((rw.$ptr_readerWait || (rw.$ptr_readerWait = new ptrType$6(function() { return this.$target.readerWait; }, function($v) { this.$target.readerWait = $v; }, rw))), -1) === 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (atomic.AddInt32((rw.$ptr_readerWait || (rw.$ptr_readerWait = new ptrType$6(function() { return this.$target.readerWait; }, function($v) { this.$target.readerWait = $v; }, rw))), -1) === 0) { */ case 3:
|
|
$r = runtime_Semrelease((rw.$ptr_writerSem || (rw.$ptr_writerSem = new ptrType$1(function() { return this.$target.writerSem; }, function($v) { this.$target.writerSem = $v; }, rw))), false); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 4:
|
|
/* } */ case 2:
|
|
if (false) {
|
|
race.Enable();
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: RWMutex.ptr.prototype.RUnlock }; } $f.r = r; $f.rw = rw; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
RWMutex.prototype.RUnlock = function() { return this.$val.RUnlock(); };
|
|
RWMutex.ptr.prototype.Lock = function() {
|
|
var r, rw, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; rw = $f.rw; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rw = this;
|
|
if (false) {
|
|
$unused(rw.w.state);
|
|
race.Disable();
|
|
}
|
|
$r = rw.w.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
r = atomic.AddInt32((rw.$ptr_readerCount || (rw.$ptr_readerCount = new ptrType$6(function() { return this.$target.readerCount; }, function($v) { this.$target.readerCount = $v; }, rw))), -1073741824) + 1073741824 >> 0;
|
|
/* */ if (!((r === 0)) && !((atomic.AddInt32((rw.$ptr_readerWait || (rw.$ptr_readerWait = new ptrType$6(function() { return this.$target.readerWait; }, function($v) { this.$target.readerWait = $v; }, rw))), r) === 0))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((r === 0)) && !((atomic.AddInt32((rw.$ptr_readerWait || (rw.$ptr_readerWait = new ptrType$6(function() { return this.$target.readerWait; }, function($v) { this.$target.readerWait = $v; }, rw))), r) === 0))) { */ case 2:
|
|
$r = runtime_SemacquireMutex((rw.$ptr_writerSem || (rw.$ptr_writerSem = new ptrType$1(function() { return this.$target.writerSem; }, function($v) { this.$target.writerSem = $v; }, rw))), false); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 3:
|
|
if (false) {
|
|
race.Enable();
|
|
race.Acquire(((rw.$ptr_readerSem || (rw.$ptr_readerSem = new ptrType$1(function() { return this.$target.readerSem; }, function($v) { this.$target.readerSem = $v; }, rw)))));
|
|
race.Acquire(((rw.$ptr_writerSem || (rw.$ptr_writerSem = new ptrType$1(function() { return this.$target.writerSem; }, function($v) { this.$target.writerSem = $v; }, rw)))));
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: RWMutex.ptr.prototype.Lock }; } $f.r = r; $f.rw = rw; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
RWMutex.prototype.Lock = function() { return this.$val.Lock(); };
|
|
RWMutex.ptr.prototype.Unlock = function() {
|
|
var i, r, rw, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; i = $f.i; r = $f.r; rw = $f.rw; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rw = this;
|
|
if (false) {
|
|
$unused(rw.w.state);
|
|
race.Release(((rw.$ptr_readerSem || (rw.$ptr_readerSem = new ptrType$1(function() { return this.$target.readerSem; }, function($v) { this.$target.readerSem = $v; }, rw)))));
|
|
race.Disable();
|
|
}
|
|
r = atomic.AddInt32((rw.$ptr_readerCount || (rw.$ptr_readerCount = new ptrType$6(function() { return this.$target.readerCount; }, function($v) { this.$target.readerCount = $v; }, rw))), 1073741824);
|
|
if (r >= 1073741824) {
|
|
race.Enable();
|
|
throw$1("sync: Unlock of unlocked RWMutex");
|
|
}
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < ((r >> 0)))) { break; } */ if(!(i < ((r >> 0)))) { $s = 2; continue; }
|
|
$r = runtime_Semrelease((rw.$ptr_readerSem || (rw.$ptr_readerSem = new ptrType$1(function() { return this.$target.readerSem; }, function($v) { this.$target.readerSem = $v; }, rw))), false); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$r = rw.w.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (false) {
|
|
race.Enable();
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: RWMutex.ptr.prototype.Unlock }; } $f.i = i; $f.r = r; $f.rw = rw; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
RWMutex.prototype.Unlock = function() { return this.$val.Unlock(); };
|
|
RWMutex.ptr.prototype.RLocker = function() {
|
|
var rw;
|
|
rw = this;
|
|
return ($pointerOfStructConversion(rw, ptrType$8));
|
|
};
|
|
RWMutex.prototype.RLocker = function() { return this.$val.RLocker(); };
|
|
rlocker.ptr.prototype.Lock = function() {
|
|
var r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
$r = ($pointerOfStructConversion(r, ptrType$9)).RLock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rlocker.ptr.prototype.Lock }; } $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rlocker.prototype.Lock = function() { return this.$val.Lock(); };
|
|
rlocker.ptr.prototype.Unlock = function() {
|
|
var r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
$r = ($pointerOfStructConversion(r, ptrType$9)).RUnlock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rlocker.ptr.prototype.Unlock }; } $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rlocker.prototype.Unlock = function() { return this.$val.Unlock(); };
|
|
ptrType.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Put", name: "Put", pkg: "", typ: $funcType([$emptyInterface], [], false)}, {prop: "getSlow", name: "getSlow", pkg: "sync", typ: $funcType([], [$emptyInterface], false)}, {prop: "pin", name: "pin", pkg: "sync", typ: $funcType([], [ptrType$7], false)}, {prop: "pinSlow", name: "pinSlow", pkg: "sync", typ: $funcType([], [ptrType$7], false)}];
|
|
ptrType$16.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}];
|
|
ptrType$17.methods = [{prop: "Do", name: "Do", pkg: "", typ: $funcType([funcType$2], [], false)}];
|
|
ptrType$9.methods = [{prop: "RLock", name: "RLock", pkg: "", typ: $funcType([], [], false)}, {prop: "RUnlock", name: "RUnlock", pkg: "", typ: $funcType([], [], false)}, {prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}, {prop: "RLocker", name: "RLocker", pkg: "", typ: $funcType([], [Locker], false)}];
|
|
ptrType$8.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}];
|
|
Pool.init("sync", [{prop: "local", name: "local", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "localSize", name: "localSize", embedded: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "store", name: "store", embedded: false, exported: false, typ: sliceType$4, tag: ""}, {prop: "New", name: "New", embedded: false, exported: true, typ: funcType, tag: ""}]);
|
|
Mutex.init("sync", [{prop: "state", name: "state", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "sema", name: "sema", embedded: false, exported: false, typ: $Uint32, tag: ""}]);
|
|
Locker.init([{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}]);
|
|
Once.init("sync", [{prop: "m", name: "m", embedded: false, exported: false, typ: Mutex, tag: ""}, {prop: "done", name: "done", embedded: false, exported: false, typ: $Uint32, tag: ""}]);
|
|
poolLocalInternal.init("sync", [{prop: "private$0", name: "private", embedded: false, exported: false, typ: $emptyInterface, tag: ""}, {prop: "shared", name: "shared", embedded: false, exported: false, typ: sliceType$4, tag: ""}, {prop: "Mutex", name: "Mutex", embedded: true, exported: true, typ: Mutex, tag: ""}]);
|
|
poolLocal.init("sync", [{prop: "poolLocalInternal", name: "poolLocalInternal", embedded: true, exported: false, typ: poolLocalInternal, tag: ""}, {prop: "pad", name: "pad", embedded: false, exported: false, typ: arrayType$2, tag: ""}]);
|
|
notifyList.init("sync", [{prop: "wait", name: "wait", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "notify", name: "notify", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "lock", name: "lock", embedded: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "head", name: "head", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "tail", name: "tail", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}]);
|
|
RWMutex.init("sync", [{prop: "w", name: "w", embedded: false, exported: false, typ: Mutex, tag: ""}, {prop: "writerSem", name: "writerSem", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "readerSem", name: "readerSem", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "readerCount", name: "readerCount", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "readerWait", name: "readerWait", embedded: false, exported: false, typ: $Int32, tag: ""}]);
|
|
rlocker.init("sync", [{prop: "w", name: "w", embedded: false, exported: false, typ: Mutex, tag: ""}, {prop: "writerSem", name: "writerSem", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "readerSem", name: "readerSem", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "readerCount", name: "readerCount", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "readerWait", name: "readerWait", embedded: false, exported: false, typ: $Int32, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = race.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
allPools = sliceType.nil;
|
|
semWaiters = {};
|
|
semAwoken = {};
|
|
expunged = (new Uint8Array(8));
|
|
init();
|
|
init$1();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["unicode"] = (function() {
|
|
var $pkg = {}, $init, RangeTable, Range16, Range32, CaseRange, d, foldPair, arrayType, sliceType, sliceType$1, ptrType, sliceType$2, sliceType$3, sliceType$4, _C, _Cc, _Cf, _Co, _Cs, _L, _Ll, _Lm, _Lo, _Lt, _Lu, _M, _Mc, _Me, _Mn, _N, _Nd, _Nl, _No, _P, _Pc, _Pd, _Pe, _Pf, _Pi, _Po, _Ps, _S, _Sc, _Sk, _Sm, _So, _Z, _Zl, _Zp, _Zs, _Adlam, _Ahom, _Anatolian_Hieroglyphs, _Arabic, _Armenian, _Avestan, _Balinese, _Bamum, _Bassa_Vah, _Batak, _Bengali, _Bhaiksuki, _Bopomofo, _Brahmi, _Braille, _Buginese, _Buhid, _Canadian_Aboriginal, _Carian, _Caucasian_Albanian, _Chakma, _Cham, _Cherokee, _Common, _Coptic, _Cuneiform, _Cypriot, _Cyrillic, _Deseret, _Devanagari, _Duployan, _Egyptian_Hieroglyphs, _Elbasan, _Ethiopic, _Georgian, _Glagolitic, _Gothic, _Grantha, _Greek, _Gujarati, _Gurmukhi, _Han, _Hangul, _Hanunoo, _Hatran, _Hebrew, _Hiragana, _Imperial_Aramaic, _Inherited, _Inscriptional_Pahlavi, _Inscriptional_Parthian, _Javanese, _Kaithi, _Kannada, _Katakana, _Kayah_Li, _Kharoshthi, _Khmer, _Khojki, _Khudawadi, _Lao, _Latin, _Lepcha, _Limbu, _Linear_A, _Linear_B, _Lisu, _Lycian, _Lydian, _Mahajani, _Malayalam, _Mandaic, _Manichaean, _Marchen, _Masaram_Gondi, _Meetei_Mayek, _Mende_Kikakui, _Meroitic_Cursive, _Meroitic_Hieroglyphs, _Miao, _Modi, _Mongolian, _Mro, _Multani, _Myanmar, _Nabataean, _New_Tai_Lue, _Newa, _Nko, _Nushu, _Ogham, _Ol_Chiki, _Old_Hungarian, _Old_Italic, _Old_North_Arabian, _Old_Permic, _Old_Persian, _Old_South_Arabian, _Old_Turkic, _Oriya, _Osage, _Osmanya, _Pahawh_Hmong, _Palmyrene, _Pau_Cin_Hau, _Phags_Pa, _Phoenician, _Psalter_Pahlavi, _Rejang, _Runic, _Samaritan, _Saurashtra, _Sharada, _Shavian, _Siddham, _SignWriting, _Sinhala, _Sora_Sompeng, _Soyombo, _Sundanese, _Syloti_Nagri, _Syriac, _Tagalog, _Tagbanwa, _Tai_Le, _Tai_Tham, _Tai_Viet, _Takri, _Tamil, _Tangut, _Telugu, _Thaana, _Thai, _Tibetan, _Tifinagh, _Tirhuta, _Ugaritic, _Vai, _Warang_Citi, _Yi, _Zanabazar_Square, _CaseRanges, properties, asciiFold, caseOrbit, foldL, foldLl, foldLt, foldLu, foldM, foldMn, foldCommon, foldGreek, foldInherited, to, IsDigit, IsPrint, In, IsLetter, is16, is32, Is, isExcludingLatin, To, ToUpper, ToLower, SimpleFold;
|
|
RangeTable = $pkg.RangeTable = $newType(0, $kindStruct, "unicode.RangeTable", true, "unicode", true, function(R16_, R32_, LatinOffset_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.R16 = sliceType.nil;
|
|
this.R32 = sliceType$1.nil;
|
|
this.LatinOffset = 0;
|
|
return;
|
|
}
|
|
this.R16 = R16_;
|
|
this.R32 = R32_;
|
|
this.LatinOffset = LatinOffset_;
|
|
});
|
|
Range16 = $pkg.Range16 = $newType(0, $kindStruct, "unicode.Range16", true, "unicode", true, function(Lo_, Hi_, Stride_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Lo = 0;
|
|
this.Hi = 0;
|
|
this.Stride = 0;
|
|
return;
|
|
}
|
|
this.Lo = Lo_;
|
|
this.Hi = Hi_;
|
|
this.Stride = Stride_;
|
|
});
|
|
Range32 = $pkg.Range32 = $newType(0, $kindStruct, "unicode.Range32", true, "unicode", true, function(Lo_, Hi_, Stride_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Lo = 0;
|
|
this.Hi = 0;
|
|
this.Stride = 0;
|
|
return;
|
|
}
|
|
this.Lo = Lo_;
|
|
this.Hi = Hi_;
|
|
this.Stride = Stride_;
|
|
});
|
|
CaseRange = $pkg.CaseRange = $newType(0, $kindStruct, "unicode.CaseRange", true, "unicode", true, function(Lo_, Hi_, Delta_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Lo = 0;
|
|
this.Hi = 0;
|
|
this.Delta = arrayType.zero();
|
|
return;
|
|
}
|
|
this.Lo = Lo_;
|
|
this.Hi = Hi_;
|
|
this.Delta = Delta_;
|
|
});
|
|
d = $pkg.d = $newType(12, $kindArray, "unicode.d", true, "unicode", false, null);
|
|
foldPair = $pkg.foldPair = $newType(0, $kindStruct, "unicode.foldPair", true, "unicode", false, function(From_, To_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.From = 0;
|
|
this.To = 0;
|
|
return;
|
|
}
|
|
this.From = From_;
|
|
this.To = To_;
|
|
});
|
|
arrayType = $arrayType($Int32, 3);
|
|
sliceType = $sliceType(Range16);
|
|
sliceType$1 = $sliceType(Range32);
|
|
ptrType = $ptrType(RangeTable);
|
|
sliceType$2 = $sliceType(ptrType);
|
|
sliceType$3 = $sliceType(CaseRange);
|
|
sliceType$4 = $sliceType(foldPair);
|
|
to = function(_case, r, caseRange) {
|
|
var _case, _q, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, caseRange, cr, delta, foundMapping, hi, lo, m, mappedRune, r, x;
|
|
mappedRune = 0;
|
|
foundMapping = false;
|
|
if (_case < 0 || 3 <= _case) {
|
|
_tmp = 65533;
|
|
_tmp$1 = false;
|
|
mappedRune = _tmp;
|
|
foundMapping = _tmp$1;
|
|
return [mappedRune, foundMapping];
|
|
}
|
|
lo = 0;
|
|
hi = caseRange.$length;
|
|
while (true) {
|
|
if (!(lo < hi)) { break; }
|
|
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
cr = ((m < 0 || m >= caseRange.$length) ? ($throwRuntimeError("index out of range"), undefined) : caseRange.$array[caseRange.$offset + m]);
|
|
if (((cr.Lo >> 0)) <= r && r <= ((cr.Hi >> 0))) {
|
|
delta = ((x = cr.Delta, ((_case < 0 || _case >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[_case])));
|
|
if (delta > 1114111) {
|
|
_tmp$2 = ((cr.Lo >> 0)) + ((((((r - ((cr.Lo >> 0)) >> 0)) & ~1) >> 0) | (((_case & 1) >> 0)))) >> 0;
|
|
_tmp$3 = true;
|
|
mappedRune = _tmp$2;
|
|
foundMapping = _tmp$3;
|
|
return [mappedRune, foundMapping];
|
|
}
|
|
_tmp$4 = r + delta >> 0;
|
|
_tmp$5 = true;
|
|
mappedRune = _tmp$4;
|
|
foundMapping = _tmp$5;
|
|
return [mappedRune, foundMapping];
|
|
}
|
|
if (r < ((cr.Lo >> 0))) {
|
|
hi = m;
|
|
} else {
|
|
lo = m + 1 >> 0;
|
|
}
|
|
}
|
|
_tmp$6 = r;
|
|
_tmp$7 = false;
|
|
mappedRune = _tmp$6;
|
|
foundMapping = _tmp$7;
|
|
return [mappedRune, foundMapping];
|
|
};
|
|
IsDigit = function(r) {
|
|
var r;
|
|
if (r <= 255) {
|
|
return 48 <= r && r <= 57;
|
|
}
|
|
return isExcludingLatin($pkg.Digit, r);
|
|
};
|
|
$pkg.IsDigit = IsDigit;
|
|
IsPrint = function(r) {
|
|
var r, x;
|
|
if (((r >>> 0)) <= 255) {
|
|
return !(((((x = ((r << 24 >>> 24)), ((x < 0 || x >= properties.length) ? ($throwRuntimeError("index out of range"), undefined) : properties[x])) & 128) >>> 0) === 0));
|
|
}
|
|
return In(r, $pkg.PrintRanges);
|
|
};
|
|
$pkg.IsPrint = IsPrint;
|
|
In = function(r, ranges) {
|
|
var _i, _ref, inside, r, ranges;
|
|
_ref = ranges;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
inside = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (Is(inside, r)) {
|
|
return true;
|
|
}
|
|
_i++;
|
|
}
|
|
return false;
|
|
};
|
|
$pkg.In = In;
|
|
IsLetter = function(r) {
|
|
var r, x;
|
|
if (((r >>> 0)) <= 255) {
|
|
return !(((((x = ((r << 24 >>> 24)), ((x < 0 || x >= properties.length) ? ($throwRuntimeError("index out of range"), undefined) : properties[x])) & 96) >>> 0) === 0));
|
|
}
|
|
return isExcludingLatin($pkg.Letter, r);
|
|
};
|
|
$pkg.IsLetter = IsLetter;
|
|
is16 = function(ranges, r) {
|
|
var _i, _q, _r, _r$1, _ref, hi, i, lo, m, r, range_, range_$1, ranges;
|
|
if (ranges.$length <= 18 || r <= 255) {
|
|
_ref = ranges;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
range_ = ((i < 0 || i >= ranges.$length) ? ($throwRuntimeError("index out of range"), undefined) : ranges.$array[ranges.$offset + i]);
|
|
if (r < range_.Lo) {
|
|
return false;
|
|
}
|
|
if (r <= range_.Hi) {
|
|
return (range_.Stride === 1) || ((_r = ((r - range_.Lo << 16 >>> 16)) % range_.Stride, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0);
|
|
}
|
|
_i++;
|
|
}
|
|
return false;
|
|
}
|
|
lo = 0;
|
|
hi = ranges.$length;
|
|
while (true) {
|
|
if (!(lo < hi)) { break; }
|
|
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
range_$1 = ((m < 0 || m >= ranges.$length) ? ($throwRuntimeError("index out of range"), undefined) : ranges.$array[ranges.$offset + m]);
|
|
if (range_$1.Lo <= r && r <= range_$1.Hi) {
|
|
return (range_$1.Stride === 1) || ((_r$1 = ((r - range_$1.Lo << 16 >>> 16)) % range_$1.Stride, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0);
|
|
}
|
|
if (r < range_$1.Lo) {
|
|
hi = m;
|
|
} else {
|
|
lo = m + 1 >> 0;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
is32 = function(ranges, r) {
|
|
var _i, _q, _r, _r$1, _ref, hi, i, lo, m, r, range_, range_$1, ranges;
|
|
if (ranges.$length <= 18) {
|
|
_ref = ranges;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
range_ = ((i < 0 || i >= ranges.$length) ? ($throwRuntimeError("index out of range"), undefined) : ranges.$array[ranges.$offset + i]);
|
|
if (r < range_.Lo) {
|
|
return false;
|
|
}
|
|
if (r <= range_.Hi) {
|
|
return (range_.Stride === 1) || ((_r = ((r - range_.Lo >>> 0)) % range_.Stride, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0);
|
|
}
|
|
_i++;
|
|
}
|
|
return false;
|
|
}
|
|
lo = 0;
|
|
hi = ranges.$length;
|
|
while (true) {
|
|
if (!(lo < hi)) { break; }
|
|
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
range_$1 = $clone(((m < 0 || m >= ranges.$length) ? ($throwRuntimeError("index out of range"), undefined) : ranges.$array[ranges.$offset + m]), Range32);
|
|
if (range_$1.Lo <= r && r <= range_$1.Hi) {
|
|
return (range_$1.Stride === 1) || ((_r$1 = ((r - range_$1.Lo >>> 0)) % range_$1.Stride, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0);
|
|
}
|
|
if (r < range_$1.Lo) {
|
|
hi = m;
|
|
} else {
|
|
lo = m + 1 >> 0;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
Is = function(rangeTab, r) {
|
|
var r, r16, r32, rangeTab, x;
|
|
r16 = rangeTab.R16;
|
|
if (r16.$length > 0 && r <= (((x = r16.$length - 1 >> 0, ((x < 0 || x >= r16.$length) ? ($throwRuntimeError("index out of range"), undefined) : r16.$array[r16.$offset + x])).Hi >> 0))) {
|
|
return is16(r16, ((r << 16 >>> 16)));
|
|
}
|
|
r32 = rangeTab.R32;
|
|
if (r32.$length > 0 && r >= (((0 >= r32.$length ? ($throwRuntimeError("index out of range"), undefined) : r32.$array[r32.$offset + 0]).Lo >> 0))) {
|
|
return is32(r32, ((r >>> 0)));
|
|
}
|
|
return false;
|
|
};
|
|
$pkg.Is = Is;
|
|
isExcludingLatin = function(rangeTab, r) {
|
|
var off, r, r16, r32, rangeTab, x;
|
|
r16 = rangeTab.R16;
|
|
off = rangeTab.LatinOffset;
|
|
if (r16.$length > off && r <= (((x = r16.$length - 1 >> 0, ((x < 0 || x >= r16.$length) ? ($throwRuntimeError("index out of range"), undefined) : r16.$array[r16.$offset + x])).Hi >> 0))) {
|
|
return is16($subslice(r16, off), ((r << 16 >>> 16)));
|
|
}
|
|
r32 = rangeTab.R32;
|
|
if (r32.$length > 0 && r >= (((0 >= r32.$length ? ($throwRuntimeError("index out of range"), undefined) : r32.$array[r32.$offset + 0]).Lo >> 0))) {
|
|
return is32(r32, ((r >>> 0)));
|
|
}
|
|
return false;
|
|
};
|
|
To = function(_case, r) {
|
|
var _case, _tuple, r;
|
|
_tuple = to(_case, r, $pkg.CaseRanges);
|
|
r = _tuple[0];
|
|
return r;
|
|
};
|
|
$pkg.To = To;
|
|
ToUpper = function(r) {
|
|
var r;
|
|
if (r <= 127) {
|
|
if (97 <= r && r <= 122) {
|
|
r = r - (32) >> 0;
|
|
}
|
|
return r;
|
|
}
|
|
return To(0, r);
|
|
};
|
|
$pkg.ToUpper = ToUpper;
|
|
ToLower = function(r) {
|
|
var r;
|
|
if (r <= 127) {
|
|
if (65 <= r && r <= 90) {
|
|
r = r + (32) >> 0;
|
|
}
|
|
return r;
|
|
}
|
|
return To(1, r);
|
|
};
|
|
$pkg.ToLower = ToLower;
|
|
SimpleFold = function(r) {
|
|
var _q, hi, l, lo, m, r;
|
|
if (r < 0 || r > 1114111) {
|
|
return r;
|
|
}
|
|
if (((r >> 0)) < 128) {
|
|
return ((((r < 0 || r >= asciiFold.length) ? ($throwRuntimeError("index out of range"), undefined) : asciiFold[r]) >> 0));
|
|
}
|
|
lo = 0;
|
|
hi = caseOrbit.$length;
|
|
while (true) {
|
|
if (!(lo < hi)) { break; }
|
|
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
if (((((m < 0 || m >= caseOrbit.$length) ? ($throwRuntimeError("index out of range"), undefined) : caseOrbit.$array[caseOrbit.$offset + m]).From >> 0)) < r) {
|
|
lo = m + 1 >> 0;
|
|
} else {
|
|
hi = m;
|
|
}
|
|
}
|
|
if (lo < caseOrbit.$length && (((((lo < 0 || lo >= caseOrbit.$length) ? ($throwRuntimeError("index out of range"), undefined) : caseOrbit.$array[caseOrbit.$offset + lo]).From >> 0)) === r)) {
|
|
return ((((lo < 0 || lo >= caseOrbit.$length) ? ($throwRuntimeError("index out of range"), undefined) : caseOrbit.$array[caseOrbit.$offset + lo]).To >> 0));
|
|
}
|
|
l = ToLower(r);
|
|
if (!((l === r))) {
|
|
return l;
|
|
}
|
|
return ToUpper(r);
|
|
};
|
|
$pkg.SimpleFold = SimpleFold;
|
|
RangeTable.init("", [{prop: "R16", name: "R16", embedded: false, exported: true, typ: sliceType, tag: ""}, {prop: "R32", name: "R32", embedded: false, exported: true, typ: sliceType$1, tag: ""}, {prop: "LatinOffset", name: "LatinOffset", embedded: false, exported: true, typ: $Int, tag: ""}]);
|
|
Range16.init("", [{prop: "Lo", name: "Lo", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Hi", name: "Hi", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Stride", name: "Stride", embedded: false, exported: true, typ: $Uint16, tag: ""}]);
|
|
Range32.init("", [{prop: "Lo", name: "Lo", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Hi", name: "Hi", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Stride", name: "Stride", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
CaseRange.init("", [{prop: "Lo", name: "Lo", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Hi", name: "Hi", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Delta", name: "Delta", embedded: false, exported: true, typ: d, tag: ""}]);
|
|
d.init($Int32, 3);
|
|
foldPair.init("", [{prop: "From", name: "From", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "To", name: "To", embedded: false, exported: true, typ: $Uint16, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_C = new RangeTable.ptr(new sliceType([new Range16.ptr(0, 31, 1), new Range16.ptr(127, 159, 1), new Range16.ptr(173, 1536, 1363), new Range16.ptr(1537, 1541, 1), new Range16.ptr(1564, 1757, 193), new Range16.ptr(1807, 2274, 467), new Range16.ptr(6158, 8203, 2045), new Range16.ptr(8204, 8207, 1), new Range16.ptr(8234, 8238, 1), new Range16.ptr(8288, 8292, 1), new Range16.ptr(8294, 8303, 1), new Range16.ptr(55296, 63743, 1), new Range16.ptr(65279, 65529, 250), new Range16.ptr(65530, 65531, 1)]), new sliceType$1([new Range32.ptr(69821, 113824, 44003), new Range32.ptr(113825, 113827, 1), new Range32.ptr(119155, 119162, 1), new Range32.ptr(917505, 917536, 31), new Range32.ptr(917537, 917631, 1), new Range32.ptr(983040, 1048573, 1), new Range32.ptr(1048576, 1114109, 1)]), 2);
|
|
_Cc = new RangeTable.ptr(new sliceType([new Range16.ptr(0, 31, 1), new Range16.ptr(127, 159, 1)]), sliceType$1.nil, 2);
|
|
_Cf = new RangeTable.ptr(new sliceType([new Range16.ptr(173, 1536, 1363), new Range16.ptr(1537, 1541, 1), new Range16.ptr(1564, 1757, 193), new Range16.ptr(1807, 2274, 467), new Range16.ptr(6158, 8203, 2045), new Range16.ptr(8204, 8207, 1), new Range16.ptr(8234, 8238, 1), new Range16.ptr(8288, 8292, 1), new Range16.ptr(8294, 8303, 1), new Range16.ptr(65279, 65529, 250), new Range16.ptr(65530, 65531, 1)]), new sliceType$1([new Range32.ptr(69821, 113824, 44003), new Range32.ptr(113825, 113827, 1), new Range32.ptr(119155, 119162, 1), new Range32.ptr(917505, 917536, 31), new Range32.ptr(917537, 917631, 1)]), 0);
|
|
_Co = new RangeTable.ptr(new sliceType([new Range16.ptr(57344, 63743, 1)]), new sliceType$1([new Range32.ptr(983040, 1048573, 1), new Range32.ptr(1048576, 1114109, 1)]), 0);
|
|
_Cs = new RangeTable.ptr(new sliceType([new Range16.ptr(55296, 57343, 1)]), sliceType$1.nil, 0);
|
|
_L = new RangeTable.ptr(new sliceType([new Range16.ptr(65, 90, 1), new Range16.ptr(97, 122, 1), new Range16.ptr(170, 181, 11), new Range16.ptr(186, 192, 6), new Range16.ptr(193, 214, 1), new Range16.ptr(216, 246, 1), new Range16.ptr(248, 705, 1), new Range16.ptr(710, 721, 1), new Range16.ptr(736, 740, 1), new Range16.ptr(748, 750, 2), new Range16.ptr(880, 884, 1), new Range16.ptr(886, 887, 1), new Range16.ptr(890, 893, 1), new Range16.ptr(895, 902, 7), new Range16.ptr(904, 906, 1), new Range16.ptr(908, 910, 2), new Range16.ptr(911, 929, 1), new Range16.ptr(931, 1013, 1), new Range16.ptr(1015, 1153, 1), new Range16.ptr(1162, 1327, 1), new Range16.ptr(1329, 1366, 1), new Range16.ptr(1369, 1377, 8), new Range16.ptr(1378, 1415, 1), new Range16.ptr(1488, 1514, 1), new Range16.ptr(1520, 1522, 1), new Range16.ptr(1568, 1610, 1), new Range16.ptr(1646, 1647, 1), new Range16.ptr(1649, 1747, 1), new Range16.ptr(1749, 1765, 16), new Range16.ptr(1766, 1774, 8), new Range16.ptr(1775, 1786, 11), new Range16.ptr(1787, 1788, 1), new Range16.ptr(1791, 1808, 17), new Range16.ptr(1810, 1839, 1), new Range16.ptr(1869, 1957, 1), new Range16.ptr(1969, 1994, 25), new Range16.ptr(1995, 2026, 1), new Range16.ptr(2036, 2037, 1), new Range16.ptr(2042, 2048, 6), new Range16.ptr(2049, 2069, 1), new Range16.ptr(2074, 2084, 10), new Range16.ptr(2088, 2112, 24), new Range16.ptr(2113, 2136, 1), new Range16.ptr(2144, 2154, 1), new Range16.ptr(2208, 2228, 1), new Range16.ptr(2230, 2237, 1), new Range16.ptr(2308, 2361, 1), new Range16.ptr(2365, 2384, 19), new Range16.ptr(2392, 2401, 1), new Range16.ptr(2417, 2432, 1), new Range16.ptr(2437, 2444, 1), new Range16.ptr(2447, 2448, 1), new Range16.ptr(2451, 2472, 1), new Range16.ptr(2474, 2480, 1), new Range16.ptr(2482, 2486, 4), new Range16.ptr(2487, 2489, 1), new Range16.ptr(2493, 2510, 17), new Range16.ptr(2524, 2525, 1), new Range16.ptr(2527, 2529, 1), new Range16.ptr(2544, 2545, 1), new Range16.ptr(2556, 2565, 9), new Range16.ptr(2566, 2570, 1), new Range16.ptr(2575, 2576, 1), new Range16.ptr(2579, 2600, 1), new Range16.ptr(2602, 2608, 1), new Range16.ptr(2610, 2611, 1), new Range16.ptr(2613, 2614, 1), new Range16.ptr(2616, 2617, 1), new Range16.ptr(2649, 2652, 1), new Range16.ptr(2654, 2674, 20), new Range16.ptr(2675, 2676, 1), new Range16.ptr(2693, 2701, 1), new Range16.ptr(2703, 2705, 1), new Range16.ptr(2707, 2728, 1), new Range16.ptr(2730, 2736, 1), new Range16.ptr(2738, 2739, 1), new Range16.ptr(2741, 2745, 1), new Range16.ptr(2749, 2768, 19), new Range16.ptr(2784, 2785, 1), new Range16.ptr(2809, 2821, 12), new Range16.ptr(2822, 2828, 1), new Range16.ptr(2831, 2832, 1), new Range16.ptr(2835, 2856, 1), new Range16.ptr(2858, 2864, 1), new Range16.ptr(2866, 2867, 1), new Range16.ptr(2869, 2873, 1), new Range16.ptr(2877, 2908, 31), new Range16.ptr(2909, 2911, 2), new Range16.ptr(2912, 2913, 1), new Range16.ptr(2929, 2947, 18), new Range16.ptr(2949, 2954, 1), new Range16.ptr(2958, 2960, 1), new Range16.ptr(2962, 2965, 1), new Range16.ptr(2969, 2970, 1), new Range16.ptr(2972, 2974, 2), new Range16.ptr(2975, 2979, 4), new Range16.ptr(2980, 2984, 4), new Range16.ptr(2985, 2986, 1), new Range16.ptr(2990, 3001, 1), new Range16.ptr(3024, 3077, 53), new Range16.ptr(3078, 3084, 1), new Range16.ptr(3086, 3088, 1), new Range16.ptr(3090, 3112, 1), new Range16.ptr(3114, 3129, 1), new Range16.ptr(3133, 3160, 27), new Range16.ptr(3161, 3162, 1), new Range16.ptr(3168, 3169, 1), new Range16.ptr(3200, 3205, 5), new Range16.ptr(3206, 3212, 1), new Range16.ptr(3214, 3216, 1), new Range16.ptr(3218, 3240, 1), new Range16.ptr(3242, 3251, 1), new Range16.ptr(3253, 3257, 1), new Range16.ptr(3261, 3294, 33), new Range16.ptr(3296, 3297, 1), new Range16.ptr(3313, 3314, 1), new Range16.ptr(3333, 3340, 1), new Range16.ptr(3342, 3344, 1), new Range16.ptr(3346, 3386, 1), new Range16.ptr(3389, 3406, 17), new Range16.ptr(3412, 3414, 1), new Range16.ptr(3423, 3425, 1), new Range16.ptr(3450, 3455, 1), new Range16.ptr(3461, 3478, 1), new Range16.ptr(3482, 3505, 1), new Range16.ptr(3507, 3515, 1), new Range16.ptr(3517, 3520, 3), new Range16.ptr(3521, 3526, 1), new Range16.ptr(3585, 3632, 1), new Range16.ptr(3634, 3635, 1), new Range16.ptr(3648, 3654, 1), new Range16.ptr(3713, 3714, 1), new Range16.ptr(3716, 3719, 3), new Range16.ptr(3720, 3722, 2), new Range16.ptr(3725, 3732, 7), new Range16.ptr(3733, 3735, 1), new Range16.ptr(3737, 3743, 1), new Range16.ptr(3745, 3747, 1), new Range16.ptr(3749, 3751, 2), new Range16.ptr(3754, 3755, 1), new Range16.ptr(3757, 3760, 1), new Range16.ptr(3762, 3763, 1), new Range16.ptr(3773, 3776, 3), new Range16.ptr(3777, 3780, 1), new Range16.ptr(3782, 3804, 22), new Range16.ptr(3805, 3807, 1), new Range16.ptr(3840, 3904, 64), new Range16.ptr(3905, 3911, 1), new Range16.ptr(3913, 3948, 1), new Range16.ptr(3976, 3980, 1), new Range16.ptr(4096, 4138, 1), new Range16.ptr(4159, 4176, 17), new Range16.ptr(4177, 4181, 1), new Range16.ptr(4186, 4189, 1), new Range16.ptr(4193, 4197, 4), new Range16.ptr(4198, 4206, 8), new Range16.ptr(4207, 4208, 1), new Range16.ptr(4213, 4225, 1), new Range16.ptr(4238, 4256, 18), new Range16.ptr(4257, 4293, 1), new Range16.ptr(4295, 4301, 6), new Range16.ptr(4304, 4346, 1), new Range16.ptr(4348, 4680, 1), new Range16.ptr(4682, 4685, 1), new Range16.ptr(4688, 4694, 1), new Range16.ptr(4696, 4698, 2), new Range16.ptr(4699, 4701, 1), new Range16.ptr(4704, 4744, 1), new Range16.ptr(4746, 4749, 1), new Range16.ptr(4752, 4784, 1), new Range16.ptr(4786, 4789, 1), new Range16.ptr(4792, 4798, 1), new Range16.ptr(4800, 4802, 2), new Range16.ptr(4803, 4805, 1), new Range16.ptr(4808, 4822, 1), new Range16.ptr(4824, 4880, 1), new Range16.ptr(4882, 4885, 1), new Range16.ptr(4888, 4954, 1), new Range16.ptr(4992, 5007, 1), new Range16.ptr(5024, 5109, 1), new Range16.ptr(5112, 5117, 1), new Range16.ptr(5121, 5740, 1), new Range16.ptr(5743, 5759, 1), new Range16.ptr(5761, 5786, 1), new Range16.ptr(5792, 5866, 1), new Range16.ptr(5873, 5880, 1), new Range16.ptr(5888, 5900, 1), new Range16.ptr(5902, 5905, 1), new Range16.ptr(5920, 5937, 1), new Range16.ptr(5952, 5969, 1), new Range16.ptr(5984, 5996, 1), new Range16.ptr(5998, 6000, 1), new Range16.ptr(6016, 6067, 1), new Range16.ptr(6103, 6108, 5), new Range16.ptr(6176, 6263, 1), new Range16.ptr(6272, 6276, 1), new Range16.ptr(6279, 6312, 1), new Range16.ptr(6314, 6320, 6), new Range16.ptr(6321, 6389, 1), new Range16.ptr(6400, 6430, 1), new Range16.ptr(6480, 6509, 1), new Range16.ptr(6512, 6516, 1), new Range16.ptr(6528, 6571, 1), new Range16.ptr(6576, 6601, 1), new Range16.ptr(6656, 6678, 1), new Range16.ptr(6688, 6740, 1), new Range16.ptr(6823, 6917, 94), new Range16.ptr(6918, 6963, 1), new Range16.ptr(6981, 6987, 1), new Range16.ptr(7043, 7072, 1), new Range16.ptr(7086, 7087, 1), new Range16.ptr(7098, 7141, 1), new Range16.ptr(7168, 7203, 1), new Range16.ptr(7245, 7247, 1), new Range16.ptr(7258, 7293, 1), new Range16.ptr(7296, 7304, 1), new Range16.ptr(7401, 7404, 1), new Range16.ptr(7406, 7409, 1), new Range16.ptr(7413, 7414, 1), new Range16.ptr(7424, 7615, 1), new Range16.ptr(7680, 7957, 1), new Range16.ptr(7960, 7965, 1), new Range16.ptr(7968, 8005, 1), new Range16.ptr(8008, 8013, 1), new Range16.ptr(8016, 8023, 1), new Range16.ptr(8025, 8031, 2), new Range16.ptr(8032, 8061, 1), new Range16.ptr(8064, 8116, 1), new Range16.ptr(8118, 8124, 1), new Range16.ptr(8126, 8130, 4), new Range16.ptr(8131, 8132, 1), new Range16.ptr(8134, 8140, 1), new Range16.ptr(8144, 8147, 1), new Range16.ptr(8150, 8155, 1), new Range16.ptr(8160, 8172, 1), new Range16.ptr(8178, 8180, 1), new Range16.ptr(8182, 8188, 1), new Range16.ptr(8305, 8319, 14), new Range16.ptr(8336, 8348, 1), new Range16.ptr(8450, 8455, 5), new Range16.ptr(8458, 8467, 1), new Range16.ptr(8469, 8473, 4), new Range16.ptr(8474, 8477, 1), new Range16.ptr(8484, 8490, 2), new Range16.ptr(8491, 8493, 1), new Range16.ptr(8495, 8505, 1), new Range16.ptr(8508, 8511, 1), new Range16.ptr(8517, 8521, 1), new Range16.ptr(8526, 8579, 53), new Range16.ptr(8580, 11264, 2684), new Range16.ptr(11265, 11310, 1), new Range16.ptr(11312, 11358, 1), new Range16.ptr(11360, 11492, 1), new Range16.ptr(11499, 11502, 1), new Range16.ptr(11506, 11507, 1), new Range16.ptr(11520, 11557, 1), new Range16.ptr(11559, 11565, 6), new Range16.ptr(11568, 11623, 1), new Range16.ptr(11631, 11648, 17), new Range16.ptr(11649, 11670, 1), new Range16.ptr(11680, 11686, 1), new Range16.ptr(11688, 11694, 1), new Range16.ptr(11696, 11702, 1), new Range16.ptr(11704, 11710, 1), new Range16.ptr(11712, 11718, 1), new Range16.ptr(11720, 11726, 1), new Range16.ptr(11728, 11734, 1), new Range16.ptr(11736, 11742, 1), new Range16.ptr(11823, 12293, 470), new Range16.ptr(12294, 12337, 43), new Range16.ptr(12338, 12341, 1), new Range16.ptr(12347, 12348, 1), new Range16.ptr(12353, 12438, 1), new Range16.ptr(12445, 12447, 1), new Range16.ptr(12449, 12538, 1), new Range16.ptr(12540, 12543, 1), new Range16.ptr(12549, 12590, 1), new Range16.ptr(12593, 12686, 1), new Range16.ptr(12704, 12730, 1), new Range16.ptr(12784, 12799, 1), new Range16.ptr(13312, 19893, 1), new Range16.ptr(19968, 40938, 1), new Range16.ptr(40960, 42124, 1), new Range16.ptr(42192, 42237, 1), new Range16.ptr(42240, 42508, 1), new Range16.ptr(42512, 42527, 1), new Range16.ptr(42538, 42539, 1), new Range16.ptr(42560, 42606, 1), new Range16.ptr(42623, 42653, 1), new Range16.ptr(42656, 42725, 1), new Range16.ptr(42775, 42783, 1), new Range16.ptr(42786, 42888, 1), new Range16.ptr(42891, 42926, 1), new Range16.ptr(42928, 42935, 1), new Range16.ptr(42999, 43009, 1), new Range16.ptr(43011, 43013, 1), new Range16.ptr(43015, 43018, 1), new Range16.ptr(43020, 43042, 1), new Range16.ptr(43072, 43123, 1), new Range16.ptr(43138, 43187, 1), new Range16.ptr(43250, 43255, 1), new Range16.ptr(43259, 43261, 2), new Range16.ptr(43274, 43301, 1), new Range16.ptr(43312, 43334, 1), new Range16.ptr(43360, 43388, 1), new Range16.ptr(43396, 43442, 1), new Range16.ptr(43471, 43488, 17), new Range16.ptr(43489, 43492, 1), new Range16.ptr(43494, 43503, 1), new Range16.ptr(43514, 43518, 1), new Range16.ptr(43520, 43560, 1), new Range16.ptr(43584, 43586, 1), new Range16.ptr(43588, 43595, 1), new Range16.ptr(43616, 43638, 1), new Range16.ptr(43642, 43646, 4), new Range16.ptr(43647, 43695, 1), new Range16.ptr(43697, 43701, 4), new Range16.ptr(43702, 43705, 3), new Range16.ptr(43706, 43709, 1), new Range16.ptr(43712, 43714, 2), new Range16.ptr(43739, 43741, 1), new Range16.ptr(43744, 43754, 1), new Range16.ptr(43762, 43764, 1), new Range16.ptr(43777, 43782, 1), new Range16.ptr(43785, 43790, 1), new Range16.ptr(43793, 43798, 1), new Range16.ptr(43808, 43814, 1), new Range16.ptr(43816, 43822, 1), new Range16.ptr(43824, 43866, 1), new Range16.ptr(43868, 43877, 1), new Range16.ptr(43888, 44002, 1), new Range16.ptr(44032, 55203, 1), new Range16.ptr(55216, 55238, 1), new Range16.ptr(55243, 55291, 1), new Range16.ptr(63744, 64109, 1), new Range16.ptr(64112, 64217, 1), new Range16.ptr(64256, 64262, 1), new Range16.ptr(64275, 64279, 1), new Range16.ptr(64285, 64287, 2), new Range16.ptr(64288, 64296, 1), new Range16.ptr(64298, 64310, 1), new Range16.ptr(64312, 64316, 1), new Range16.ptr(64318, 64320, 2), new Range16.ptr(64321, 64323, 2), new Range16.ptr(64324, 64326, 2), new Range16.ptr(64327, 64433, 1), new Range16.ptr(64467, 64829, 1), new Range16.ptr(64848, 64911, 1), new Range16.ptr(64914, 64967, 1), new Range16.ptr(65008, 65019, 1), new Range16.ptr(65136, 65140, 1), new Range16.ptr(65142, 65276, 1), new Range16.ptr(65313, 65338, 1), new Range16.ptr(65345, 65370, 1), new Range16.ptr(65382, 65470, 1), new Range16.ptr(65474, 65479, 1), new Range16.ptr(65482, 65487, 1), new Range16.ptr(65490, 65495, 1), new Range16.ptr(65498, 65500, 1)]), new sliceType$1([new Range32.ptr(65536, 65547, 1), new Range32.ptr(65549, 65574, 1), new Range32.ptr(65576, 65594, 1), new Range32.ptr(65596, 65597, 1), new Range32.ptr(65599, 65613, 1), new Range32.ptr(65616, 65629, 1), new Range32.ptr(65664, 65786, 1), new Range32.ptr(66176, 66204, 1), new Range32.ptr(66208, 66256, 1), new Range32.ptr(66304, 66335, 1), new Range32.ptr(66349, 66368, 1), new Range32.ptr(66370, 66377, 1), new Range32.ptr(66384, 66421, 1), new Range32.ptr(66432, 66461, 1), new Range32.ptr(66464, 66499, 1), new Range32.ptr(66504, 66511, 1), new Range32.ptr(66560, 66717, 1), new Range32.ptr(66736, 66771, 1), new Range32.ptr(66776, 66811, 1), new Range32.ptr(66816, 66855, 1), new Range32.ptr(66864, 66915, 1), new Range32.ptr(67072, 67382, 1), new Range32.ptr(67392, 67413, 1), new Range32.ptr(67424, 67431, 1), new Range32.ptr(67584, 67589, 1), new Range32.ptr(67592, 67594, 2), new Range32.ptr(67595, 67637, 1), new Range32.ptr(67639, 67640, 1), new Range32.ptr(67644, 67647, 3), new Range32.ptr(67648, 67669, 1), new Range32.ptr(67680, 67702, 1), new Range32.ptr(67712, 67742, 1), new Range32.ptr(67808, 67826, 1), new Range32.ptr(67828, 67829, 1), new Range32.ptr(67840, 67861, 1), new Range32.ptr(67872, 67897, 1), new Range32.ptr(67968, 68023, 1), new Range32.ptr(68030, 68031, 1), new Range32.ptr(68096, 68112, 16), new Range32.ptr(68113, 68115, 1), new Range32.ptr(68117, 68119, 1), new Range32.ptr(68121, 68147, 1), new Range32.ptr(68192, 68220, 1), new Range32.ptr(68224, 68252, 1), new Range32.ptr(68288, 68295, 1), new Range32.ptr(68297, 68324, 1), new Range32.ptr(68352, 68405, 1), new Range32.ptr(68416, 68437, 1), new Range32.ptr(68448, 68466, 1), new Range32.ptr(68480, 68497, 1), new Range32.ptr(68608, 68680, 1), new Range32.ptr(68736, 68786, 1), new Range32.ptr(68800, 68850, 1), new Range32.ptr(69635, 69687, 1), new Range32.ptr(69763, 69807, 1), new Range32.ptr(69840, 69864, 1), new Range32.ptr(69891, 69926, 1), new Range32.ptr(69968, 70002, 1), new Range32.ptr(70006, 70019, 13), new Range32.ptr(70020, 70066, 1), new Range32.ptr(70081, 70084, 1), new Range32.ptr(70106, 70108, 2), new Range32.ptr(70144, 70161, 1), new Range32.ptr(70163, 70187, 1), new Range32.ptr(70272, 70278, 1), new Range32.ptr(70280, 70282, 2), new Range32.ptr(70283, 70285, 1), new Range32.ptr(70287, 70301, 1), new Range32.ptr(70303, 70312, 1), new Range32.ptr(70320, 70366, 1), new Range32.ptr(70405, 70412, 1), new Range32.ptr(70415, 70416, 1), new Range32.ptr(70419, 70440, 1), new Range32.ptr(70442, 70448, 1), new Range32.ptr(70450, 70451, 1), new Range32.ptr(70453, 70457, 1), new Range32.ptr(70461, 70480, 19), new Range32.ptr(70493, 70497, 1), new Range32.ptr(70656, 70708, 1), new Range32.ptr(70727, 70730, 1), new Range32.ptr(70784, 70831, 1), new Range32.ptr(70852, 70853, 1), new Range32.ptr(70855, 71040, 185), new Range32.ptr(71041, 71086, 1), new Range32.ptr(71128, 71131, 1), new Range32.ptr(71168, 71215, 1), new Range32.ptr(71236, 71296, 60), new Range32.ptr(71297, 71338, 1), new Range32.ptr(71424, 71449, 1), new Range32.ptr(71840, 71903, 1), new Range32.ptr(71935, 72192, 257), new Range32.ptr(72203, 72242, 1), new Range32.ptr(72250, 72272, 22), new Range32.ptr(72284, 72323, 1), new Range32.ptr(72326, 72329, 1), new Range32.ptr(72384, 72440, 1), new Range32.ptr(72704, 72712, 1), new Range32.ptr(72714, 72750, 1), new Range32.ptr(72768, 72818, 50), new Range32.ptr(72819, 72847, 1), new Range32.ptr(72960, 72966, 1), new Range32.ptr(72968, 72969, 1), new Range32.ptr(72971, 73008, 1), new Range32.ptr(73030, 73728, 698), new Range32.ptr(73729, 74649, 1), new Range32.ptr(74880, 75075, 1), new Range32.ptr(77824, 78894, 1), new Range32.ptr(82944, 83526, 1), new Range32.ptr(92160, 92728, 1), new Range32.ptr(92736, 92766, 1), new Range32.ptr(92880, 92909, 1), new Range32.ptr(92928, 92975, 1), new Range32.ptr(92992, 92995, 1), new Range32.ptr(93027, 93047, 1), new Range32.ptr(93053, 93071, 1), new Range32.ptr(93952, 94020, 1), new Range32.ptr(94032, 94099, 67), new Range32.ptr(94100, 94111, 1), new Range32.ptr(94176, 94177, 1), new Range32.ptr(94208, 100332, 1), new Range32.ptr(100352, 101106, 1), new Range32.ptr(110592, 110878, 1), new Range32.ptr(110960, 111355, 1), new Range32.ptr(113664, 113770, 1), new Range32.ptr(113776, 113788, 1), new Range32.ptr(113792, 113800, 1), new Range32.ptr(113808, 113817, 1), new Range32.ptr(119808, 119892, 1), new Range32.ptr(119894, 119964, 1), new Range32.ptr(119966, 119967, 1), new Range32.ptr(119970, 119973, 3), new Range32.ptr(119974, 119977, 3), new Range32.ptr(119978, 119980, 1), new Range32.ptr(119982, 119993, 1), new Range32.ptr(119995, 119997, 2), new Range32.ptr(119998, 120003, 1), new Range32.ptr(120005, 120069, 1), new Range32.ptr(120071, 120074, 1), new Range32.ptr(120077, 120084, 1), new Range32.ptr(120086, 120092, 1), new Range32.ptr(120094, 120121, 1), new Range32.ptr(120123, 120126, 1), new Range32.ptr(120128, 120132, 1), new Range32.ptr(120134, 120138, 4), new Range32.ptr(120139, 120144, 1), new Range32.ptr(120146, 120485, 1), new Range32.ptr(120488, 120512, 1), new Range32.ptr(120514, 120538, 1), new Range32.ptr(120540, 120570, 1), new Range32.ptr(120572, 120596, 1), new Range32.ptr(120598, 120628, 1), new Range32.ptr(120630, 120654, 1), new Range32.ptr(120656, 120686, 1), new Range32.ptr(120688, 120712, 1), new Range32.ptr(120714, 120744, 1), new Range32.ptr(120746, 120770, 1), new Range32.ptr(120772, 120779, 1), new Range32.ptr(124928, 125124, 1), new Range32.ptr(125184, 125251, 1), new Range32.ptr(126464, 126467, 1), new Range32.ptr(126469, 126495, 1), new Range32.ptr(126497, 126498, 1), new Range32.ptr(126500, 126503, 3), new Range32.ptr(126505, 126514, 1), new Range32.ptr(126516, 126519, 1), new Range32.ptr(126521, 126523, 2), new Range32.ptr(126530, 126535, 5), new Range32.ptr(126537, 126541, 2), new Range32.ptr(126542, 126543, 1), new Range32.ptr(126545, 126546, 1), new Range32.ptr(126548, 126551, 3), new Range32.ptr(126553, 126561, 2), new Range32.ptr(126562, 126564, 2), new Range32.ptr(126567, 126570, 1), new Range32.ptr(126572, 126578, 1), new Range32.ptr(126580, 126583, 1), new Range32.ptr(126585, 126588, 1), new Range32.ptr(126590, 126592, 2), new Range32.ptr(126593, 126601, 1), new Range32.ptr(126603, 126619, 1), new Range32.ptr(126625, 126627, 1), new Range32.ptr(126629, 126633, 1), new Range32.ptr(126635, 126651, 1), new Range32.ptr(131072, 173782, 1), new Range32.ptr(173824, 177972, 1), new Range32.ptr(177984, 178205, 1), new Range32.ptr(178208, 183969, 1), new Range32.ptr(183984, 191456, 1), new Range32.ptr(194560, 195101, 1)]), 6);
|
|
_Ll = new RangeTable.ptr(new sliceType([new Range16.ptr(97, 122, 1), new Range16.ptr(181, 223, 42), new Range16.ptr(224, 246, 1), new Range16.ptr(248, 255, 1), new Range16.ptr(257, 311, 2), new Range16.ptr(312, 328, 2), new Range16.ptr(329, 375, 2), new Range16.ptr(378, 382, 2), new Range16.ptr(383, 384, 1), new Range16.ptr(387, 389, 2), new Range16.ptr(392, 396, 4), new Range16.ptr(397, 402, 5), new Range16.ptr(405, 409, 4), new Range16.ptr(410, 411, 1), new Range16.ptr(414, 417, 3), new Range16.ptr(419, 421, 2), new Range16.ptr(424, 426, 2), new Range16.ptr(427, 429, 2), new Range16.ptr(432, 436, 4), new Range16.ptr(438, 441, 3), new Range16.ptr(442, 445, 3), new Range16.ptr(446, 447, 1), new Range16.ptr(454, 460, 3), new Range16.ptr(462, 476, 2), new Range16.ptr(477, 495, 2), new Range16.ptr(496, 499, 3), new Range16.ptr(501, 505, 4), new Range16.ptr(507, 563, 2), new Range16.ptr(564, 569, 1), new Range16.ptr(572, 575, 3), new Range16.ptr(576, 578, 2), new Range16.ptr(583, 591, 2), new Range16.ptr(592, 659, 1), new Range16.ptr(661, 687, 1), new Range16.ptr(881, 883, 2), new Range16.ptr(887, 891, 4), new Range16.ptr(892, 893, 1), new Range16.ptr(912, 940, 28), new Range16.ptr(941, 974, 1), new Range16.ptr(976, 977, 1), new Range16.ptr(981, 983, 1), new Range16.ptr(985, 1007, 2), new Range16.ptr(1008, 1011, 1), new Range16.ptr(1013, 1019, 3), new Range16.ptr(1020, 1072, 52), new Range16.ptr(1073, 1119, 1), new Range16.ptr(1121, 1153, 2), new Range16.ptr(1163, 1215, 2), new Range16.ptr(1218, 1230, 2), new Range16.ptr(1231, 1327, 2), new Range16.ptr(1377, 1415, 1), new Range16.ptr(5112, 5117, 1), new Range16.ptr(7296, 7304, 1), new Range16.ptr(7424, 7467, 1), new Range16.ptr(7531, 7543, 1), new Range16.ptr(7545, 7578, 1), new Range16.ptr(7681, 7829, 2), new Range16.ptr(7830, 7837, 1), new Range16.ptr(7839, 7935, 2), new Range16.ptr(7936, 7943, 1), new Range16.ptr(7952, 7957, 1), new Range16.ptr(7968, 7975, 1), new Range16.ptr(7984, 7991, 1), new Range16.ptr(8000, 8005, 1), new Range16.ptr(8016, 8023, 1), new Range16.ptr(8032, 8039, 1), new Range16.ptr(8048, 8061, 1), new Range16.ptr(8064, 8071, 1), new Range16.ptr(8080, 8087, 1), new Range16.ptr(8096, 8103, 1), new Range16.ptr(8112, 8116, 1), new Range16.ptr(8118, 8119, 1), new Range16.ptr(8126, 8130, 4), new Range16.ptr(8131, 8132, 1), new Range16.ptr(8134, 8135, 1), new Range16.ptr(8144, 8147, 1), new Range16.ptr(8150, 8151, 1), new Range16.ptr(8160, 8167, 1), new Range16.ptr(8178, 8180, 1), new Range16.ptr(8182, 8183, 1), new Range16.ptr(8458, 8462, 4), new Range16.ptr(8463, 8467, 4), new Range16.ptr(8495, 8505, 5), new Range16.ptr(8508, 8509, 1), new Range16.ptr(8518, 8521, 1), new Range16.ptr(8526, 8580, 54), new Range16.ptr(11312, 11358, 1), new Range16.ptr(11361, 11365, 4), new Range16.ptr(11366, 11372, 2), new Range16.ptr(11377, 11379, 2), new Range16.ptr(11380, 11382, 2), new Range16.ptr(11383, 11387, 1), new Range16.ptr(11393, 11491, 2), new Range16.ptr(11492, 11500, 8), new Range16.ptr(11502, 11507, 5), new Range16.ptr(11520, 11557, 1), new Range16.ptr(11559, 11565, 6), new Range16.ptr(42561, 42605, 2), new Range16.ptr(42625, 42651, 2), new Range16.ptr(42787, 42799, 2), new Range16.ptr(42800, 42801, 1), new Range16.ptr(42803, 42865, 2), new Range16.ptr(42866, 42872, 1), new Range16.ptr(42874, 42876, 2), new Range16.ptr(42879, 42887, 2), new Range16.ptr(42892, 42894, 2), new Range16.ptr(42897, 42899, 2), new Range16.ptr(42900, 42901, 1), new Range16.ptr(42903, 42921, 2), new Range16.ptr(42933, 42935, 2), new Range16.ptr(43002, 43824, 822), new Range16.ptr(43825, 43866, 1), new Range16.ptr(43872, 43877, 1), new Range16.ptr(43888, 43967, 1), new Range16.ptr(64256, 64262, 1), new Range16.ptr(64275, 64279, 1), new Range16.ptr(65345, 65370, 1)]), new sliceType$1([new Range32.ptr(66600, 66639, 1), new Range32.ptr(66776, 66811, 1), new Range32.ptr(68800, 68850, 1), new Range32.ptr(71872, 71903, 1), new Range32.ptr(119834, 119859, 1), new Range32.ptr(119886, 119892, 1), new Range32.ptr(119894, 119911, 1), new Range32.ptr(119938, 119963, 1), new Range32.ptr(119990, 119993, 1), new Range32.ptr(119995, 119997, 2), new Range32.ptr(119998, 120003, 1), new Range32.ptr(120005, 120015, 1), new Range32.ptr(120042, 120067, 1), new Range32.ptr(120094, 120119, 1), new Range32.ptr(120146, 120171, 1), new Range32.ptr(120198, 120223, 1), new Range32.ptr(120250, 120275, 1), new Range32.ptr(120302, 120327, 1), new Range32.ptr(120354, 120379, 1), new Range32.ptr(120406, 120431, 1), new Range32.ptr(120458, 120485, 1), new Range32.ptr(120514, 120538, 1), new Range32.ptr(120540, 120545, 1), new Range32.ptr(120572, 120596, 1), new Range32.ptr(120598, 120603, 1), new Range32.ptr(120630, 120654, 1), new Range32.ptr(120656, 120661, 1), new Range32.ptr(120688, 120712, 1), new Range32.ptr(120714, 120719, 1), new Range32.ptr(120746, 120770, 1), new Range32.ptr(120772, 120777, 1), new Range32.ptr(120779, 125218, 4439), new Range32.ptr(125219, 125251, 1)]), 4);
|
|
_Lm = new RangeTable.ptr(new sliceType([new Range16.ptr(688, 705, 1), new Range16.ptr(710, 721, 1), new Range16.ptr(736, 740, 1), new Range16.ptr(748, 750, 2), new Range16.ptr(884, 890, 6), new Range16.ptr(1369, 1600, 231), new Range16.ptr(1765, 1766, 1), new Range16.ptr(2036, 2037, 1), new Range16.ptr(2042, 2074, 32), new Range16.ptr(2084, 2088, 4), new Range16.ptr(2417, 3654, 1237), new Range16.ptr(3782, 4348, 566), new Range16.ptr(6103, 6211, 108), new Range16.ptr(6823, 7288, 465), new Range16.ptr(7289, 7293, 1), new Range16.ptr(7468, 7530, 1), new Range16.ptr(7544, 7579, 35), new Range16.ptr(7580, 7615, 1), new Range16.ptr(8305, 8319, 14), new Range16.ptr(8336, 8348, 1), new Range16.ptr(11388, 11389, 1), new Range16.ptr(11631, 11823, 192), new Range16.ptr(12293, 12337, 44), new Range16.ptr(12338, 12341, 1), new Range16.ptr(12347, 12445, 98), new Range16.ptr(12446, 12540, 94), new Range16.ptr(12541, 12542, 1), new Range16.ptr(40981, 42232, 1251), new Range16.ptr(42233, 42237, 1), new Range16.ptr(42508, 42623, 115), new Range16.ptr(42652, 42653, 1), new Range16.ptr(42775, 42783, 1), new Range16.ptr(42864, 42888, 24), new Range16.ptr(43000, 43001, 1), new Range16.ptr(43471, 43494, 23), new Range16.ptr(43632, 43741, 109), new Range16.ptr(43763, 43764, 1), new Range16.ptr(43868, 43871, 1), new Range16.ptr(65392, 65438, 46), new Range16.ptr(65439, 65439, 1)]), new sliceType$1([new Range32.ptr(92992, 92992, 1), new Range32.ptr(92993, 92995, 1), new Range32.ptr(94099, 94111, 1), new Range32.ptr(94176, 94177, 1)]), 0);
|
|
_Lo = new RangeTable.ptr(new sliceType([new Range16.ptr(170, 186, 16), new Range16.ptr(443, 448, 5), new Range16.ptr(449, 451, 1), new Range16.ptr(660, 1488, 828), new Range16.ptr(1489, 1514, 1), new Range16.ptr(1520, 1522, 1), new Range16.ptr(1568, 1599, 1), new Range16.ptr(1601, 1610, 1), new Range16.ptr(1646, 1647, 1), new Range16.ptr(1649, 1747, 1), new Range16.ptr(1749, 1774, 25), new Range16.ptr(1775, 1786, 11), new Range16.ptr(1787, 1788, 1), new Range16.ptr(1791, 1808, 17), new Range16.ptr(1810, 1839, 1), new Range16.ptr(1869, 1957, 1), new Range16.ptr(1969, 1994, 25), new Range16.ptr(1995, 2026, 1), new Range16.ptr(2048, 2069, 1), new Range16.ptr(2112, 2136, 1), new Range16.ptr(2144, 2154, 1), new Range16.ptr(2208, 2228, 1), new Range16.ptr(2230, 2237, 1), new Range16.ptr(2308, 2361, 1), new Range16.ptr(2365, 2384, 19), new Range16.ptr(2392, 2401, 1), new Range16.ptr(2418, 2432, 1), new Range16.ptr(2437, 2444, 1), new Range16.ptr(2447, 2448, 1), new Range16.ptr(2451, 2472, 1), new Range16.ptr(2474, 2480, 1), new Range16.ptr(2482, 2486, 4), new Range16.ptr(2487, 2489, 1), new Range16.ptr(2493, 2510, 17), new Range16.ptr(2524, 2525, 1), new Range16.ptr(2527, 2529, 1), new Range16.ptr(2544, 2545, 1), new Range16.ptr(2556, 2565, 9), new Range16.ptr(2566, 2570, 1), new Range16.ptr(2575, 2576, 1), new Range16.ptr(2579, 2600, 1), new Range16.ptr(2602, 2608, 1), new Range16.ptr(2610, 2611, 1), new Range16.ptr(2613, 2614, 1), new Range16.ptr(2616, 2617, 1), new Range16.ptr(2649, 2652, 1), new Range16.ptr(2654, 2674, 20), new Range16.ptr(2675, 2676, 1), new Range16.ptr(2693, 2701, 1), new Range16.ptr(2703, 2705, 1), new Range16.ptr(2707, 2728, 1), new Range16.ptr(2730, 2736, 1), new Range16.ptr(2738, 2739, 1), new Range16.ptr(2741, 2745, 1), new Range16.ptr(2749, 2768, 19), new Range16.ptr(2784, 2785, 1), new Range16.ptr(2809, 2821, 12), new Range16.ptr(2822, 2828, 1), new Range16.ptr(2831, 2832, 1), new Range16.ptr(2835, 2856, 1), new Range16.ptr(2858, 2864, 1), new Range16.ptr(2866, 2867, 1), new Range16.ptr(2869, 2873, 1), new Range16.ptr(2877, 2908, 31), new Range16.ptr(2909, 2911, 2), new Range16.ptr(2912, 2913, 1), new Range16.ptr(2929, 2947, 18), new Range16.ptr(2949, 2954, 1), new Range16.ptr(2958, 2960, 1), new Range16.ptr(2962, 2965, 1), new Range16.ptr(2969, 2970, 1), new Range16.ptr(2972, 2974, 2), new Range16.ptr(2975, 2979, 4), new Range16.ptr(2980, 2984, 4), new Range16.ptr(2985, 2986, 1), new Range16.ptr(2990, 3001, 1), new Range16.ptr(3024, 3077, 53), new Range16.ptr(3078, 3084, 1), new Range16.ptr(3086, 3088, 1), new Range16.ptr(3090, 3112, 1), new Range16.ptr(3114, 3129, 1), new Range16.ptr(3133, 3160, 27), new Range16.ptr(3161, 3162, 1), new Range16.ptr(3168, 3169, 1), new Range16.ptr(3200, 3205, 5), new Range16.ptr(3206, 3212, 1), new Range16.ptr(3214, 3216, 1), new Range16.ptr(3218, 3240, 1), new Range16.ptr(3242, 3251, 1), new Range16.ptr(3253, 3257, 1), new Range16.ptr(3261, 3294, 33), new Range16.ptr(3296, 3297, 1), new Range16.ptr(3313, 3314, 1), new Range16.ptr(3333, 3340, 1), new Range16.ptr(3342, 3344, 1), new Range16.ptr(3346, 3386, 1), new Range16.ptr(3389, 3406, 17), new Range16.ptr(3412, 3414, 1), new Range16.ptr(3423, 3425, 1), new Range16.ptr(3450, 3455, 1), new Range16.ptr(3461, 3478, 1), new Range16.ptr(3482, 3505, 1), new Range16.ptr(3507, 3515, 1), new Range16.ptr(3517, 3520, 3), new Range16.ptr(3521, 3526, 1), new Range16.ptr(3585, 3632, 1), new Range16.ptr(3634, 3635, 1), new Range16.ptr(3648, 3653, 1), new Range16.ptr(3713, 3714, 1), new Range16.ptr(3716, 3719, 3), new Range16.ptr(3720, 3722, 2), new Range16.ptr(3725, 3732, 7), new Range16.ptr(3733, 3735, 1), new Range16.ptr(3737, 3743, 1), new Range16.ptr(3745, 3747, 1), new Range16.ptr(3749, 3751, 2), new Range16.ptr(3754, 3755, 1), new Range16.ptr(3757, 3760, 1), new Range16.ptr(3762, 3763, 1), new Range16.ptr(3773, 3776, 3), new Range16.ptr(3777, 3780, 1), new Range16.ptr(3804, 3807, 1), new Range16.ptr(3840, 3904, 64), new Range16.ptr(3905, 3911, 1), new Range16.ptr(3913, 3948, 1), new Range16.ptr(3976, 3980, 1), new Range16.ptr(4096, 4138, 1), new Range16.ptr(4159, 4176, 17), new Range16.ptr(4177, 4181, 1), new Range16.ptr(4186, 4189, 1), new Range16.ptr(4193, 4197, 4), new Range16.ptr(4198, 4206, 8), new Range16.ptr(4207, 4208, 1), new Range16.ptr(4213, 4225, 1), new Range16.ptr(4238, 4304, 66), new Range16.ptr(4305, 4346, 1), new Range16.ptr(4349, 4680, 1), new Range16.ptr(4682, 4685, 1), new Range16.ptr(4688, 4694, 1), new Range16.ptr(4696, 4698, 2), new Range16.ptr(4699, 4701, 1), new Range16.ptr(4704, 4744, 1), new Range16.ptr(4746, 4749, 1), new Range16.ptr(4752, 4784, 1), new Range16.ptr(4786, 4789, 1), new Range16.ptr(4792, 4798, 1), new Range16.ptr(4800, 4802, 2), new Range16.ptr(4803, 4805, 1), new Range16.ptr(4808, 4822, 1), new Range16.ptr(4824, 4880, 1), new Range16.ptr(4882, 4885, 1), new Range16.ptr(4888, 4954, 1), new Range16.ptr(4992, 5007, 1), new Range16.ptr(5121, 5740, 1), new Range16.ptr(5743, 5759, 1), new Range16.ptr(5761, 5786, 1), new Range16.ptr(5792, 5866, 1), new Range16.ptr(5873, 5880, 1), new Range16.ptr(5888, 5900, 1), new Range16.ptr(5902, 5905, 1), new Range16.ptr(5920, 5937, 1), new Range16.ptr(5952, 5969, 1), new Range16.ptr(5984, 5996, 1), new Range16.ptr(5998, 6000, 1), new Range16.ptr(6016, 6067, 1), new Range16.ptr(6108, 6176, 68), new Range16.ptr(6177, 6210, 1), new Range16.ptr(6212, 6263, 1), new Range16.ptr(6272, 6276, 1), new Range16.ptr(6279, 6312, 1), new Range16.ptr(6314, 6320, 6), new Range16.ptr(6321, 6389, 1), new Range16.ptr(6400, 6430, 1), new Range16.ptr(6480, 6509, 1), new Range16.ptr(6512, 6516, 1), new Range16.ptr(6528, 6571, 1), new Range16.ptr(6576, 6601, 1), new Range16.ptr(6656, 6678, 1), new Range16.ptr(6688, 6740, 1), new Range16.ptr(6917, 6963, 1), new Range16.ptr(6981, 6987, 1), new Range16.ptr(7043, 7072, 1), new Range16.ptr(7086, 7087, 1), new Range16.ptr(7098, 7141, 1), new Range16.ptr(7168, 7203, 1), new Range16.ptr(7245, 7247, 1), new Range16.ptr(7258, 7287, 1), new Range16.ptr(7401, 7404, 1), new Range16.ptr(7406, 7409, 1), new Range16.ptr(7413, 7414, 1), new Range16.ptr(8501, 8504, 1), new Range16.ptr(11568, 11623, 1), new Range16.ptr(11648, 11670, 1), new Range16.ptr(11680, 11686, 1), new Range16.ptr(11688, 11694, 1), new Range16.ptr(11696, 11702, 1), new Range16.ptr(11704, 11710, 1), new Range16.ptr(11712, 11718, 1), new Range16.ptr(11720, 11726, 1), new Range16.ptr(11728, 11734, 1), new Range16.ptr(11736, 11742, 1), new Range16.ptr(12294, 12348, 54), new Range16.ptr(12353, 12438, 1), new Range16.ptr(12447, 12449, 2), new Range16.ptr(12450, 12538, 1), new Range16.ptr(12543, 12549, 6), new Range16.ptr(12550, 12590, 1), new Range16.ptr(12593, 12686, 1), new Range16.ptr(12704, 12730, 1), new Range16.ptr(12784, 12799, 1), new Range16.ptr(13312, 19893, 1), new Range16.ptr(19968, 40938, 1), new Range16.ptr(40960, 40980, 1), new Range16.ptr(40982, 42124, 1), new Range16.ptr(42192, 42231, 1), new Range16.ptr(42240, 42507, 1), new Range16.ptr(42512, 42527, 1), new Range16.ptr(42538, 42539, 1), new Range16.ptr(42606, 42656, 50), new Range16.ptr(42657, 42725, 1), new Range16.ptr(42895, 42999, 104), new Range16.ptr(43003, 43009, 1), new Range16.ptr(43011, 43013, 1), new Range16.ptr(43015, 43018, 1), new Range16.ptr(43020, 43042, 1), new Range16.ptr(43072, 43123, 1), new Range16.ptr(43138, 43187, 1), new Range16.ptr(43250, 43255, 1), new Range16.ptr(43259, 43261, 2), new Range16.ptr(43274, 43301, 1), new Range16.ptr(43312, 43334, 1), new Range16.ptr(43360, 43388, 1), new Range16.ptr(43396, 43442, 1), new Range16.ptr(43488, 43492, 1), new Range16.ptr(43495, 43503, 1), new Range16.ptr(43514, 43518, 1), new Range16.ptr(43520, 43560, 1), new Range16.ptr(43584, 43586, 1), new Range16.ptr(43588, 43595, 1), new Range16.ptr(43616, 43631, 1), new Range16.ptr(43633, 43638, 1), new Range16.ptr(43642, 43646, 4), new Range16.ptr(43647, 43695, 1), new Range16.ptr(43697, 43701, 4), new Range16.ptr(43702, 43705, 3), new Range16.ptr(43706, 43709, 1), new Range16.ptr(43712, 43714, 2), new Range16.ptr(43739, 43740, 1), new Range16.ptr(43744, 43754, 1), new Range16.ptr(43762, 43777, 15), new Range16.ptr(43778, 43782, 1), new Range16.ptr(43785, 43790, 1), new Range16.ptr(43793, 43798, 1), new Range16.ptr(43808, 43814, 1), new Range16.ptr(43816, 43822, 1), new Range16.ptr(43968, 44002, 1), new Range16.ptr(44032, 55203, 1), new Range16.ptr(55216, 55238, 1), new Range16.ptr(55243, 55291, 1), new Range16.ptr(63744, 64109, 1), new Range16.ptr(64112, 64217, 1), new Range16.ptr(64285, 64287, 2), new Range16.ptr(64288, 64296, 1), new Range16.ptr(64298, 64310, 1), new Range16.ptr(64312, 64316, 1), new Range16.ptr(64318, 64320, 2), new Range16.ptr(64321, 64323, 2), new Range16.ptr(64324, 64326, 2), new Range16.ptr(64327, 64433, 1), new Range16.ptr(64467, 64829, 1), new Range16.ptr(64848, 64911, 1), new Range16.ptr(64914, 64967, 1), new Range16.ptr(65008, 65019, 1), new Range16.ptr(65136, 65140, 1), new Range16.ptr(65142, 65276, 1), new Range16.ptr(65382, 65391, 1), new Range16.ptr(65393, 65437, 1), new Range16.ptr(65440, 65470, 1), new Range16.ptr(65474, 65479, 1), new Range16.ptr(65482, 65487, 1), new Range16.ptr(65490, 65495, 1), new Range16.ptr(65498, 65500, 1)]), new sliceType$1([new Range32.ptr(65536, 65547, 1), new Range32.ptr(65549, 65574, 1), new Range32.ptr(65576, 65594, 1), new Range32.ptr(65596, 65597, 1), new Range32.ptr(65599, 65613, 1), new Range32.ptr(65616, 65629, 1), new Range32.ptr(65664, 65786, 1), new Range32.ptr(66176, 66204, 1), new Range32.ptr(66208, 66256, 1), new Range32.ptr(66304, 66335, 1), new Range32.ptr(66349, 66368, 1), new Range32.ptr(66370, 66377, 1), new Range32.ptr(66384, 66421, 1), new Range32.ptr(66432, 66461, 1), new Range32.ptr(66464, 66499, 1), new Range32.ptr(66504, 66511, 1), new Range32.ptr(66640, 66717, 1), new Range32.ptr(66816, 66855, 1), new Range32.ptr(66864, 66915, 1), new Range32.ptr(67072, 67382, 1), new Range32.ptr(67392, 67413, 1), new Range32.ptr(67424, 67431, 1), new Range32.ptr(67584, 67589, 1), new Range32.ptr(67592, 67594, 2), new Range32.ptr(67595, 67637, 1), new Range32.ptr(67639, 67640, 1), new Range32.ptr(67644, 67647, 3), new Range32.ptr(67648, 67669, 1), new Range32.ptr(67680, 67702, 1), new Range32.ptr(67712, 67742, 1), new Range32.ptr(67808, 67826, 1), new Range32.ptr(67828, 67829, 1), new Range32.ptr(67840, 67861, 1), new Range32.ptr(67872, 67897, 1), new Range32.ptr(67968, 68023, 1), new Range32.ptr(68030, 68031, 1), new Range32.ptr(68096, 68112, 16), new Range32.ptr(68113, 68115, 1), new Range32.ptr(68117, 68119, 1), new Range32.ptr(68121, 68147, 1), new Range32.ptr(68192, 68220, 1), new Range32.ptr(68224, 68252, 1), new Range32.ptr(68288, 68295, 1), new Range32.ptr(68297, 68324, 1), new Range32.ptr(68352, 68405, 1), new Range32.ptr(68416, 68437, 1), new Range32.ptr(68448, 68466, 1), new Range32.ptr(68480, 68497, 1), new Range32.ptr(68608, 68680, 1), new Range32.ptr(69635, 69687, 1), new Range32.ptr(69763, 69807, 1), new Range32.ptr(69840, 69864, 1), new Range32.ptr(69891, 69926, 1), new Range32.ptr(69968, 70002, 1), new Range32.ptr(70006, 70019, 13), new Range32.ptr(70020, 70066, 1), new Range32.ptr(70081, 70084, 1), new Range32.ptr(70106, 70108, 2), new Range32.ptr(70144, 70161, 1), new Range32.ptr(70163, 70187, 1), new Range32.ptr(70272, 70278, 1), new Range32.ptr(70280, 70282, 2), new Range32.ptr(70283, 70285, 1), new Range32.ptr(70287, 70301, 1), new Range32.ptr(70303, 70312, 1), new Range32.ptr(70320, 70366, 1), new Range32.ptr(70405, 70412, 1), new Range32.ptr(70415, 70416, 1), new Range32.ptr(70419, 70440, 1), new Range32.ptr(70442, 70448, 1), new Range32.ptr(70450, 70451, 1), new Range32.ptr(70453, 70457, 1), new Range32.ptr(70461, 70480, 19), new Range32.ptr(70493, 70497, 1), new Range32.ptr(70656, 70708, 1), new Range32.ptr(70727, 70730, 1), new Range32.ptr(70784, 70831, 1), new Range32.ptr(70852, 70853, 1), new Range32.ptr(70855, 71040, 185), new Range32.ptr(71041, 71086, 1), new Range32.ptr(71128, 71131, 1), new Range32.ptr(71168, 71215, 1), new Range32.ptr(71236, 71296, 60), new Range32.ptr(71297, 71338, 1), new Range32.ptr(71424, 71449, 1), new Range32.ptr(71935, 72192, 257), new Range32.ptr(72203, 72242, 1), new Range32.ptr(72250, 72272, 22), new Range32.ptr(72284, 72323, 1), new Range32.ptr(72326, 72329, 1), new Range32.ptr(72384, 72440, 1), new Range32.ptr(72704, 72712, 1), new Range32.ptr(72714, 72750, 1), new Range32.ptr(72768, 72818, 50), new Range32.ptr(72819, 72847, 1), new Range32.ptr(72960, 72966, 1), new Range32.ptr(72968, 72969, 1), new Range32.ptr(72971, 73008, 1), new Range32.ptr(73030, 73728, 698), new Range32.ptr(73729, 74649, 1), new Range32.ptr(74880, 75075, 1), new Range32.ptr(77824, 78894, 1), new Range32.ptr(82944, 83526, 1), new Range32.ptr(92160, 92728, 1), new Range32.ptr(92736, 92766, 1), new Range32.ptr(92880, 92909, 1), new Range32.ptr(92928, 92975, 1), new Range32.ptr(93027, 93047, 1), new Range32.ptr(93053, 93071, 1), new Range32.ptr(93952, 94020, 1), new Range32.ptr(94032, 94208, 176), new Range32.ptr(94209, 100332, 1), new Range32.ptr(100352, 101106, 1), new Range32.ptr(110592, 110878, 1), new Range32.ptr(110960, 111355, 1), new Range32.ptr(113664, 113770, 1), new Range32.ptr(113776, 113788, 1), new Range32.ptr(113792, 113800, 1), new Range32.ptr(113808, 113817, 1), new Range32.ptr(124928, 125124, 1), new Range32.ptr(126464, 126467, 1), new Range32.ptr(126469, 126495, 1), new Range32.ptr(126497, 126498, 1), new Range32.ptr(126500, 126503, 3), new Range32.ptr(126505, 126514, 1), new Range32.ptr(126516, 126519, 1), new Range32.ptr(126521, 126523, 2), new Range32.ptr(126530, 126535, 5), new Range32.ptr(126537, 126541, 2), new Range32.ptr(126542, 126543, 1), new Range32.ptr(126545, 126546, 1), new Range32.ptr(126548, 126551, 3), new Range32.ptr(126553, 126561, 2), new Range32.ptr(126562, 126564, 2), new Range32.ptr(126567, 126570, 1), new Range32.ptr(126572, 126578, 1), new Range32.ptr(126580, 126583, 1), new Range32.ptr(126585, 126588, 1), new Range32.ptr(126590, 126592, 2), new Range32.ptr(126593, 126601, 1), new Range32.ptr(126603, 126619, 1), new Range32.ptr(126625, 126627, 1), new Range32.ptr(126629, 126633, 1), new Range32.ptr(126635, 126651, 1), new Range32.ptr(131072, 173782, 1), new Range32.ptr(173824, 177972, 1), new Range32.ptr(177984, 178205, 1), new Range32.ptr(178208, 183969, 1), new Range32.ptr(183984, 191456, 1), new Range32.ptr(194560, 195101, 1)]), 1);
|
|
_Lt = new RangeTable.ptr(new sliceType([new Range16.ptr(453, 459, 3), new Range16.ptr(498, 8072, 7574), new Range16.ptr(8073, 8079, 1), new Range16.ptr(8088, 8095, 1), new Range16.ptr(8104, 8111, 1), new Range16.ptr(8124, 8140, 16), new Range16.ptr(8188, 8188, 1)]), sliceType$1.nil, 0);
|
|
_Lu = new RangeTable.ptr(new sliceType([new Range16.ptr(65, 90, 1), new Range16.ptr(192, 214, 1), new Range16.ptr(216, 222, 1), new Range16.ptr(256, 310, 2), new Range16.ptr(313, 327, 2), new Range16.ptr(330, 376, 2), new Range16.ptr(377, 381, 2), new Range16.ptr(385, 386, 1), new Range16.ptr(388, 390, 2), new Range16.ptr(391, 393, 2), new Range16.ptr(394, 395, 1), new Range16.ptr(398, 401, 1), new Range16.ptr(403, 404, 1), new Range16.ptr(406, 408, 1), new Range16.ptr(412, 413, 1), new Range16.ptr(415, 416, 1), new Range16.ptr(418, 422, 2), new Range16.ptr(423, 425, 2), new Range16.ptr(428, 430, 2), new Range16.ptr(431, 433, 2), new Range16.ptr(434, 435, 1), new Range16.ptr(437, 439, 2), new Range16.ptr(440, 444, 4), new Range16.ptr(452, 461, 3), new Range16.ptr(463, 475, 2), new Range16.ptr(478, 494, 2), new Range16.ptr(497, 500, 3), new Range16.ptr(502, 504, 1), new Range16.ptr(506, 562, 2), new Range16.ptr(570, 571, 1), new Range16.ptr(573, 574, 1), new Range16.ptr(577, 579, 2), new Range16.ptr(580, 582, 1), new Range16.ptr(584, 590, 2), new Range16.ptr(880, 882, 2), new Range16.ptr(886, 895, 9), new Range16.ptr(902, 904, 2), new Range16.ptr(905, 906, 1), new Range16.ptr(908, 910, 2), new Range16.ptr(911, 913, 2), new Range16.ptr(914, 929, 1), new Range16.ptr(931, 939, 1), new Range16.ptr(975, 978, 3), new Range16.ptr(979, 980, 1), new Range16.ptr(984, 1006, 2), new Range16.ptr(1012, 1015, 3), new Range16.ptr(1017, 1018, 1), new Range16.ptr(1021, 1071, 1), new Range16.ptr(1120, 1152, 2), new Range16.ptr(1162, 1216, 2), new Range16.ptr(1217, 1229, 2), new Range16.ptr(1232, 1326, 2), new Range16.ptr(1329, 1366, 1), new Range16.ptr(4256, 4293, 1), new Range16.ptr(4295, 4301, 6), new Range16.ptr(5024, 5109, 1), new Range16.ptr(7680, 7828, 2), new Range16.ptr(7838, 7934, 2), new Range16.ptr(7944, 7951, 1), new Range16.ptr(7960, 7965, 1), new Range16.ptr(7976, 7983, 1), new Range16.ptr(7992, 7999, 1), new Range16.ptr(8008, 8013, 1), new Range16.ptr(8025, 8031, 2), new Range16.ptr(8040, 8047, 1), new Range16.ptr(8120, 8123, 1), new Range16.ptr(8136, 8139, 1), new Range16.ptr(8152, 8155, 1), new Range16.ptr(8168, 8172, 1), new Range16.ptr(8184, 8187, 1), new Range16.ptr(8450, 8455, 5), new Range16.ptr(8459, 8461, 1), new Range16.ptr(8464, 8466, 1), new Range16.ptr(8469, 8473, 4), new Range16.ptr(8474, 8477, 1), new Range16.ptr(8484, 8490, 2), new Range16.ptr(8491, 8493, 1), new Range16.ptr(8496, 8499, 1), new Range16.ptr(8510, 8511, 1), new Range16.ptr(8517, 8579, 62), new Range16.ptr(11264, 11310, 1), new Range16.ptr(11360, 11362, 2), new Range16.ptr(11363, 11364, 1), new Range16.ptr(11367, 11373, 2), new Range16.ptr(11374, 11376, 1), new Range16.ptr(11378, 11381, 3), new Range16.ptr(11390, 11392, 1), new Range16.ptr(11394, 11490, 2), new Range16.ptr(11499, 11501, 2), new Range16.ptr(11506, 42560, 31054), new Range16.ptr(42562, 42604, 2), new Range16.ptr(42624, 42650, 2), new Range16.ptr(42786, 42798, 2), new Range16.ptr(42802, 42862, 2), new Range16.ptr(42873, 42877, 2), new Range16.ptr(42878, 42886, 2), new Range16.ptr(42891, 42893, 2), new Range16.ptr(42896, 42898, 2), new Range16.ptr(42902, 42922, 2), new Range16.ptr(42923, 42926, 1), new Range16.ptr(42928, 42932, 1), new Range16.ptr(42934, 65313, 22379), new Range16.ptr(65314, 65338, 1)]), new sliceType$1([new Range32.ptr(66560, 66599, 1), new Range32.ptr(66736, 66771, 1), new Range32.ptr(68736, 68786, 1), new Range32.ptr(71840, 71871, 1), new Range32.ptr(119808, 119833, 1), new Range32.ptr(119860, 119885, 1), new Range32.ptr(119912, 119937, 1), new Range32.ptr(119964, 119966, 2), new Range32.ptr(119967, 119973, 3), new Range32.ptr(119974, 119977, 3), new Range32.ptr(119978, 119980, 1), new Range32.ptr(119982, 119989, 1), new Range32.ptr(120016, 120041, 1), new Range32.ptr(120068, 120069, 1), new Range32.ptr(120071, 120074, 1), new Range32.ptr(120077, 120084, 1), new Range32.ptr(120086, 120092, 1), new Range32.ptr(120120, 120121, 1), new Range32.ptr(120123, 120126, 1), new Range32.ptr(120128, 120132, 1), new Range32.ptr(120134, 120138, 4), new Range32.ptr(120139, 120144, 1), new Range32.ptr(120172, 120197, 1), new Range32.ptr(120224, 120249, 1), new Range32.ptr(120276, 120301, 1), new Range32.ptr(120328, 120353, 1), new Range32.ptr(120380, 120405, 1), new Range32.ptr(120432, 120457, 1), new Range32.ptr(120488, 120512, 1), new Range32.ptr(120546, 120570, 1), new Range32.ptr(120604, 120628, 1), new Range32.ptr(120662, 120686, 1), new Range32.ptr(120720, 120744, 1), new Range32.ptr(120778, 125184, 4406), new Range32.ptr(125185, 125217, 1)]), 3);
|
|
_M = new RangeTable.ptr(new sliceType([new Range16.ptr(768, 879, 1), new Range16.ptr(1155, 1161, 1), new Range16.ptr(1425, 1469, 1), new Range16.ptr(1471, 1473, 2), new Range16.ptr(1474, 1476, 2), new Range16.ptr(1477, 1479, 2), new Range16.ptr(1552, 1562, 1), new Range16.ptr(1611, 1631, 1), new Range16.ptr(1648, 1750, 102), new Range16.ptr(1751, 1756, 1), new Range16.ptr(1759, 1764, 1), new Range16.ptr(1767, 1768, 1), new Range16.ptr(1770, 1773, 1), new Range16.ptr(1809, 1840, 31), new Range16.ptr(1841, 1866, 1), new Range16.ptr(1958, 1968, 1), new Range16.ptr(2027, 2035, 1), new Range16.ptr(2070, 2073, 1), new Range16.ptr(2075, 2083, 1), new Range16.ptr(2085, 2087, 1), new Range16.ptr(2089, 2093, 1), new Range16.ptr(2137, 2139, 1), new Range16.ptr(2260, 2273, 1), new Range16.ptr(2275, 2307, 1), new Range16.ptr(2362, 2364, 1), new Range16.ptr(2366, 2383, 1), new Range16.ptr(2385, 2391, 1), new Range16.ptr(2402, 2403, 1), new Range16.ptr(2433, 2435, 1), new Range16.ptr(2492, 2494, 2), new Range16.ptr(2495, 2500, 1), new Range16.ptr(2503, 2504, 1), new Range16.ptr(2507, 2509, 1), new Range16.ptr(2519, 2530, 11), new Range16.ptr(2531, 2561, 30), new Range16.ptr(2562, 2563, 1), new Range16.ptr(2620, 2622, 2), new Range16.ptr(2623, 2626, 1), new Range16.ptr(2631, 2632, 1), new Range16.ptr(2635, 2637, 1), new Range16.ptr(2641, 2672, 31), new Range16.ptr(2673, 2677, 4), new Range16.ptr(2689, 2691, 1), new Range16.ptr(2748, 2750, 2), new Range16.ptr(2751, 2757, 1), new Range16.ptr(2759, 2761, 1), new Range16.ptr(2763, 2765, 1), new Range16.ptr(2786, 2787, 1), new Range16.ptr(2810, 2815, 1), new Range16.ptr(2817, 2819, 1), new Range16.ptr(2876, 2878, 2), new Range16.ptr(2879, 2884, 1), new Range16.ptr(2887, 2888, 1), new Range16.ptr(2891, 2893, 1), new Range16.ptr(2902, 2903, 1), new Range16.ptr(2914, 2915, 1), new Range16.ptr(2946, 3006, 60), new Range16.ptr(3007, 3010, 1), new Range16.ptr(3014, 3016, 1), new Range16.ptr(3018, 3021, 1), new Range16.ptr(3031, 3072, 41), new Range16.ptr(3073, 3075, 1), new Range16.ptr(3134, 3140, 1), new Range16.ptr(3142, 3144, 1), new Range16.ptr(3146, 3149, 1), new Range16.ptr(3157, 3158, 1), new Range16.ptr(3170, 3171, 1), new Range16.ptr(3201, 3203, 1), new Range16.ptr(3260, 3262, 2), new Range16.ptr(3263, 3268, 1), new Range16.ptr(3270, 3272, 1), new Range16.ptr(3274, 3277, 1), new Range16.ptr(3285, 3286, 1), new Range16.ptr(3298, 3299, 1), new Range16.ptr(3328, 3331, 1), new Range16.ptr(3387, 3388, 1), new Range16.ptr(3390, 3396, 1), new Range16.ptr(3398, 3400, 1), new Range16.ptr(3402, 3405, 1), new Range16.ptr(3415, 3426, 11), new Range16.ptr(3427, 3458, 31), new Range16.ptr(3459, 3530, 71), new Range16.ptr(3535, 3540, 1), new Range16.ptr(3542, 3544, 2), new Range16.ptr(3545, 3551, 1), new Range16.ptr(3570, 3571, 1), new Range16.ptr(3633, 3636, 3), new Range16.ptr(3637, 3642, 1), new Range16.ptr(3655, 3662, 1), new Range16.ptr(3761, 3764, 3), new Range16.ptr(3765, 3769, 1), new Range16.ptr(3771, 3772, 1), new Range16.ptr(3784, 3789, 1), new Range16.ptr(3864, 3865, 1), new Range16.ptr(3893, 3897, 2), new Range16.ptr(3902, 3903, 1), new Range16.ptr(3953, 3972, 1), new Range16.ptr(3974, 3975, 1), new Range16.ptr(3981, 3991, 1), new Range16.ptr(3993, 4028, 1), new Range16.ptr(4038, 4139, 101), new Range16.ptr(4140, 4158, 1), new Range16.ptr(4182, 4185, 1), new Range16.ptr(4190, 4192, 1), new Range16.ptr(4194, 4196, 1), new Range16.ptr(4199, 4205, 1), new Range16.ptr(4209, 4212, 1), new Range16.ptr(4226, 4237, 1), new Range16.ptr(4239, 4250, 11), new Range16.ptr(4251, 4253, 1), new Range16.ptr(4957, 4959, 1), new Range16.ptr(5906, 5908, 1), new Range16.ptr(5938, 5940, 1), new Range16.ptr(5970, 5971, 1), new Range16.ptr(6002, 6003, 1), new Range16.ptr(6068, 6099, 1), new Range16.ptr(6109, 6155, 46), new Range16.ptr(6156, 6157, 1), new Range16.ptr(6277, 6278, 1), new Range16.ptr(6313, 6432, 119), new Range16.ptr(6433, 6443, 1), new Range16.ptr(6448, 6459, 1), new Range16.ptr(6679, 6683, 1), new Range16.ptr(6741, 6750, 1), new Range16.ptr(6752, 6780, 1), new Range16.ptr(6783, 6832, 49), new Range16.ptr(6833, 6846, 1), new Range16.ptr(6912, 6916, 1), new Range16.ptr(6964, 6980, 1), new Range16.ptr(7019, 7027, 1), new Range16.ptr(7040, 7042, 1), new Range16.ptr(7073, 7085, 1), new Range16.ptr(7142, 7155, 1), new Range16.ptr(7204, 7223, 1), new Range16.ptr(7376, 7378, 1), new Range16.ptr(7380, 7400, 1), new Range16.ptr(7405, 7410, 5), new Range16.ptr(7411, 7412, 1), new Range16.ptr(7415, 7417, 1), new Range16.ptr(7616, 7673, 1), new Range16.ptr(7675, 7679, 1), new Range16.ptr(8400, 8432, 1), new Range16.ptr(11503, 11505, 1), new Range16.ptr(11647, 11744, 97), new Range16.ptr(11745, 11775, 1), new Range16.ptr(12330, 12335, 1), new Range16.ptr(12441, 12442, 1), new Range16.ptr(42607, 42610, 1), new Range16.ptr(42612, 42621, 1), new Range16.ptr(42654, 42655, 1), new Range16.ptr(42736, 42737, 1), new Range16.ptr(43010, 43014, 4), new Range16.ptr(43019, 43043, 24), new Range16.ptr(43044, 43047, 1), new Range16.ptr(43136, 43137, 1), new Range16.ptr(43188, 43205, 1), new Range16.ptr(43232, 43249, 1), new Range16.ptr(43302, 43309, 1), new Range16.ptr(43335, 43347, 1), new Range16.ptr(43392, 43395, 1), new Range16.ptr(43443, 43456, 1), new Range16.ptr(43493, 43561, 68), new Range16.ptr(43562, 43574, 1), new Range16.ptr(43587, 43596, 9), new Range16.ptr(43597, 43643, 46), new Range16.ptr(43644, 43645, 1), new Range16.ptr(43696, 43698, 2), new Range16.ptr(43699, 43700, 1), new Range16.ptr(43703, 43704, 1), new Range16.ptr(43710, 43711, 1), new Range16.ptr(43713, 43755, 42), new Range16.ptr(43756, 43759, 1), new Range16.ptr(43765, 43766, 1), new Range16.ptr(44003, 44010, 1), new Range16.ptr(44012, 44013, 1), new Range16.ptr(64286, 65024, 738), new Range16.ptr(65025, 65039, 1), new Range16.ptr(65056, 65071, 1)]), new sliceType$1([new Range32.ptr(66045, 66272, 227), new Range32.ptr(66422, 66426, 1), new Range32.ptr(68097, 68099, 1), new Range32.ptr(68101, 68102, 1), new Range32.ptr(68108, 68111, 1), new Range32.ptr(68152, 68154, 1), new Range32.ptr(68159, 68325, 166), new Range32.ptr(68326, 69632, 1306), new Range32.ptr(69633, 69634, 1), new Range32.ptr(69688, 69702, 1), new Range32.ptr(69759, 69762, 1), new Range32.ptr(69808, 69818, 1), new Range32.ptr(69888, 69890, 1), new Range32.ptr(69927, 69940, 1), new Range32.ptr(70003, 70016, 13), new Range32.ptr(70017, 70018, 1), new Range32.ptr(70067, 70080, 1), new Range32.ptr(70090, 70092, 1), new Range32.ptr(70188, 70199, 1), new Range32.ptr(70206, 70367, 161), new Range32.ptr(70368, 70378, 1), new Range32.ptr(70400, 70403, 1), new Range32.ptr(70460, 70462, 2), new Range32.ptr(70463, 70468, 1), new Range32.ptr(70471, 70472, 1), new Range32.ptr(70475, 70477, 1), new Range32.ptr(70487, 70498, 11), new Range32.ptr(70499, 70502, 3), new Range32.ptr(70503, 70508, 1), new Range32.ptr(70512, 70516, 1), new Range32.ptr(70709, 70726, 1), new Range32.ptr(70832, 70851, 1), new Range32.ptr(71087, 71093, 1), new Range32.ptr(71096, 71104, 1), new Range32.ptr(71132, 71133, 1), new Range32.ptr(71216, 71232, 1), new Range32.ptr(71339, 71351, 1), new Range32.ptr(71453, 71467, 1), new Range32.ptr(72193, 72202, 1), new Range32.ptr(72243, 72249, 1), new Range32.ptr(72251, 72254, 1), new Range32.ptr(72263, 72273, 10), new Range32.ptr(72274, 72283, 1), new Range32.ptr(72330, 72345, 1), new Range32.ptr(72751, 72758, 1), new Range32.ptr(72760, 72767, 1), new Range32.ptr(72850, 72871, 1), new Range32.ptr(72873, 72886, 1), new Range32.ptr(73009, 73014, 1), new Range32.ptr(73018, 73020, 2), new Range32.ptr(73021, 73023, 2), new Range32.ptr(73024, 73029, 1), new Range32.ptr(73031, 92912, 19881), new Range32.ptr(92913, 92916, 1), new Range32.ptr(92976, 92982, 1), new Range32.ptr(94033, 94078, 1), new Range32.ptr(94095, 94098, 1), new Range32.ptr(113821, 113822, 1), new Range32.ptr(119141, 119145, 1), new Range32.ptr(119149, 119154, 1), new Range32.ptr(119163, 119170, 1), new Range32.ptr(119173, 119179, 1), new Range32.ptr(119210, 119213, 1), new Range32.ptr(119362, 119364, 1), new Range32.ptr(121344, 121398, 1), new Range32.ptr(121403, 121452, 1), new Range32.ptr(121461, 121476, 15), new Range32.ptr(121499, 121503, 1), new Range32.ptr(121505, 121519, 1), new Range32.ptr(122880, 122886, 1), new Range32.ptr(122888, 122904, 1), new Range32.ptr(122907, 122913, 1), new Range32.ptr(122915, 122916, 1), new Range32.ptr(122918, 122922, 1), new Range32.ptr(125136, 125142, 1), new Range32.ptr(125252, 125258, 1), new Range32.ptr(917760, 917999, 1)]), 0);
|
|
_Mc = new RangeTable.ptr(new sliceType([new Range16.ptr(2307, 2363, 56), new Range16.ptr(2366, 2368, 1), new Range16.ptr(2377, 2380, 1), new Range16.ptr(2382, 2383, 1), new Range16.ptr(2434, 2435, 1), new Range16.ptr(2494, 2496, 1), new Range16.ptr(2503, 2504, 1), new Range16.ptr(2507, 2508, 1), new Range16.ptr(2519, 2563, 44), new Range16.ptr(2622, 2624, 1), new Range16.ptr(2691, 2750, 59), new Range16.ptr(2751, 2752, 1), new Range16.ptr(2761, 2763, 2), new Range16.ptr(2764, 2818, 54), new Range16.ptr(2819, 2878, 59), new Range16.ptr(2880, 2887, 7), new Range16.ptr(2888, 2891, 3), new Range16.ptr(2892, 2903, 11), new Range16.ptr(3006, 3007, 1), new Range16.ptr(3009, 3010, 1), new Range16.ptr(3014, 3016, 1), new Range16.ptr(3018, 3020, 1), new Range16.ptr(3031, 3073, 42), new Range16.ptr(3074, 3075, 1), new Range16.ptr(3137, 3140, 1), new Range16.ptr(3202, 3203, 1), new Range16.ptr(3262, 3264, 2), new Range16.ptr(3265, 3268, 1), new Range16.ptr(3271, 3272, 1), new Range16.ptr(3274, 3275, 1), new Range16.ptr(3285, 3286, 1), new Range16.ptr(3330, 3331, 1), new Range16.ptr(3390, 3392, 1), new Range16.ptr(3398, 3400, 1), new Range16.ptr(3402, 3404, 1), new Range16.ptr(3415, 3458, 43), new Range16.ptr(3459, 3535, 76), new Range16.ptr(3536, 3537, 1), new Range16.ptr(3544, 3551, 1), new Range16.ptr(3570, 3571, 1), new Range16.ptr(3902, 3903, 1), new Range16.ptr(3967, 4139, 172), new Range16.ptr(4140, 4145, 5), new Range16.ptr(4152, 4155, 3), new Range16.ptr(4156, 4182, 26), new Range16.ptr(4183, 4194, 11), new Range16.ptr(4195, 4196, 1), new Range16.ptr(4199, 4205, 1), new Range16.ptr(4227, 4228, 1), new Range16.ptr(4231, 4236, 1), new Range16.ptr(4239, 4250, 11), new Range16.ptr(4251, 4252, 1), new Range16.ptr(6070, 6078, 8), new Range16.ptr(6079, 6085, 1), new Range16.ptr(6087, 6088, 1), new Range16.ptr(6435, 6438, 1), new Range16.ptr(6441, 6443, 1), new Range16.ptr(6448, 6449, 1), new Range16.ptr(6451, 6456, 1), new Range16.ptr(6681, 6682, 1), new Range16.ptr(6741, 6743, 2), new Range16.ptr(6753, 6755, 2), new Range16.ptr(6756, 6765, 9), new Range16.ptr(6766, 6770, 1), new Range16.ptr(6916, 6965, 49), new Range16.ptr(6971, 6973, 2), new Range16.ptr(6974, 6977, 1), new Range16.ptr(6979, 6980, 1), new Range16.ptr(7042, 7073, 31), new Range16.ptr(7078, 7079, 1), new Range16.ptr(7082, 7143, 61), new Range16.ptr(7146, 7148, 1), new Range16.ptr(7150, 7154, 4), new Range16.ptr(7155, 7204, 49), new Range16.ptr(7205, 7211, 1), new Range16.ptr(7220, 7221, 1), new Range16.ptr(7393, 7410, 17), new Range16.ptr(7411, 7415, 4), new Range16.ptr(12334, 12335, 1), new Range16.ptr(43043, 43044, 1), new Range16.ptr(43047, 43136, 89), new Range16.ptr(43137, 43188, 51), new Range16.ptr(43189, 43203, 1), new Range16.ptr(43346, 43347, 1), new Range16.ptr(43395, 43444, 49), new Range16.ptr(43445, 43450, 5), new Range16.ptr(43451, 43453, 2), new Range16.ptr(43454, 43456, 1), new Range16.ptr(43567, 43568, 1), new Range16.ptr(43571, 43572, 1), new Range16.ptr(43597, 43643, 46), new Range16.ptr(43645, 43755, 110), new Range16.ptr(43758, 43759, 1), new Range16.ptr(43765, 44003, 238), new Range16.ptr(44004, 44006, 2), new Range16.ptr(44007, 44009, 2), new Range16.ptr(44010, 44012, 2)]), new sliceType$1([new Range32.ptr(69632, 69634, 2), new Range32.ptr(69762, 69808, 46), new Range32.ptr(69809, 69810, 1), new Range32.ptr(69815, 69816, 1), new Range32.ptr(69932, 70018, 86), new Range32.ptr(70067, 70069, 1), new Range32.ptr(70079, 70080, 1), new Range32.ptr(70188, 70190, 1), new Range32.ptr(70194, 70195, 1), new Range32.ptr(70197, 70368, 171), new Range32.ptr(70369, 70370, 1), new Range32.ptr(70402, 70403, 1), new Range32.ptr(70462, 70463, 1), new Range32.ptr(70465, 70468, 1), new Range32.ptr(70471, 70472, 1), new Range32.ptr(70475, 70477, 1), new Range32.ptr(70487, 70498, 11), new Range32.ptr(70499, 70709, 210), new Range32.ptr(70710, 70711, 1), new Range32.ptr(70720, 70721, 1), new Range32.ptr(70725, 70832, 107), new Range32.ptr(70833, 70834, 1), new Range32.ptr(70841, 70843, 2), new Range32.ptr(70844, 70846, 1), new Range32.ptr(70849, 71087, 238), new Range32.ptr(71088, 71089, 1), new Range32.ptr(71096, 71099, 1), new Range32.ptr(71102, 71216, 114), new Range32.ptr(71217, 71218, 1), new Range32.ptr(71227, 71228, 1), new Range32.ptr(71230, 71340, 110), new Range32.ptr(71342, 71343, 1), new Range32.ptr(71350, 71456, 106), new Range32.ptr(71457, 71462, 5), new Range32.ptr(72199, 72200, 1), new Range32.ptr(72249, 72279, 30), new Range32.ptr(72280, 72343, 63), new Range32.ptr(72751, 72766, 15), new Range32.ptr(72873, 72881, 8), new Range32.ptr(72884, 94033, 21149), new Range32.ptr(94034, 94078, 1), new Range32.ptr(119141, 119142, 1), new Range32.ptr(119149, 119154, 1)]), 0);
|
|
_Me = new RangeTable.ptr(new sliceType([new Range16.ptr(1160, 1161, 1), new Range16.ptr(6846, 8413, 1567), new Range16.ptr(8414, 8416, 1), new Range16.ptr(8418, 8420, 1), new Range16.ptr(42608, 42610, 1)]), sliceType$1.nil, 0);
|
|
_Mn = new RangeTable.ptr(new sliceType([new Range16.ptr(768, 879, 1), new Range16.ptr(1155, 1159, 1), new Range16.ptr(1425, 1469, 1), new Range16.ptr(1471, 1473, 2), new Range16.ptr(1474, 1476, 2), new Range16.ptr(1477, 1479, 2), new Range16.ptr(1552, 1562, 1), new Range16.ptr(1611, 1631, 1), new Range16.ptr(1648, 1750, 102), new Range16.ptr(1751, 1756, 1), new Range16.ptr(1759, 1764, 1), new Range16.ptr(1767, 1768, 1), new Range16.ptr(1770, 1773, 1), new Range16.ptr(1809, 1840, 31), new Range16.ptr(1841, 1866, 1), new Range16.ptr(1958, 1968, 1), new Range16.ptr(2027, 2035, 1), new Range16.ptr(2070, 2073, 1), new Range16.ptr(2075, 2083, 1), new Range16.ptr(2085, 2087, 1), new Range16.ptr(2089, 2093, 1), new Range16.ptr(2137, 2139, 1), new Range16.ptr(2260, 2273, 1), new Range16.ptr(2275, 2306, 1), new Range16.ptr(2362, 2364, 2), new Range16.ptr(2369, 2376, 1), new Range16.ptr(2381, 2385, 4), new Range16.ptr(2386, 2391, 1), new Range16.ptr(2402, 2403, 1), new Range16.ptr(2433, 2492, 59), new Range16.ptr(2497, 2500, 1), new Range16.ptr(2509, 2530, 21), new Range16.ptr(2531, 2561, 30), new Range16.ptr(2562, 2620, 58), new Range16.ptr(2625, 2626, 1), new Range16.ptr(2631, 2632, 1), new Range16.ptr(2635, 2637, 1), new Range16.ptr(2641, 2672, 31), new Range16.ptr(2673, 2677, 4), new Range16.ptr(2689, 2690, 1), new Range16.ptr(2748, 2753, 5), new Range16.ptr(2754, 2757, 1), new Range16.ptr(2759, 2760, 1), new Range16.ptr(2765, 2786, 21), new Range16.ptr(2787, 2810, 23), new Range16.ptr(2811, 2815, 1), new Range16.ptr(2817, 2876, 59), new Range16.ptr(2879, 2881, 2), new Range16.ptr(2882, 2884, 1), new Range16.ptr(2893, 2902, 9), new Range16.ptr(2914, 2915, 1), new Range16.ptr(2946, 3008, 62), new Range16.ptr(3021, 3072, 51), new Range16.ptr(3134, 3136, 1), new Range16.ptr(3142, 3144, 1), new Range16.ptr(3146, 3149, 1), new Range16.ptr(3157, 3158, 1), new Range16.ptr(3170, 3171, 1), new Range16.ptr(3201, 3260, 59), new Range16.ptr(3263, 3270, 7), new Range16.ptr(3276, 3277, 1), new Range16.ptr(3298, 3299, 1), new Range16.ptr(3328, 3329, 1), new Range16.ptr(3387, 3388, 1), new Range16.ptr(3393, 3396, 1), new Range16.ptr(3405, 3426, 21), new Range16.ptr(3427, 3530, 103), new Range16.ptr(3538, 3540, 1), new Range16.ptr(3542, 3633, 91), new Range16.ptr(3636, 3642, 1), new Range16.ptr(3655, 3662, 1), new Range16.ptr(3761, 3764, 3), new Range16.ptr(3765, 3769, 1), new Range16.ptr(3771, 3772, 1), new Range16.ptr(3784, 3789, 1), new Range16.ptr(3864, 3865, 1), new Range16.ptr(3893, 3897, 2), new Range16.ptr(3953, 3966, 1), new Range16.ptr(3968, 3972, 1), new Range16.ptr(3974, 3975, 1), new Range16.ptr(3981, 3991, 1), new Range16.ptr(3993, 4028, 1), new Range16.ptr(4038, 4141, 103), new Range16.ptr(4142, 4144, 1), new Range16.ptr(4146, 4151, 1), new Range16.ptr(4153, 4154, 1), new Range16.ptr(4157, 4158, 1), new Range16.ptr(4184, 4185, 1), new Range16.ptr(4190, 4192, 1), new Range16.ptr(4209, 4212, 1), new Range16.ptr(4226, 4229, 3), new Range16.ptr(4230, 4237, 7), new Range16.ptr(4253, 4957, 704), new Range16.ptr(4958, 4959, 1), new Range16.ptr(5906, 5908, 1), new Range16.ptr(5938, 5940, 1), new Range16.ptr(5970, 5971, 1), new Range16.ptr(6002, 6003, 1), new Range16.ptr(6068, 6069, 1), new Range16.ptr(6071, 6077, 1), new Range16.ptr(6086, 6089, 3), new Range16.ptr(6090, 6099, 1), new Range16.ptr(6109, 6155, 46), new Range16.ptr(6156, 6157, 1), new Range16.ptr(6277, 6278, 1), new Range16.ptr(6313, 6432, 119), new Range16.ptr(6433, 6434, 1), new Range16.ptr(6439, 6440, 1), new Range16.ptr(6450, 6457, 7), new Range16.ptr(6458, 6459, 1), new Range16.ptr(6679, 6680, 1), new Range16.ptr(6683, 6742, 59), new Range16.ptr(6744, 6750, 1), new Range16.ptr(6752, 6754, 2), new Range16.ptr(6757, 6764, 1), new Range16.ptr(6771, 6780, 1), new Range16.ptr(6783, 6832, 49), new Range16.ptr(6833, 6845, 1), new Range16.ptr(6912, 6915, 1), new Range16.ptr(6964, 6966, 2), new Range16.ptr(6967, 6970, 1), new Range16.ptr(6972, 6978, 6), new Range16.ptr(7019, 7027, 1), new Range16.ptr(7040, 7041, 1), new Range16.ptr(7074, 7077, 1), new Range16.ptr(7080, 7081, 1), new Range16.ptr(7083, 7085, 1), new Range16.ptr(7142, 7144, 2), new Range16.ptr(7145, 7149, 4), new Range16.ptr(7151, 7153, 1), new Range16.ptr(7212, 7219, 1), new Range16.ptr(7222, 7223, 1), new Range16.ptr(7376, 7378, 1), new Range16.ptr(7380, 7392, 1), new Range16.ptr(7394, 7400, 1), new Range16.ptr(7405, 7412, 7), new Range16.ptr(7416, 7417, 1), new Range16.ptr(7616, 7673, 1), new Range16.ptr(7675, 7679, 1), new Range16.ptr(8400, 8412, 1), new Range16.ptr(8417, 8421, 4), new Range16.ptr(8422, 8432, 1), new Range16.ptr(11503, 11505, 1), new Range16.ptr(11647, 11744, 97), new Range16.ptr(11745, 11775, 1), new Range16.ptr(12330, 12333, 1), new Range16.ptr(12441, 12442, 1), new Range16.ptr(42607, 42612, 5), new Range16.ptr(42613, 42621, 1), new Range16.ptr(42654, 42655, 1), new Range16.ptr(42736, 42737, 1), new Range16.ptr(43010, 43014, 4), new Range16.ptr(43019, 43045, 26), new Range16.ptr(43046, 43204, 158), new Range16.ptr(43205, 43232, 27), new Range16.ptr(43233, 43249, 1), new Range16.ptr(43302, 43309, 1), new Range16.ptr(43335, 43345, 1), new Range16.ptr(43392, 43394, 1), new Range16.ptr(43443, 43446, 3), new Range16.ptr(43447, 43449, 1), new Range16.ptr(43452, 43493, 41), new Range16.ptr(43561, 43566, 1), new Range16.ptr(43569, 43570, 1), new Range16.ptr(43573, 43574, 1), new Range16.ptr(43587, 43596, 9), new Range16.ptr(43644, 43696, 52), new Range16.ptr(43698, 43700, 1), new Range16.ptr(43703, 43704, 1), new Range16.ptr(43710, 43711, 1), new Range16.ptr(43713, 43756, 43), new Range16.ptr(43757, 43766, 9), new Range16.ptr(44005, 44008, 3), new Range16.ptr(44013, 64286, 20273), new Range16.ptr(65024, 65039, 1), new Range16.ptr(65056, 65071, 1)]), new sliceType$1([new Range32.ptr(66045, 66272, 227), new Range32.ptr(66422, 66426, 1), new Range32.ptr(68097, 68099, 1), new Range32.ptr(68101, 68102, 1), new Range32.ptr(68108, 68111, 1), new Range32.ptr(68152, 68154, 1), new Range32.ptr(68159, 68325, 166), new Range32.ptr(68326, 69633, 1307), new Range32.ptr(69688, 69702, 1), new Range32.ptr(69759, 69761, 1), new Range32.ptr(69811, 69814, 1), new Range32.ptr(69817, 69818, 1), new Range32.ptr(69888, 69890, 1), new Range32.ptr(69927, 69931, 1), new Range32.ptr(69933, 69940, 1), new Range32.ptr(70003, 70016, 13), new Range32.ptr(70017, 70070, 53), new Range32.ptr(70071, 70078, 1), new Range32.ptr(70090, 70092, 1), new Range32.ptr(70191, 70193, 1), new Range32.ptr(70196, 70198, 2), new Range32.ptr(70199, 70206, 7), new Range32.ptr(70367, 70371, 4), new Range32.ptr(70372, 70378, 1), new Range32.ptr(70400, 70401, 1), new Range32.ptr(70460, 70464, 4), new Range32.ptr(70502, 70508, 1), new Range32.ptr(70512, 70516, 1), new Range32.ptr(70712, 70719, 1), new Range32.ptr(70722, 70724, 1), new Range32.ptr(70726, 70835, 109), new Range32.ptr(70836, 70840, 1), new Range32.ptr(70842, 70847, 5), new Range32.ptr(70848, 70850, 2), new Range32.ptr(70851, 71090, 239), new Range32.ptr(71091, 71093, 1), new Range32.ptr(71100, 71101, 1), new Range32.ptr(71103, 71104, 1), new Range32.ptr(71132, 71133, 1), new Range32.ptr(71219, 71226, 1), new Range32.ptr(71229, 71231, 2), new Range32.ptr(71232, 71339, 107), new Range32.ptr(71341, 71344, 3), new Range32.ptr(71345, 71349, 1), new Range32.ptr(71351, 71453, 102), new Range32.ptr(71454, 71455, 1), new Range32.ptr(71458, 71461, 1), new Range32.ptr(71463, 71467, 1), new Range32.ptr(72193, 72198, 1), new Range32.ptr(72201, 72202, 1), new Range32.ptr(72243, 72248, 1), new Range32.ptr(72251, 72254, 1), new Range32.ptr(72263, 72273, 10), new Range32.ptr(72274, 72278, 1), new Range32.ptr(72281, 72283, 1), new Range32.ptr(72330, 72342, 1), new Range32.ptr(72344, 72345, 1), new Range32.ptr(72752, 72758, 1), new Range32.ptr(72760, 72765, 1), new Range32.ptr(72767, 72850, 83), new Range32.ptr(72851, 72871, 1), new Range32.ptr(72874, 72880, 1), new Range32.ptr(72882, 72883, 1), new Range32.ptr(72885, 72886, 1), new Range32.ptr(73009, 73014, 1), new Range32.ptr(73018, 73020, 2), new Range32.ptr(73021, 73023, 2), new Range32.ptr(73024, 73029, 1), new Range32.ptr(73031, 92912, 19881), new Range32.ptr(92913, 92916, 1), new Range32.ptr(92976, 92982, 1), new Range32.ptr(94095, 94098, 1), new Range32.ptr(113821, 113822, 1), new Range32.ptr(119143, 119145, 1), new Range32.ptr(119163, 119170, 1), new Range32.ptr(119173, 119179, 1), new Range32.ptr(119210, 119213, 1), new Range32.ptr(119362, 119364, 1), new Range32.ptr(121344, 121398, 1), new Range32.ptr(121403, 121452, 1), new Range32.ptr(121461, 121476, 15), new Range32.ptr(121499, 121503, 1), new Range32.ptr(121505, 121519, 1), new Range32.ptr(122880, 122886, 1), new Range32.ptr(122888, 122904, 1), new Range32.ptr(122907, 122913, 1), new Range32.ptr(122915, 122916, 1), new Range32.ptr(122918, 122922, 1), new Range32.ptr(125136, 125142, 1), new Range32.ptr(125252, 125258, 1), new Range32.ptr(917760, 917999, 1)]), 0);
|
|
_N = new RangeTable.ptr(new sliceType([new Range16.ptr(48, 57, 1), new Range16.ptr(178, 179, 1), new Range16.ptr(185, 188, 3), new Range16.ptr(189, 190, 1), new Range16.ptr(1632, 1641, 1), new Range16.ptr(1776, 1785, 1), new Range16.ptr(1984, 1993, 1), new Range16.ptr(2406, 2415, 1), new Range16.ptr(2534, 2543, 1), new Range16.ptr(2548, 2553, 1), new Range16.ptr(2662, 2671, 1), new Range16.ptr(2790, 2799, 1), new Range16.ptr(2918, 2927, 1), new Range16.ptr(2930, 2935, 1), new Range16.ptr(3046, 3058, 1), new Range16.ptr(3174, 3183, 1), new Range16.ptr(3192, 3198, 1), new Range16.ptr(3302, 3311, 1), new Range16.ptr(3416, 3422, 1), new Range16.ptr(3430, 3448, 1), new Range16.ptr(3558, 3567, 1), new Range16.ptr(3664, 3673, 1), new Range16.ptr(3792, 3801, 1), new Range16.ptr(3872, 3891, 1), new Range16.ptr(4160, 4169, 1), new Range16.ptr(4240, 4249, 1), new Range16.ptr(4969, 4988, 1), new Range16.ptr(5870, 5872, 1), new Range16.ptr(6112, 6121, 1), new Range16.ptr(6128, 6137, 1), new Range16.ptr(6160, 6169, 1), new Range16.ptr(6470, 6479, 1), new Range16.ptr(6608, 6618, 1), new Range16.ptr(6784, 6793, 1), new Range16.ptr(6800, 6809, 1), new Range16.ptr(6992, 7001, 1), new Range16.ptr(7088, 7097, 1), new Range16.ptr(7232, 7241, 1), new Range16.ptr(7248, 7257, 1), new Range16.ptr(8304, 8308, 4), new Range16.ptr(8309, 8313, 1), new Range16.ptr(8320, 8329, 1), new Range16.ptr(8528, 8578, 1), new Range16.ptr(8581, 8585, 1), new Range16.ptr(9312, 9371, 1), new Range16.ptr(9450, 9471, 1), new Range16.ptr(10102, 10131, 1), new Range16.ptr(11517, 12295, 778), new Range16.ptr(12321, 12329, 1), new Range16.ptr(12344, 12346, 1), new Range16.ptr(12690, 12693, 1), new Range16.ptr(12832, 12841, 1), new Range16.ptr(12872, 12879, 1), new Range16.ptr(12881, 12895, 1), new Range16.ptr(12928, 12937, 1), new Range16.ptr(12977, 12991, 1), new Range16.ptr(42528, 42537, 1), new Range16.ptr(42726, 42735, 1), new Range16.ptr(43056, 43061, 1), new Range16.ptr(43216, 43225, 1), new Range16.ptr(43264, 43273, 1), new Range16.ptr(43472, 43481, 1), new Range16.ptr(43504, 43513, 1), new Range16.ptr(43600, 43609, 1), new Range16.ptr(44016, 44025, 1), new Range16.ptr(65296, 65305, 1)]), new sliceType$1([new Range32.ptr(65799, 65843, 1), new Range32.ptr(65856, 65912, 1), new Range32.ptr(65930, 65931, 1), new Range32.ptr(66273, 66299, 1), new Range32.ptr(66336, 66339, 1), new Range32.ptr(66369, 66378, 9), new Range32.ptr(66513, 66517, 1), new Range32.ptr(66720, 66729, 1), new Range32.ptr(67672, 67679, 1), new Range32.ptr(67705, 67711, 1), new Range32.ptr(67751, 67759, 1), new Range32.ptr(67835, 67839, 1), new Range32.ptr(67862, 67867, 1), new Range32.ptr(68028, 68029, 1), new Range32.ptr(68032, 68047, 1), new Range32.ptr(68050, 68095, 1), new Range32.ptr(68160, 68167, 1), new Range32.ptr(68221, 68222, 1), new Range32.ptr(68253, 68255, 1), new Range32.ptr(68331, 68335, 1), new Range32.ptr(68440, 68447, 1), new Range32.ptr(68472, 68479, 1), new Range32.ptr(68521, 68527, 1), new Range32.ptr(68858, 68863, 1), new Range32.ptr(69216, 69246, 1), new Range32.ptr(69714, 69743, 1), new Range32.ptr(69872, 69881, 1), new Range32.ptr(69942, 69951, 1), new Range32.ptr(70096, 70105, 1), new Range32.ptr(70113, 70132, 1), new Range32.ptr(70384, 70393, 1), new Range32.ptr(70736, 70745, 1), new Range32.ptr(70864, 70873, 1), new Range32.ptr(71248, 71257, 1), new Range32.ptr(71360, 71369, 1), new Range32.ptr(71472, 71483, 1), new Range32.ptr(71904, 71922, 1), new Range32.ptr(72784, 72812, 1), new Range32.ptr(73040, 73049, 1), new Range32.ptr(74752, 74862, 1), new Range32.ptr(92768, 92777, 1), new Range32.ptr(93008, 93017, 1), new Range32.ptr(93019, 93025, 1), new Range32.ptr(119648, 119665, 1), new Range32.ptr(120782, 120831, 1), new Range32.ptr(125127, 125135, 1), new Range32.ptr(125264, 125273, 1), new Range32.ptr(127232, 127244, 1)]), 4);
|
|
_Nd = new RangeTable.ptr(new sliceType([new Range16.ptr(48, 57, 1), new Range16.ptr(1632, 1641, 1), new Range16.ptr(1776, 1785, 1), new Range16.ptr(1984, 1993, 1), new Range16.ptr(2406, 2415, 1), new Range16.ptr(2534, 2543, 1), new Range16.ptr(2662, 2671, 1), new Range16.ptr(2790, 2799, 1), new Range16.ptr(2918, 2927, 1), new Range16.ptr(3046, 3055, 1), new Range16.ptr(3174, 3183, 1), new Range16.ptr(3302, 3311, 1), new Range16.ptr(3430, 3439, 1), new Range16.ptr(3558, 3567, 1), new Range16.ptr(3664, 3673, 1), new Range16.ptr(3792, 3801, 1), new Range16.ptr(3872, 3881, 1), new Range16.ptr(4160, 4169, 1), new Range16.ptr(4240, 4249, 1), new Range16.ptr(6112, 6121, 1), new Range16.ptr(6160, 6169, 1), new Range16.ptr(6470, 6479, 1), new Range16.ptr(6608, 6617, 1), new Range16.ptr(6784, 6793, 1), new Range16.ptr(6800, 6809, 1), new Range16.ptr(6992, 7001, 1), new Range16.ptr(7088, 7097, 1), new Range16.ptr(7232, 7241, 1), new Range16.ptr(7248, 7257, 1), new Range16.ptr(42528, 42537, 1), new Range16.ptr(43216, 43225, 1), new Range16.ptr(43264, 43273, 1), new Range16.ptr(43472, 43481, 1), new Range16.ptr(43504, 43513, 1), new Range16.ptr(43600, 43609, 1), new Range16.ptr(44016, 44025, 1), new Range16.ptr(65296, 65305, 1)]), new sliceType$1([new Range32.ptr(66720, 66729, 1), new Range32.ptr(69734, 69743, 1), new Range32.ptr(69872, 69881, 1), new Range32.ptr(69942, 69951, 1), new Range32.ptr(70096, 70105, 1), new Range32.ptr(70384, 70393, 1), new Range32.ptr(70736, 70745, 1), new Range32.ptr(70864, 70873, 1), new Range32.ptr(71248, 71257, 1), new Range32.ptr(71360, 71369, 1), new Range32.ptr(71472, 71481, 1), new Range32.ptr(71904, 71913, 1), new Range32.ptr(72784, 72793, 1), new Range32.ptr(73040, 73049, 1), new Range32.ptr(92768, 92777, 1), new Range32.ptr(93008, 93017, 1), new Range32.ptr(120782, 120831, 1), new Range32.ptr(125264, 125273, 1)]), 1);
|
|
_Nl = new RangeTable.ptr(new sliceType([new Range16.ptr(5870, 5872, 1), new Range16.ptr(8544, 8578, 1), new Range16.ptr(8581, 8584, 1), new Range16.ptr(12295, 12321, 26), new Range16.ptr(12322, 12329, 1), new Range16.ptr(12344, 12346, 1), new Range16.ptr(42726, 42735, 1)]), new sliceType$1([new Range32.ptr(65856, 65908, 1), new Range32.ptr(66369, 66378, 9), new Range32.ptr(66513, 66517, 1), new Range32.ptr(74752, 74862, 1)]), 0);
|
|
_No = new RangeTable.ptr(new sliceType([new Range16.ptr(178, 179, 1), new Range16.ptr(185, 188, 3), new Range16.ptr(189, 190, 1), new Range16.ptr(2548, 2553, 1), new Range16.ptr(2930, 2935, 1), new Range16.ptr(3056, 3058, 1), new Range16.ptr(3192, 3198, 1), new Range16.ptr(3416, 3422, 1), new Range16.ptr(3440, 3448, 1), new Range16.ptr(3882, 3891, 1), new Range16.ptr(4969, 4988, 1), new Range16.ptr(6128, 6137, 1), new Range16.ptr(6618, 8304, 1686), new Range16.ptr(8308, 8313, 1), new Range16.ptr(8320, 8329, 1), new Range16.ptr(8528, 8543, 1), new Range16.ptr(8585, 9312, 727), new Range16.ptr(9313, 9371, 1), new Range16.ptr(9450, 9471, 1), new Range16.ptr(10102, 10131, 1), new Range16.ptr(11517, 12690, 1173), new Range16.ptr(12691, 12693, 1), new Range16.ptr(12832, 12841, 1), new Range16.ptr(12872, 12879, 1), new Range16.ptr(12881, 12895, 1), new Range16.ptr(12928, 12937, 1), new Range16.ptr(12977, 12991, 1), new Range16.ptr(43056, 43061, 1)]), new sliceType$1([new Range32.ptr(65799, 65843, 1), new Range32.ptr(65909, 65912, 1), new Range32.ptr(65930, 65931, 1), new Range32.ptr(66273, 66299, 1), new Range32.ptr(66336, 66339, 1), new Range32.ptr(67672, 67679, 1), new Range32.ptr(67705, 67711, 1), new Range32.ptr(67751, 67759, 1), new Range32.ptr(67835, 67839, 1), new Range32.ptr(67862, 67867, 1), new Range32.ptr(68028, 68029, 1), new Range32.ptr(68032, 68047, 1), new Range32.ptr(68050, 68095, 1), new Range32.ptr(68160, 68167, 1), new Range32.ptr(68221, 68222, 1), new Range32.ptr(68253, 68255, 1), new Range32.ptr(68331, 68335, 1), new Range32.ptr(68440, 68447, 1), new Range32.ptr(68472, 68479, 1), new Range32.ptr(68521, 68527, 1), new Range32.ptr(68858, 68863, 1), new Range32.ptr(69216, 69246, 1), new Range32.ptr(69714, 69733, 1), new Range32.ptr(70113, 70132, 1), new Range32.ptr(71482, 71483, 1), new Range32.ptr(71914, 71922, 1), new Range32.ptr(72794, 72812, 1), new Range32.ptr(93019, 93025, 1), new Range32.ptr(119648, 119665, 1), new Range32.ptr(125127, 125135, 1), new Range32.ptr(127232, 127244, 1)]), 3);
|
|
_P = new RangeTable.ptr(new sliceType([new Range16.ptr(33, 35, 1), new Range16.ptr(37, 42, 1), new Range16.ptr(44, 47, 1), new Range16.ptr(58, 59, 1), new Range16.ptr(63, 64, 1), new Range16.ptr(91, 93, 1), new Range16.ptr(95, 123, 28), new Range16.ptr(125, 161, 36), new Range16.ptr(167, 171, 4), new Range16.ptr(182, 183, 1), new Range16.ptr(187, 191, 4), new Range16.ptr(894, 903, 9), new Range16.ptr(1370, 1375, 1), new Range16.ptr(1417, 1418, 1), new Range16.ptr(1470, 1472, 2), new Range16.ptr(1475, 1478, 3), new Range16.ptr(1523, 1524, 1), new Range16.ptr(1545, 1546, 1), new Range16.ptr(1548, 1549, 1), new Range16.ptr(1563, 1566, 3), new Range16.ptr(1567, 1642, 75), new Range16.ptr(1643, 1645, 1), new Range16.ptr(1748, 1792, 44), new Range16.ptr(1793, 1805, 1), new Range16.ptr(2039, 2041, 1), new Range16.ptr(2096, 2110, 1), new Range16.ptr(2142, 2404, 262), new Range16.ptr(2405, 2416, 11), new Range16.ptr(2557, 2800, 243), new Range16.ptr(3572, 3663, 91), new Range16.ptr(3674, 3675, 1), new Range16.ptr(3844, 3858, 1), new Range16.ptr(3860, 3898, 38), new Range16.ptr(3899, 3901, 1), new Range16.ptr(3973, 4048, 75), new Range16.ptr(4049, 4052, 1), new Range16.ptr(4057, 4058, 1), new Range16.ptr(4170, 4175, 1), new Range16.ptr(4347, 4960, 613), new Range16.ptr(4961, 4968, 1), new Range16.ptr(5120, 5741, 621), new Range16.ptr(5742, 5787, 45), new Range16.ptr(5788, 5867, 79), new Range16.ptr(5868, 5869, 1), new Range16.ptr(5941, 5942, 1), new Range16.ptr(6100, 6102, 1), new Range16.ptr(6104, 6106, 1), new Range16.ptr(6144, 6154, 1), new Range16.ptr(6468, 6469, 1), new Range16.ptr(6686, 6687, 1), new Range16.ptr(6816, 6822, 1), new Range16.ptr(6824, 6829, 1), new Range16.ptr(7002, 7008, 1), new Range16.ptr(7164, 7167, 1), new Range16.ptr(7227, 7231, 1), new Range16.ptr(7294, 7295, 1), new Range16.ptr(7360, 7367, 1), new Range16.ptr(7379, 8208, 829), new Range16.ptr(8209, 8231, 1), new Range16.ptr(8240, 8259, 1), new Range16.ptr(8261, 8273, 1), new Range16.ptr(8275, 8286, 1), new Range16.ptr(8317, 8318, 1), new Range16.ptr(8333, 8334, 1), new Range16.ptr(8968, 8971, 1), new Range16.ptr(9001, 9002, 1), new Range16.ptr(10088, 10101, 1), new Range16.ptr(10181, 10182, 1), new Range16.ptr(10214, 10223, 1), new Range16.ptr(10627, 10648, 1), new Range16.ptr(10712, 10715, 1), new Range16.ptr(10748, 10749, 1), new Range16.ptr(11513, 11516, 1), new Range16.ptr(11518, 11519, 1), new Range16.ptr(11632, 11776, 144), new Range16.ptr(11777, 11822, 1), new Range16.ptr(11824, 11849, 1), new Range16.ptr(12289, 12291, 1), new Range16.ptr(12296, 12305, 1), new Range16.ptr(12308, 12319, 1), new Range16.ptr(12336, 12349, 13), new Range16.ptr(12448, 12539, 91), new Range16.ptr(42238, 42239, 1), new Range16.ptr(42509, 42511, 1), new Range16.ptr(42611, 42622, 11), new Range16.ptr(42738, 42743, 1), new Range16.ptr(43124, 43127, 1), new Range16.ptr(43214, 43215, 1), new Range16.ptr(43256, 43258, 1), new Range16.ptr(43260, 43310, 50), new Range16.ptr(43311, 43359, 48), new Range16.ptr(43457, 43469, 1), new Range16.ptr(43486, 43487, 1), new Range16.ptr(43612, 43615, 1), new Range16.ptr(43742, 43743, 1), new Range16.ptr(43760, 43761, 1), new Range16.ptr(44011, 64830, 20819), new Range16.ptr(64831, 65040, 209), new Range16.ptr(65041, 65049, 1), new Range16.ptr(65072, 65106, 1), new Range16.ptr(65108, 65121, 1), new Range16.ptr(65123, 65128, 5), new Range16.ptr(65130, 65131, 1), new Range16.ptr(65281, 65283, 1), new Range16.ptr(65285, 65290, 1), new Range16.ptr(65292, 65295, 1), new Range16.ptr(65306, 65307, 1), new Range16.ptr(65311, 65312, 1), new Range16.ptr(65339, 65341, 1), new Range16.ptr(65343, 65371, 28), new Range16.ptr(65373, 65375, 2), new Range16.ptr(65376, 65381, 1)]), new sliceType$1([new Range32.ptr(65792, 65794, 1), new Range32.ptr(66463, 66512, 49), new Range32.ptr(66927, 67671, 744), new Range32.ptr(67871, 67903, 32), new Range32.ptr(68176, 68184, 1), new Range32.ptr(68223, 68336, 113), new Range32.ptr(68337, 68342, 1), new Range32.ptr(68409, 68415, 1), new Range32.ptr(68505, 68508, 1), new Range32.ptr(69703, 69709, 1), new Range32.ptr(69819, 69820, 1), new Range32.ptr(69822, 69825, 1), new Range32.ptr(69952, 69955, 1), new Range32.ptr(70004, 70005, 1), new Range32.ptr(70085, 70089, 1), new Range32.ptr(70093, 70107, 14), new Range32.ptr(70109, 70111, 1), new Range32.ptr(70200, 70205, 1), new Range32.ptr(70313, 70731, 418), new Range32.ptr(70732, 70735, 1), new Range32.ptr(70747, 70749, 2), new Range32.ptr(70854, 71105, 251), new Range32.ptr(71106, 71127, 1), new Range32.ptr(71233, 71235, 1), new Range32.ptr(71264, 71276, 1), new Range32.ptr(71484, 71486, 1), new Range32.ptr(72255, 72262, 1), new Range32.ptr(72346, 72348, 1), new Range32.ptr(72350, 72354, 1), new Range32.ptr(72769, 72773, 1), new Range32.ptr(72816, 72817, 1), new Range32.ptr(74864, 74868, 1), new Range32.ptr(92782, 92783, 1), new Range32.ptr(92917, 92983, 66), new Range32.ptr(92984, 92987, 1), new Range32.ptr(92996, 113823, 20827), new Range32.ptr(121479, 121483, 1), new Range32.ptr(125278, 125279, 1)]), 11);
|
|
_Pc = new RangeTable.ptr(new sliceType([new Range16.ptr(95, 8255, 8160), new Range16.ptr(8256, 8276, 20), new Range16.ptr(65075, 65076, 1), new Range16.ptr(65101, 65103, 1), new Range16.ptr(65343, 65343, 1)]), sliceType$1.nil, 0);
|
|
_Pd = new RangeTable.ptr(new sliceType([new Range16.ptr(45, 1418, 1373), new Range16.ptr(1470, 5120, 3650), new Range16.ptr(6150, 8208, 2058), new Range16.ptr(8209, 8213, 1), new Range16.ptr(11799, 11802, 3), new Range16.ptr(11834, 11835, 1), new Range16.ptr(11840, 12316, 476), new Range16.ptr(12336, 12448, 112), new Range16.ptr(65073, 65074, 1), new Range16.ptr(65112, 65123, 11), new Range16.ptr(65293, 65293, 1)]), sliceType$1.nil, 0);
|
|
_Pe = new RangeTable.ptr(new sliceType([new Range16.ptr(41, 93, 52), new Range16.ptr(125, 3899, 3774), new Range16.ptr(3901, 5788, 1887), new Range16.ptr(8262, 8318, 56), new Range16.ptr(8334, 8969, 635), new Range16.ptr(8971, 9002, 31), new Range16.ptr(10089, 10101, 2), new Range16.ptr(10182, 10215, 33), new Range16.ptr(10217, 10223, 2), new Range16.ptr(10628, 10648, 2), new Range16.ptr(10713, 10715, 2), new Range16.ptr(10749, 11811, 1062), new Range16.ptr(11813, 11817, 2), new Range16.ptr(12297, 12305, 2), new Range16.ptr(12309, 12315, 2), new Range16.ptr(12318, 12319, 1), new Range16.ptr(64830, 65048, 218), new Range16.ptr(65078, 65092, 2), new Range16.ptr(65096, 65114, 18), new Range16.ptr(65116, 65118, 2), new Range16.ptr(65289, 65341, 52), new Range16.ptr(65373, 65379, 3)]), sliceType$1.nil, 1);
|
|
_Pf = new RangeTable.ptr(new sliceType([new Range16.ptr(187, 8217, 8030), new Range16.ptr(8221, 8250, 29), new Range16.ptr(11779, 11781, 2), new Range16.ptr(11786, 11789, 3), new Range16.ptr(11805, 11809, 4)]), sliceType$1.nil, 0);
|
|
_Pi = new RangeTable.ptr(new sliceType([new Range16.ptr(171, 8216, 8045), new Range16.ptr(8219, 8220, 1), new Range16.ptr(8223, 8249, 26), new Range16.ptr(11778, 11780, 2), new Range16.ptr(11785, 11788, 3), new Range16.ptr(11804, 11808, 4)]), sliceType$1.nil, 0);
|
|
_Po = new RangeTable.ptr(new sliceType([new Range16.ptr(33, 35, 1), new Range16.ptr(37, 39, 1), new Range16.ptr(42, 46, 2), new Range16.ptr(47, 58, 11), new Range16.ptr(59, 63, 4), new Range16.ptr(64, 92, 28), new Range16.ptr(161, 167, 6), new Range16.ptr(182, 183, 1), new Range16.ptr(191, 894, 703), new Range16.ptr(903, 1370, 467), new Range16.ptr(1371, 1375, 1), new Range16.ptr(1417, 1472, 55), new Range16.ptr(1475, 1478, 3), new Range16.ptr(1523, 1524, 1), new Range16.ptr(1545, 1546, 1), new Range16.ptr(1548, 1549, 1), new Range16.ptr(1563, 1566, 3), new Range16.ptr(1567, 1642, 75), new Range16.ptr(1643, 1645, 1), new Range16.ptr(1748, 1792, 44), new Range16.ptr(1793, 1805, 1), new Range16.ptr(2039, 2041, 1), new Range16.ptr(2096, 2110, 1), new Range16.ptr(2142, 2404, 262), new Range16.ptr(2405, 2416, 11), new Range16.ptr(2557, 2800, 243), new Range16.ptr(3572, 3663, 91), new Range16.ptr(3674, 3675, 1), new Range16.ptr(3844, 3858, 1), new Range16.ptr(3860, 3973, 113), new Range16.ptr(4048, 4052, 1), new Range16.ptr(4057, 4058, 1), new Range16.ptr(4170, 4175, 1), new Range16.ptr(4347, 4960, 613), new Range16.ptr(4961, 4968, 1), new Range16.ptr(5741, 5742, 1), new Range16.ptr(5867, 5869, 1), new Range16.ptr(5941, 5942, 1), new Range16.ptr(6100, 6102, 1), new Range16.ptr(6104, 6106, 1), new Range16.ptr(6144, 6149, 1), new Range16.ptr(6151, 6154, 1), new Range16.ptr(6468, 6469, 1), new Range16.ptr(6686, 6687, 1), new Range16.ptr(6816, 6822, 1), new Range16.ptr(6824, 6829, 1), new Range16.ptr(7002, 7008, 1), new Range16.ptr(7164, 7167, 1), new Range16.ptr(7227, 7231, 1), new Range16.ptr(7294, 7295, 1), new Range16.ptr(7360, 7367, 1), new Range16.ptr(7379, 8214, 835), new Range16.ptr(8215, 8224, 9), new Range16.ptr(8225, 8231, 1), new Range16.ptr(8240, 8248, 1), new Range16.ptr(8251, 8254, 1), new Range16.ptr(8257, 8259, 1), new Range16.ptr(8263, 8273, 1), new Range16.ptr(8275, 8277, 2), new Range16.ptr(8278, 8286, 1), new Range16.ptr(11513, 11516, 1), new Range16.ptr(11518, 11519, 1), new Range16.ptr(11632, 11776, 144), new Range16.ptr(11777, 11782, 5), new Range16.ptr(11783, 11784, 1), new Range16.ptr(11787, 11790, 3), new Range16.ptr(11791, 11798, 1), new Range16.ptr(11800, 11801, 1), new Range16.ptr(11803, 11806, 3), new Range16.ptr(11807, 11818, 11), new Range16.ptr(11819, 11822, 1), new Range16.ptr(11824, 11833, 1), new Range16.ptr(11836, 11839, 1), new Range16.ptr(11841, 11843, 2), new Range16.ptr(11844, 11849, 1), new Range16.ptr(12289, 12291, 1), new Range16.ptr(12349, 12539, 190), new Range16.ptr(42238, 42239, 1), new Range16.ptr(42509, 42511, 1), new Range16.ptr(42611, 42622, 11), new Range16.ptr(42738, 42743, 1), new Range16.ptr(43124, 43127, 1), new Range16.ptr(43214, 43215, 1), new Range16.ptr(43256, 43258, 1), new Range16.ptr(43260, 43310, 50), new Range16.ptr(43311, 43359, 48), new Range16.ptr(43457, 43469, 1), new Range16.ptr(43486, 43487, 1), new Range16.ptr(43612, 43615, 1), new Range16.ptr(43742, 43743, 1), new Range16.ptr(43760, 43761, 1), new Range16.ptr(44011, 65040, 21029), new Range16.ptr(65041, 65046, 1), new Range16.ptr(65049, 65072, 23), new Range16.ptr(65093, 65094, 1), new Range16.ptr(65097, 65100, 1), new Range16.ptr(65104, 65106, 1), new Range16.ptr(65108, 65111, 1), new Range16.ptr(65119, 65121, 1), new Range16.ptr(65128, 65130, 2), new Range16.ptr(65131, 65281, 150), new Range16.ptr(65282, 65283, 1), new Range16.ptr(65285, 65287, 1), new Range16.ptr(65290, 65294, 2), new Range16.ptr(65295, 65306, 11), new Range16.ptr(65307, 65311, 4), new Range16.ptr(65312, 65340, 28), new Range16.ptr(65377, 65380, 3), new Range16.ptr(65381, 65381, 1)]), new sliceType$1([new Range32.ptr(65792, 65792, 1), new Range32.ptr(65793, 65794, 1), new Range32.ptr(66463, 66512, 49), new Range32.ptr(66927, 67671, 744), new Range32.ptr(67871, 67903, 32), new Range32.ptr(68176, 68184, 1), new Range32.ptr(68223, 68336, 113), new Range32.ptr(68337, 68342, 1), new Range32.ptr(68409, 68415, 1), new Range32.ptr(68505, 68508, 1), new Range32.ptr(69703, 69709, 1), new Range32.ptr(69819, 69820, 1), new Range32.ptr(69822, 69825, 1), new Range32.ptr(69952, 69955, 1), new Range32.ptr(70004, 70005, 1), new Range32.ptr(70085, 70089, 1), new Range32.ptr(70093, 70107, 14), new Range32.ptr(70109, 70111, 1), new Range32.ptr(70200, 70205, 1), new Range32.ptr(70313, 70731, 418), new Range32.ptr(70732, 70735, 1), new Range32.ptr(70747, 70749, 2), new Range32.ptr(70854, 71105, 251), new Range32.ptr(71106, 71127, 1), new Range32.ptr(71233, 71235, 1), new Range32.ptr(71264, 71276, 1), new Range32.ptr(71484, 71486, 1), new Range32.ptr(72255, 72262, 1), new Range32.ptr(72346, 72348, 1), new Range32.ptr(72350, 72354, 1), new Range32.ptr(72769, 72773, 1), new Range32.ptr(72816, 72817, 1), new Range32.ptr(74864, 74868, 1), new Range32.ptr(92782, 92783, 1), new Range32.ptr(92917, 92983, 66), new Range32.ptr(92984, 92987, 1), new Range32.ptr(92996, 113823, 20827), new Range32.ptr(121479, 121483, 1), new Range32.ptr(125278, 125279, 1)]), 8);
|
|
_Ps = new RangeTable.ptr(new sliceType([new Range16.ptr(40, 91, 51), new Range16.ptr(123, 3898, 3775), new Range16.ptr(3900, 5787, 1887), new Range16.ptr(8218, 8222, 4), new Range16.ptr(8261, 8317, 56), new Range16.ptr(8333, 8968, 635), new Range16.ptr(8970, 9001, 31), new Range16.ptr(10088, 10100, 2), new Range16.ptr(10181, 10214, 33), new Range16.ptr(10216, 10222, 2), new Range16.ptr(10627, 10647, 2), new Range16.ptr(10712, 10714, 2), new Range16.ptr(10748, 11810, 1062), new Range16.ptr(11812, 11816, 2), new Range16.ptr(11842, 12296, 454), new Range16.ptr(12298, 12304, 2), new Range16.ptr(12308, 12314, 2), new Range16.ptr(12317, 64831, 52514), new Range16.ptr(65047, 65077, 30), new Range16.ptr(65079, 65091, 2), new Range16.ptr(65095, 65113, 18), new Range16.ptr(65115, 65117, 2), new Range16.ptr(65288, 65339, 51), new Range16.ptr(65371, 65375, 4), new Range16.ptr(65378, 65378, 1)]), sliceType$1.nil, 1);
|
|
_S = new RangeTable.ptr(new sliceType([new Range16.ptr(36, 43, 7), new Range16.ptr(60, 62, 1), new Range16.ptr(94, 96, 2), new Range16.ptr(124, 126, 2), new Range16.ptr(162, 166, 1), new Range16.ptr(168, 169, 1), new Range16.ptr(172, 174, 2), new Range16.ptr(175, 177, 1), new Range16.ptr(180, 184, 4), new Range16.ptr(215, 247, 32), new Range16.ptr(706, 709, 1), new Range16.ptr(722, 735, 1), new Range16.ptr(741, 747, 1), new Range16.ptr(749, 751, 2), new Range16.ptr(752, 767, 1), new Range16.ptr(885, 900, 15), new Range16.ptr(901, 1014, 113), new Range16.ptr(1154, 1421, 267), new Range16.ptr(1422, 1423, 1), new Range16.ptr(1542, 1544, 1), new Range16.ptr(1547, 1550, 3), new Range16.ptr(1551, 1758, 207), new Range16.ptr(1769, 1789, 20), new Range16.ptr(1790, 2038, 248), new Range16.ptr(2546, 2547, 1), new Range16.ptr(2554, 2555, 1), new Range16.ptr(2801, 2928, 127), new Range16.ptr(3059, 3066, 1), new Range16.ptr(3199, 3407, 208), new Range16.ptr(3449, 3647, 198), new Range16.ptr(3841, 3843, 1), new Range16.ptr(3859, 3861, 2), new Range16.ptr(3862, 3863, 1), new Range16.ptr(3866, 3871, 1), new Range16.ptr(3892, 3896, 2), new Range16.ptr(4030, 4037, 1), new Range16.ptr(4039, 4044, 1), new Range16.ptr(4046, 4047, 1), new Range16.ptr(4053, 4056, 1), new Range16.ptr(4254, 4255, 1), new Range16.ptr(5008, 5017, 1), new Range16.ptr(6107, 6464, 357), new Range16.ptr(6622, 6655, 1), new Range16.ptr(7009, 7018, 1), new Range16.ptr(7028, 7036, 1), new Range16.ptr(8125, 8127, 2), new Range16.ptr(8128, 8129, 1), new Range16.ptr(8141, 8143, 1), new Range16.ptr(8157, 8159, 1), new Range16.ptr(8173, 8175, 1), new Range16.ptr(8189, 8190, 1), new Range16.ptr(8260, 8274, 14), new Range16.ptr(8314, 8316, 1), new Range16.ptr(8330, 8332, 1), new Range16.ptr(8352, 8383, 1), new Range16.ptr(8448, 8449, 1), new Range16.ptr(8451, 8454, 1), new Range16.ptr(8456, 8457, 1), new Range16.ptr(8468, 8470, 2), new Range16.ptr(8471, 8472, 1), new Range16.ptr(8478, 8483, 1), new Range16.ptr(8485, 8489, 2), new Range16.ptr(8494, 8506, 12), new Range16.ptr(8507, 8512, 5), new Range16.ptr(8513, 8516, 1), new Range16.ptr(8522, 8525, 1), new Range16.ptr(8527, 8586, 59), new Range16.ptr(8587, 8592, 5), new Range16.ptr(8593, 8967, 1), new Range16.ptr(8972, 9000, 1), new Range16.ptr(9003, 9254, 1), new Range16.ptr(9280, 9290, 1), new Range16.ptr(9372, 9449, 1), new Range16.ptr(9472, 10087, 1), new Range16.ptr(10132, 10180, 1), new Range16.ptr(10183, 10213, 1), new Range16.ptr(10224, 10626, 1), new Range16.ptr(10649, 10711, 1), new Range16.ptr(10716, 10747, 1), new Range16.ptr(10750, 11123, 1), new Range16.ptr(11126, 11157, 1), new Range16.ptr(11160, 11193, 1), new Range16.ptr(11197, 11208, 1), new Range16.ptr(11210, 11218, 1), new Range16.ptr(11244, 11247, 1), new Range16.ptr(11493, 11498, 1), new Range16.ptr(11904, 11929, 1), new Range16.ptr(11931, 12019, 1), new Range16.ptr(12032, 12245, 1), new Range16.ptr(12272, 12283, 1), new Range16.ptr(12292, 12306, 14), new Range16.ptr(12307, 12320, 13), new Range16.ptr(12342, 12343, 1), new Range16.ptr(12350, 12351, 1), new Range16.ptr(12443, 12444, 1), new Range16.ptr(12688, 12689, 1), new Range16.ptr(12694, 12703, 1), new Range16.ptr(12736, 12771, 1), new Range16.ptr(12800, 12830, 1), new Range16.ptr(12842, 12871, 1), new Range16.ptr(12880, 12896, 16), new Range16.ptr(12897, 12927, 1), new Range16.ptr(12938, 12976, 1), new Range16.ptr(12992, 13054, 1), new Range16.ptr(13056, 13311, 1), new Range16.ptr(19904, 19967, 1), new Range16.ptr(42128, 42182, 1), new Range16.ptr(42752, 42774, 1), new Range16.ptr(42784, 42785, 1), new Range16.ptr(42889, 42890, 1), new Range16.ptr(43048, 43051, 1), new Range16.ptr(43062, 43065, 1), new Range16.ptr(43639, 43641, 1), new Range16.ptr(43867, 64297, 20430), new Range16.ptr(64434, 64449, 1), new Range16.ptr(65020, 65021, 1), new Range16.ptr(65122, 65124, 2), new Range16.ptr(65125, 65126, 1), new Range16.ptr(65129, 65284, 155), new Range16.ptr(65291, 65308, 17), new Range16.ptr(65309, 65310, 1), new Range16.ptr(65342, 65344, 2), new Range16.ptr(65372, 65374, 2), new Range16.ptr(65504, 65510, 1), new Range16.ptr(65512, 65518, 1), new Range16.ptr(65532, 65533, 1)]), new sliceType$1([new Range32.ptr(65847, 65855, 1), new Range32.ptr(65913, 65929, 1), new Range32.ptr(65932, 65934, 1), new Range32.ptr(65936, 65947, 1), new Range32.ptr(65952, 66000, 48), new Range32.ptr(66001, 66044, 1), new Range32.ptr(67703, 67704, 1), new Range32.ptr(68296, 71487, 3191), new Range32.ptr(92988, 92991, 1), new Range32.ptr(92997, 113820, 20823), new Range32.ptr(118784, 119029, 1), new Range32.ptr(119040, 119078, 1), new Range32.ptr(119081, 119140, 1), new Range32.ptr(119146, 119148, 1), new Range32.ptr(119171, 119172, 1), new Range32.ptr(119180, 119209, 1), new Range32.ptr(119214, 119272, 1), new Range32.ptr(119296, 119361, 1), new Range32.ptr(119365, 119552, 187), new Range32.ptr(119553, 119638, 1), new Range32.ptr(120513, 120539, 26), new Range32.ptr(120571, 120597, 26), new Range32.ptr(120629, 120655, 26), new Range32.ptr(120687, 120713, 26), new Range32.ptr(120745, 120771, 26), new Range32.ptr(120832, 121343, 1), new Range32.ptr(121399, 121402, 1), new Range32.ptr(121453, 121460, 1), new Range32.ptr(121462, 121475, 1), new Range32.ptr(121477, 121478, 1), new Range32.ptr(126704, 126705, 1), new Range32.ptr(126976, 127019, 1), new Range32.ptr(127024, 127123, 1), new Range32.ptr(127136, 127150, 1), new Range32.ptr(127153, 127167, 1), new Range32.ptr(127169, 127183, 1), new Range32.ptr(127185, 127221, 1), new Range32.ptr(127248, 127278, 1), new Range32.ptr(127280, 127339, 1), new Range32.ptr(127344, 127404, 1), new Range32.ptr(127462, 127490, 1), new Range32.ptr(127504, 127547, 1), new Range32.ptr(127552, 127560, 1), new Range32.ptr(127568, 127569, 1), new Range32.ptr(127584, 127589, 1), new Range32.ptr(127744, 128724, 1), new Range32.ptr(128736, 128748, 1), new Range32.ptr(128752, 128760, 1), new Range32.ptr(128768, 128883, 1), new Range32.ptr(128896, 128980, 1), new Range32.ptr(129024, 129035, 1), new Range32.ptr(129040, 129095, 1), new Range32.ptr(129104, 129113, 1), new Range32.ptr(129120, 129159, 1), new Range32.ptr(129168, 129197, 1), new Range32.ptr(129280, 129291, 1), new Range32.ptr(129296, 129342, 1), new Range32.ptr(129344, 129356, 1), new Range32.ptr(129360, 129387, 1), new Range32.ptr(129408, 129431, 1), new Range32.ptr(129472, 129488, 16), new Range32.ptr(129489, 129510, 1)]), 10);
|
|
_Sc = new RangeTable.ptr(new sliceType([new Range16.ptr(36, 162, 126), new Range16.ptr(163, 165, 1), new Range16.ptr(1423, 1547, 124), new Range16.ptr(2546, 2547, 1), new Range16.ptr(2555, 2801, 246), new Range16.ptr(3065, 3647, 582), new Range16.ptr(6107, 8352, 2245), new Range16.ptr(8353, 8383, 1), new Range16.ptr(43064, 65020, 21956), new Range16.ptr(65129, 65284, 155), new Range16.ptr(65504, 65505, 1), new Range16.ptr(65509, 65510, 1)]), sliceType$1.nil, 2);
|
|
_Sk = new RangeTable.ptr(new sliceType([new Range16.ptr(94, 96, 2), new Range16.ptr(168, 175, 7), new Range16.ptr(180, 184, 4), new Range16.ptr(706, 709, 1), new Range16.ptr(722, 735, 1), new Range16.ptr(741, 747, 1), new Range16.ptr(749, 751, 2), new Range16.ptr(752, 767, 1), new Range16.ptr(885, 900, 15), new Range16.ptr(901, 8125, 7224), new Range16.ptr(8127, 8129, 1), new Range16.ptr(8141, 8143, 1), new Range16.ptr(8157, 8159, 1), new Range16.ptr(8173, 8175, 1), new Range16.ptr(8189, 8190, 1), new Range16.ptr(12443, 12444, 1), new Range16.ptr(42752, 42774, 1), new Range16.ptr(42784, 42785, 1), new Range16.ptr(42889, 42890, 1), new Range16.ptr(43867, 64434, 20567), new Range16.ptr(64435, 64449, 1), new Range16.ptr(65342, 65344, 2), new Range16.ptr(65507, 65507, 1)]), new sliceType$1([new Range32.ptr(127995, 127995, 1), new Range32.ptr(127996, 127999, 1)]), 3);
|
|
_Sm = new RangeTable.ptr(new sliceType([new Range16.ptr(43, 60, 17), new Range16.ptr(61, 62, 1), new Range16.ptr(124, 126, 2), new Range16.ptr(172, 177, 5), new Range16.ptr(215, 247, 32), new Range16.ptr(1014, 1542, 528), new Range16.ptr(1543, 1544, 1), new Range16.ptr(8260, 8274, 14), new Range16.ptr(8314, 8316, 1), new Range16.ptr(8330, 8332, 1), new Range16.ptr(8472, 8512, 40), new Range16.ptr(8513, 8516, 1), new Range16.ptr(8523, 8592, 69), new Range16.ptr(8593, 8596, 1), new Range16.ptr(8602, 8603, 1), new Range16.ptr(8608, 8614, 3), new Range16.ptr(8622, 8654, 32), new Range16.ptr(8655, 8658, 3), new Range16.ptr(8660, 8692, 32), new Range16.ptr(8693, 8959, 1), new Range16.ptr(8992, 8993, 1), new Range16.ptr(9084, 9115, 31), new Range16.ptr(9116, 9139, 1), new Range16.ptr(9180, 9185, 1), new Range16.ptr(9655, 9665, 10), new Range16.ptr(9720, 9727, 1), new Range16.ptr(9839, 10176, 337), new Range16.ptr(10177, 10180, 1), new Range16.ptr(10183, 10213, 1), new Range16.ptr(10224, 10239, 1), new Range16.ptr(10496, 10626, 1), new Range16.ptr(10649, 10711, 1), new Range16.ptr(10716, 10747, 1), new Range16.ptr(10750, 11007, 1), new Range16.ptr(11056, 11076, 1), new Range16.ptr(11079, 11084, 1), new Range16.ptr(64297, 65122, 825), new Range16.ptr(65124, 65126, 1), new Range16.ptr(65291, 65308, 17), new Range16.ptr(65309, 65310, 1), new Range16.ptr(65372, 65374, 2), new Range16.ptr(65506, 65513, 7), new Range16.ptr(65514, 65516, 1)]), new sliceType$1([new Range32.ptr(120513, 120539, 26), new Range32.ptr(120571, 120597, 26), new Range32.ptr(120629, 120655, 26), new Range32.ptr(120687, 120713, 26), new Range32.ptr(120745, 120771, 26), new Range32.ptr(126704, 126705, 1)]), 5);
|
|
_So = new RangeTable.ptr(new sliceType([new Range16.ptr(166, 169, 3), new Range16.ptr(174, 176, 2), new Range16.ptr(1154, 1421, 267), new Range16.ptr(1422, 1550, 128), new Range16.ptr(1551, 1758, 207), new Range16.ptr(1769, 1789, 20), new Range16.ptr(1790, 2038, 248), new Range16.ptr(2554, 2928, 374), new Range16.ptr(3059, 3064, 1), new Range16.ptr(3066, 3199, 133), new Range16.ptr(3407, 3449, 42), new Range16.ptr(3841, 3843, 1), new Range16.ptr(3859, 3861, 2), new Range16.ptr(3862, 3863, 1), new Range16.ptr(3866, 3871, 1), new Range16.ptr(3892, 3896, 2), new Range16.ptr(4030, 4037, 1), new Range16.ptr(4039, 4044, 1), new Range16.ptr(4046, 4047, 1), new Range16.ptr(4053, 4056, 1), new Range16.ptr(4254, 4255, 1), new Range16.ptr(5008, 5017, 1), new Range16.ptr(6464, 6622, 158), new Range16.ptr(6623, 6655, 1), new Range16.ptr(7009, 7018, 1), new Range16.ptr(7028, 7036, 1), new Range16.ptr(8448, 8449, 1), new Range16.ptr(8451, 8454, 1), new Range16.ptr(8456, 8457, 1), new Range16.ptr(8468, 8470, 2), new Range16.ptr(8471, 8478, 7), new Range16.ptr(8479, 8483, 1), new Range16.ptr(8485, 8489, 2), new Range16.ptr(8494, 8506, 12), new Range16.ptr(8507, 8522, 15), new Range16.ptr(8524, 8525, 1), new Range16.ptr(8527, 8586, 59), new Range16.ptr(8587, 8597, 10), new Range16.ptr(8598, 8601, 1), new Range16.ptr(8604, 8607, 1), new Range16.ptr(8609, 8610, 1), new Range16.ptr(8612, 8613, 1), new Range16.ptr(8615, 8621, 1), new Range16.ptr(8623, 8653, 1), new Range16.ptr(8656, 8657, 1), new Range16.ptr(8659, 8661, 2), new Range16.ptr(8662, 8691, 1), new Range16.ptr(8960, 8967, 1), new Range16.ptr(8972, 8991, 1), new Range16.ptr(8994, 9000, 1), new Range16.ptr(9003, 9083, 1), new Range16.ptr(9085, 9114, 1), new Range16.ptr(9140, 9179, 1), new Range16.ptr(9186, 9254, 1), new Range16.ptr(9280, 9290, 1), new Range16.ptr(9372, 9449, 1), new Range16.ptr(9472, 9654, 1), new Range16.ptr(9656, 9664, 1), new Range16.ptr(9666, 9719, 1), new Range16.ptr(9728, 9838, 1), new Range16.ptr(9840, 10087, 1), new Range16.ptr(10132, 10175, 1), new Range16.ptr(10240, 10495, 1), new Range16.ptr(11008, 11055, 1), new Range16.ptr(11077, 11078, 1), new Range16.ptr(11085, 11123, 1), new Range16.ptr(11126, 11157, 1), new Range16.ptr(11160, 11193, 1), new Range16.ptr(11197, 11208, 1), new Range16.ptr(11210, 11218, 1), new Range16.ptr(11244, 11247, 1), new Range16.ptr(11493, 11498, 1), new Range16.ptr(11904, 11929, 1), new Range16.ptr(11931, 12019, 1), new Range16.ptr(12032, 12245, 1), new Range16.ptr(12272, 12283, 1), new Range16.ptr(12292, 12306, 14), new Range16.ptr(12307, 12320, 13), new Range16.ptr(12342, 12343, 1), new Range16.ptr(12350, 12351, 1), new Range16.ptr(12688, 12689, 1), new Range16.ptr(12694, 12703, 1), new Range16.ptr(12736, 12771, 1), new Range16.ptr(12800, 12830, 1), new Range16.ptr(12842, 12871, 1), new Range16.ptr(12880, 12896, 16), new Range16.ptr(12897, 12927, 1), new Range16.ptr(12938, 12976, 1), new Range16.ptr(12992, 13054, 1), new Range16.ptr(13056, 13311, 1), new Range16.ptr(19904, 19967, 1), new Range16.ptr(42128, 42182, 1), new Range16.ptr(43048, 43051, 1), new Range16.ptr(43062, 43063, 1), new Range16.ptr(43065, 43639, 574), new Range16.ptr(43640, 43641, 1), new Range16.ptr(65021, 65508, 487), new Range16.ptr(65512, 65517, 5), new Range16.ptr(65518, 65532, 14), new Range16.ptr(65533, 65533, 1)]), new sliceType$1([new Range32.ptr(65847, 65847, 1), new Range32.ptr(65848, 65855, 1), new Range32.ptr(65913, 65929, 1), new Range32.ptr(65932, 65934, 1), new Range32.ptr(65936, 65947, 1), new Range32.ptr(65952, 66000, 48), new Range32.ptr(66001, 66044, 1), new Range32.ptr(67703, 67704, 1), new Range32.ptr(68296, 71487, 3191), new Range32.ptr(92988, 92991, 1), new Range32.ptr(92997, 113820, 20823), new Range32.ptr(118784, 119029, 1), new Range32.ptr(119040, 119078, 1), new Range32.ptr(119081, 119140, 1), new Range32.ptr(119146, 119148, 1), new Range32.ptr(119171, 119172, 1), new Range32.ptr(119180, 119209, 1), new Range32.ptr(119214, 119272, 1), new Range32.ptr(119296, 119361, 1), new Range32.ptr(119365, 119552, 187), new Range32.ptr(119553, 119638, 1), new Range32.ptr(120832, 121343, 1), new Range32.ptr(121399, 121402, 1), new Range32.ptr(121453, 121460, 1), new Range32.ptr(121462, 121475, 1), new Range32.ptr(121477, 121478, 1), new Range32.ptr(126976, 127019, 1), new Range32.ptr(127024, 127123, 1), new Range32.ptr(127136, 127150, 1), new Range32.ptr(127153, 127167, 1), new Range32.ptr(127169, 127183, 1), new Range32.ptr(127185, 127221, 1), new Range32.ptr(127248, 127278, 1), new Range32.ptr(127280, 127339, 1), new Range32.ptr(127344, 127404, 1), new Range32.ptr(127462, 127490, 1), new Range32.ptr(127504, 127547, 1), new Range32.ptr(127552, 127560, 1), new Range32.ptr(127568, 127569, 1), new Range32.ptr(127584, 127589, 1), new Range32.ptr(127744, 127994, 1), new Range32.ptr(128000, 128724, 1), new Range32.ptr(128736, 128748, 1), new Range32.ptr(128752, 128760, 1), new Range32.ptr(128768, 128883, 1), new Range32.ptr(128896, 128980, 1), new Range32.ptr(129024, 129035, 1), new Range32.ptr(129040, 129095, 1), new Range32.ptr(129104, 129113, 1), new Range32.ptr(129120, 129159, 1), new Range32.ptr(129168, 129197, 1), new Range32.ptr(129280, 129291, 1), new Range32.ptr(129296, 129342, 1), new Range32.ptr(129344, 129356, 1), new Range32.ptr(129360, 129387, 1), new Range32.ptr(129408, 129431, 1), new Range32.ptr(129472, 129488, 16), new Range32.ptr(129489, 129510, 1)]), 2);
|
|
_Z = new RangeTable.ptr(new sliceType([new Range16.ptr(32, 160, 128), new Range16.ptr(5760, 8192, 2432), new Range16.ptr(8193, 8202, 1), new Range16.ptr(8232, 8233, 1), new Range16.ptr(8239, 8287, 48), new Range16.ptr(12288, 12288, 1)]), sliceType$1.nil, 1);
|
|
_Zl = new RangeTable.ptr(new sliceType([new Range16.ptr(8232, 8232, 1)]), sliceType$1.nil, 0);
|
|
_Zp = new RangeTable.ptr(new sliceType([new Range16.ptr(8233, 8233, 1)]), sliceType$1.nil, 0);
|
|
_Zs = new RangeTable.ptr(new sliceType([new Range16.ptr(32, 160, 128), new Range16.ptr(5760, 8192, 2432), new Range16.ptr(8193, 8202, 1), new Range16.ptr(8239, 8287, 48), new Range16.ptr(12288, 12288, 1)]), sliceType$1.nil, 1);
|
|
$pkg.Cc = _Cc;
|
|
$pkg.Cf = _Cf;
|
|
$pkg.Co = _Co;
|
|
$pkg.Cs = _Cs;
|
|
$pkg.Digit = _Nd;
|
|
$pkg.Nd = _Nd;
|
|
$pkg.Letter = _L;
|
|
$pkg.L = _L;
|
|
$pkg.Lm = _Lm;
|
|
$pkg.Lo = _Lo;
|
|
$pkg.Ll = _Ll;
|
|
$pkg.M = _M;
|
|
$pkg.Mc = _Mc;
|
|
$pkg.Me = _Me;
|
|
$pkg.Mn = _Mn;
|
|
$pkg.Nl = _Nl;
|
|
$pkg.No = _No;
|
|
$pkg.N = _N;
|
|
$pkg.C = _C;
|
|
$pkg.Pc = _Pc;
|
|
$pkg.Pd = _Pd;
|
|
$pkg.Pe = _Pe;
|
|
$pkg.Pf = _Pf;
|
|
$pkg.Pi = _Pi;
|
|
$pkg.Po = _Po;
|
|
$pkg.Ps = _Ps;
|
|
$pkg.P = _P;
|
|
$pkg.Sc = _Sc;
|
|
$pkg.Sk = _Sk;
|
|
$pkg.Sm = _Sm;
|
|
$pkg.So = _So;
|
|
$pkg.Z = _Z;
|
|
$pkg.S = _S;
|
|
$pkg.PrintRanges = new sliceType$2([$pkg.L, $pkg.M, $pkg.N, $pkg.P, $pkg.S]);
|
|
$pkg.Lt = _Lt;
|
|
$pkg.Lu = _Lu;
|
|
$pkg.Zl = _Zl;
|
|
$pkg.Zp = _Zp;
|
|
$pkg.Zs = _Zs;
|
|
$pkg.Categories = $makeMap($String.keyFor, [{ k: "C", v: $pkg.C }, { k: "Cc", v: $pkg.Cc }, { k: "Cf", v: $pkg.Cf }, { k: "Co", v: $pkg.Co }, { k: "Cs", v: $pkg.Cs }, { k: "L", v: $pkg.L }, { k: "Ll", v: $pkg.Ll }, { k: "Lm", v: $pkg.Lm }, { k: "Lo", v: $pkg.Lo }, { k: "Lt", v: $pkg.Lt }, { k: "Lu", v: $pkg.Lu }, { k: "M", v: $pkg.M }, { k: "Mc", v: $pkg.Mc }, { k: "Me", v: $pkg.Me }, { k: "Mn", v: $pkg.Mn }, { k: "N", v: $pkg.N }, { k: "Nd", v: $pkg.Nd }, { k: "Nl", v: $pkg.Nl }, { k: "No", v: $pkg.No }, { k: "P", v: $pkg.P }, { k: "Pc", v: $pkg.Pc }, { k: "Pd", v: $pkg.Pd }, { k: "Pe", v: $pkg.Pe }, { k: "Pf", v: $pkg.Pf }, { k: "Pi", v: $pkg.Pi }, { k: "Po", v: $pkg.Po }, { k: "Ps", v: $pkg.Ps }, { k: "S", v: $pkg.S }, { k: "Sc", v: $pkg.Sc }, { k: "Sk", v: $pkg.Sk }, { k: "Sm", v: $pkg.Sm }, { k: "So", v: $pkg.So }, { k: "Z", v: $pkg.Z }, { k: "Zl", v: $pkg.Zl }, { k: "Zp", v: $pkg.Zp }, { k: "Zs", v: $pkg.Zs }]);
|
|
_Adlam = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(125184, 125258, 1), new Range32.ptr(125264, 125273, 1), new Range32.ptr(125278, 125279, 1)]), 0);
|
|
_Ahom = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(71424, 71449, 1), new Range32.ptr(71453, 71467, 1), new Range32.ptr(71472, 71487, 1)]), 0);
|
|
_Anatolian_Hieroglyphs = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(82944, 83526, 1)]), 0);
|
|
_Arabic = new RangeTable.ptr(new sliceType([new Range16.ptr(1536, 1540, 1), new Range16.ptr(1542, 1547, 1), new Range16.ptr(1549, 1562, 1), new Range16.ptr(1564, 1564, 1), new Range16.ptr(1566, 1566, 1), new Range16.ptr(1568, 1599, 1), new Range16.ptr(1601, 1610, 1), new Range16.ptr(1622, 1647, 1), new Range16.ptr(1649, 1756, 1), new Range16.ptr(1758, 1791, 1), new Range16.ptr(1872, 1919, 1), new Range16.ptr(2208, 2228, 1), new Range16.ptr(2230, 2237, 1), new Range16.ptr(2260, 2273, 1), new Range16.ptr(2275, 2303, 1), new Range16.ptr(64336, 64449, 1), new Range16.ptr(64467, 64829, 1), new Range16.ptr(64848, 64911, 1), new Range16.ptr(64914, 64967, 1), new Range16.ptr(65008, 65021, 1), new Range16.ptr(65136, 65140, 1), new Range16.ptr(65142, 65276, 1)]), new sliceType$1([new Range32.ptr(69216, 69246, 1), new Range32.ptr(126464, 126467, 1), new Range32.ptr(126469, 126495, 1), new Range32.ptr(126497, 126498, 1), new Range32.ptr(126500, 126500, 1), new Range32.ptr(126503, 126503, 1), new Range32.ptr(126505, 126514, 1), new Range32.ptr(126516, 126519, 1), new Range32.ptr(126521, 126521, 1), new Range32.ptr(126523, 126523, 1), new Range32.ptr(126530, 126530, 1), new Range32.ptr(126535, 126535, 1), new Range32.ptr(126537, 126537, 1), new Range32.ptr(126539, 126539, 1), new Range32.ptr(126541, 126543, 1), new Range32.ptr(126545, 126546, 1), new Range32.ptr(126548, 126548, 1), new Range32.ptr(126551, 126551, 1), new Range32.ptr(126553, 126553, 1), new Range32.ptr(126555, 126555, 1), new Range32.ptr(126557, 126557, 1), new Range32.ptr(126559, 126559, 1), new Range32.ptr(126561, 126562, 1), new Range32.ptr(126564, 126564, 1), new Range32.ptr(126567, 126570, 1), new Range32.ptr(126572, 126578, 1), new Range32.ptr(126580, 126583, 1), new Range32.ptr(126585, 126588, 1), new Range32.ptr(126590, 126590, 1), new Range32.ptr(126592, 126601, 1), new Range32.ptr(126603, 126619, 1), new Range32.ptr(126625, 126627, 1), new Range32.ptr(126629, 126633, 1), new Range32.ptr(126635, 126651, 1), new Range32.ptr(126704, 126705, 1)]), 0);
|
|
_Armenian = new RangeTable.ptr(new sliceType([new Range16.ptr(1329, 1366, 1), new Range16.ptr(1369, 1375, 1), new Range16.ptr(1377, 1415, 1), new Range16.ptr(1418, 1418, 1), new Range16.ptr(1421, 1423, 1), new Range16.ptr(64275, 64279, 1)]), sliceType$1.nil, 0);
|
|
_Avestan = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68352, 68405, 1), new Range32.ptr(68409, 68415, 1)]), 0);
|
|
_Balinese = new RangeTable.ptr(new sliceType([new Range16.ptr(6912, 6987, 1), new Range16.ptr(6992, 7036, 1)]), sliceType$1.nil, 0);
|
|
_Bamum = new RangeTable.ptr(new sliceType([new Range16.ptr(42656, 42743, 1)]), new sliceType$1([new Range32.ptr(92160, 92728, 1)]), 0);
|
|
_Bassa_Vah = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(92880, 92909, 1), new Range32.ptr(92912, 92917, 1)]), 0);
|
|
_Batak = new RangeTable.ptr(new sliceType([new Range16.ptr(7104, 7155, 1), new Range16.ptr(7164, 7167, 1)]), sliceType$1.nil, 0);
|
|
_Bengali = new RangeTable.ptr(new sliceType([new Range16.ptr(2432, 2435, 1), new Range16.ptr(2437, 2444, 1), new Range16.ptr(2447, 2448, 1), new Range16.ptr(2451, 2472, 1), new Range16.ptr(2474, 2480, 1), new Range16.ptr(2482, 2482, 1), new Range16.ptr(2486, 2489, 1), new Range16.ptr(2492, 2500, 1), new Range16.ptr(2503, 2504, 1), new Range16.ptr(2507, 2510, 1), new Range16.ptr(2519, 2519, 1), new Range16.ptr(2524, 2525, 1), new Range16.ptr(2527, 2531, 1), new Range16.ptr(2534, 2557, 1)]), sliceType$1.nil, 0);
|
|
_Bhaiksuki = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72704, 72712, 1), new Range32.ptr(72714, 72758, 1), new Range32.ptr(72760, 72773, 1), new Range32.ptr(72784, 72812, 1)]), 0);
|
|
_Bopomofo = new RangeTable.ptr(new sliceType([new Range16.ptr(746, 747, 1), new Range16.ptr(12549, 12590, 1), new Range16.ptr(12704, 12730, 1)]), sliceType$1.nil, 0);
|
|
_Brahmi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(69632, 69709, 1), new Range32.ptr(69714, 69743, 1), new Range32.ptr(69759, 69759, 1)]), 0);
|
|
_Braille = new RangeTable.ptr(new sliceType([new Range16.ptr(10240, 10495, 1)]), sliceType$1.nil, 0);
|
|
_Buginese = new RangeTable.ptr(new sliceType([new Range16.ptr(6656, 6683, 1), new Range16.ptr(6686, 6687, 1)]), sliceType$1.nil, 0);
|
|
_Buhid = new RangeTable.ptr(new sliceType([new Range16.ptr(5952, 5971, 1)]), sliceType$1.nil, 0);
|
|
_Canadian_Aboriginal = new RangeTable.ptr(new sliceType([new Range16.ptr(5120, 5759, 1), new Range16.ptr(6320, 6389, 1)]), sliceType$1.nil, 0);
|
|
_Carian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66208, 66256, 1)]), 0);
|
|
_Caucasian_Albanian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66864, 66915, 1), new Range32.ptr(66927, 66927, 1)]), 0);
|
|
_Chakma = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(69888, 69940, 1), new Range32.ptr(69942, 69955, 1)]), 0);
|
|
_Cham = new RangeTable.ptr(new sliceType([new Range16.ptr(43520, 43574, 1), new Range16.ptr(43584, 43597, 1), new Range16.ptr(43600, 43609, 1), new Range16.ptr(43612, 43615, 1)]), sliceType$1.nil, 0);
|
|
_Cherokee = new RangeTable.ptr(new sliceType([new Range16.ptr(5024, 5109, 1), new Range16.ptr(5112, 5117, 1), new Range16.ptr(43888, 43967, 1)]), sliceType$1.nil, 0);
|
|
_Common = new RangeTable.ptr(new sliceType([new Range16.ptr(0, 64, 1), new Range16.ptr(91, 96, 1), new Range16.ptr(123, 169, 1), new Range16.ptr(171, 185, 1), new Range16.ptr(187, 191, 1), new Range16.ptr(215, 215, 1), new Range16.ptr(247, 247, 1), new Range16.ptr(697, 735, 1), new Range16.ptr(741, 745, 1), new Range16.ptr(748, 767, 1), new Range16.ptr(884, 884, 1), new Range16.ptr(894, 894, 1), new Range16.ptr(901, 901, 1), new Range16.ptr(903, 903, 1), new Range16.ptr(1417, 1417, 1), new Range16.ptr(1541, 1541, 1), new Range16.ptr(1548, 1548, 1), new Range16.ptr(1563, 1563, 1), new Range16.ptr(1567, 1567, 1), new Range16.ptr(1600, 1600, 1), new Range16.ptr(1757, 1757, 1), new Range16.ptr(2274, 2274, 1), new Range16.ptr(2404, 2405, 1), new Range16.ptr(3647, 3647, 1), new Range16.ptr(4053, 4056, 1), new Range16.ptr(4347, 4347, 1), new Range16.ptr(5867, 5869, 1), new Range16.ptr(5941, 5942, 1), new Range16.ptr(6146, 6147, 1), new Range16.ptr(6149, 6149, 1), new Range16.ptr(7379, 7379, 1), new Range16.ptr(7393, 7393, 1), new Range16.ptr(7401, 7404, 1), new Range16.ptr(7406, 7411, 1), new Range16.ptr(7413, 7415, 1), new Range16.ptr(8192, 8203, 1), new Range16.ptr(8206, 8292, 1), new Range16.ptr(8294, 8304, 1), new Range16.ptr(8308, 8318, 1), new Range16.ptr(8320, 8334, 1), new Range16.ptr(8352, 8383, 1), new Range16.ptr(8448, 8485, 1), new Range16.ptr(8487, 8489, 1), new Range16.ptr(8492, 8497, 1), new Range16.ptr(8499, 8525, 1), new Range16.ptr(8527, 8543, 1), new Range16.ptr(8585, 8587, 1), new Range16.ptr(8592, 9254, 1), new Range16.ptr(9280, 9290, 1), new Range16.ptr(9312, 10239, 1), new Range16.ptr(10496, 11123, 1), new Range16.ptr(11126, 11157, 1), new Range16.ptr(11160, 11193, 1), new Range16.ptr(11197, 11208, 1), new Range16.ptr(11210, 11218, 1), new Range16.ptr(11244, 11247, 1), new Range16.ptr(11776, 11849, 1), new Range16.ptr(12272, 12283, 1), new Range16.ptr(12288, 12292, 1), new Range16.ptr(12294, 12294, 1), new Range16.ptr(12296, 12320, 1), new Range16.ptr(12336, 12343, 1), new Range16.ptr(12348, 12351, 1), new Range16.ptr(12443, 12444, 1), new Range16.ptr(12448, 12448, 1), new Range16.ptr(12539, 12540, 1), new Range16.ptr(12688, 12703, 1), new Range16.ptr(12736, 12771, 1), new Range16.ptr(12832, 12895, 1), new Range16.ptr(12927, 13007, 1), new Range16.ptr(13144, 13311, 1), new Range16.ptr(19904, 19967, 1), new Range16.ptr(42752, 42785, 1), new Range16.ptr(42888, 42890, 1), new Range16.ptr(43056, 43065, 1), new Range16.ptr(43310, 43310, 1), new Range16.ptr(43471, 43471, 1), new Range16.ptr(43867, 43867, 1), new Range16.ptr(64830, 64831, 1), new Range16.ptr(65040, 65049, 1), new Range16.ptr(65072, 65106, 1), new Range16.ptr(65108, 65126, 1), new Range16.ptr(65128, 65131, 1), new Range16.ptr(65279, 65279, 1), new Range16.ptr(65281, 65312, 1), new Range16.ptr(65339, 65344, 1), new Range16.ptr(65371, 65381, 1), new Range16.ptr(65392, 65392, 1), new Range16.ptr(65438, 65439, 1), new Range16.ptr(65504, 65510, 1), new Range16.ptr(65512, 65518, 1), new Range16.ptr(65529, 65533, 1)]), new sliceType$1([new Range32.ptr(65792, 65794, 1), new Range32.ptr(65799, 65843, 1), new Range32.ptr(65847, 65855, 1), new Range32.ptr(65936, 65947, 1), new Range32.ptr(66000, 66044, 1), new Range32.ptr(66273, 66299, 1), new Range32.ptr(113824, 113827, 1), new Range32.ptr(118784, 119029, 1), new Range32.ptr(119040, 119078, 1), new Range32.ptr(119081, 119142, 1), new Range32.ptr(119146, 119162, 1), new Range32.ptr(119171, 119172, 1), new Range32.ptr(119180, 119209, 1), new Range32.ptr(119214, 119272, 1), new Range32.ptr(119552, 119638, 1), new Range32.ptr(119648, 119665, 1), new Range32.ptr(119808, 119892, 1), new Range32.ptr(119894, 119964, 1), new Range32.ptr(119966, 119967, 1), new Range32.ptr(119970, 119970, 1), new Range32.ptr(119973, 119974, 1), new Range32.ptr(119977, 119980, 1), new Range32.ptr(119982, 119993, 1), new Range32.ptr(119995, 119995, 1), new Range32.ptr(119997, 120003, 1), new Range32.ptr(120005, 120069, 1), new Range32.ptr(120071, 120074, 1), new Range32.ptr(120077, 120084, 1), new Range32.ptr(120086, 120092, 1), new Range32.ptr(120094, 120121, 1), new Range32.ptr(120123, 120126, 1), new Range32.ptr(120128, 120132, 1), new Range32.ptr(120134, 120134, 1), new Range32.ptr(120138, 120144, 1), new Range32.ptr(120146, 120485, 1), new Range32.ptr(120488, 120779, 1), new Range32.ptr(120782, 120831, 1), new Range32.ptr(126976, 127019, 1), new Range32.ptr(127024, 127123, 1), new Range32.ptr(127136, 127150, 1), new Range32.ptr(127153, 127167, 1), new Range32.ptr(127169, 127183, 1), new Range32.ptr(127185, 127221, 1), new Range32.ptr(127232, 127244, 1), new Range32.ptr(127248, 127278, 1), new Range32.ptr(127280, 127339, 1), new Range32.ptr(127344, 127404, 1), new Range32.ptr(127462, 127487, 1), new Range32.ptr(127489, 127490, 1), new Range32.ptr(127504, 127547, 1), new Range32.ptr(127552, 127560, 1), new Range32.ptr(127568, 127569, 1), new Range32.ptr(127584, 127589, 1), new Range32.ptr(127744, 128724, 1), new Range32.ptr(128736, 128748, 1), new Range32.ptr(128752, 128760, 1), new Range32.ptr(128768, 128883, 1), new Range32.ptr(128896, 128980, 1), new Range32.ptr(129024, 129035, 1), new Range32.ptr(129040, 129095, 1), new Range32.ptr(129104, 129113, 1), new Range32.ptr(129120, 129159, 1), new Range32.ptr(129168, 129197, 1), new Range32.ptr(129280, 129291, 1), new Range32.ptr(129296, 129342, 1), new Range32.ptr(129344, 129356, 1), new Range32.ptr(129360, 129387, 1), new Range32.ptr(129408, 129431, 1), new Range32.ptr(129472, 129472, 1), new Range32.ptr(129488, 129510, 1), new Range32.ptr(917505, 917505, 1), new Range32.ptr(917536, 917631, 1)]), 7);
|
|
_Coptic = new RangeTable.ptr(new sliceType([new Range16.ptr(994, 1007, 1), new Range16.ptr(11392, 11507, 1), new Range16.ptr(11513, 11519, 1)]), sliceType$1.nil, 0);
|
|
_Cuneiform = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(73728, 74649, 1), new Range32.ptr(74752, 74862, 1), new Range32.ptr(74864, 74868, 1), new Range32.ptr(74880, 75075, 1)]), 0);
|
|
_Cypriot = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67584, 67589, 1), new Range32.ptr(67592, 67592, 1), new Range32.ptr(67594, 67637, 1), new Range32.ptr(67639, 67640, 1), new Range32.ptr(67644, 67644, 1), new Range32.ptr(67647, 67647, 1)]), 0);
|
|
_Cyrillic = new RangeTable.ptr(new sliceType([new Range16.ptr(1024, 1156, 1), new Range16.ptr(1159, 1327, 1), new Range16.ptr(7296, 7304, 1), new Range16.ptr(7467, 7467, 1), new Range16.ptr(7544, 7544, 1), new Range16.ptr(11744, 11775, 1), new Range16.ptr(42560, 42655, 1), new Range16.ptr(65070, 65071, 1)]), sliceType$1.nil, 0);
|
|
_Deseret = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66560, 66639, 1)]), 0);
|
|
_Devanagari = new RangeTable.ptr(new sliceType([new Range16.ptr(2304, 2384, 1), new Range16.ptr(2387, 2403, 1), new Range16.ptr(2406, 2431, 1), new Range16.ptr(43232, 43261, 1)]), sliceType$1.nil, 0);
|
|
_Duployan = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(113664, 113770, 1), new Range32.ptr(113776, 113788, 1), new Range32.ptr(113792, 113800, 1), new Range32.ptr(113808, 113817, 1), new Range32.ptr(113820, 113823, 1)]), 0);
|
|
_Egyptian_Hieroglyphs = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(77824, 78894, 1)]), 0);
|
|
_Elbasan = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66816, 66855, 1)]), 0);
|
|
_Ethiopic = new RangeTable.ptr(new sliceType([new Range16.ptr(4608, 4680, 1), new Range16.ptr(4682, 4685, 1), new Range16.ptr(4688, 4694, 1), new Range16.ptr(4696, 4696, 1), new Range16.ptr(4698, 4701, 1), new Range16.ptr(4704, 4744, 1), new Range16.ptr(4746, 4749, 1), new Range16.ptr(4752, 4784, 1), new Range16.ptr(4786, 4789, 1), new Range16.ptr(4792, 4798, 1), new Range16.ptr(4800, 4800, 1), new Range16.ptr(4802, 4805, 1), new Range16.ptr(4808, 4822, 1), new Range16.ptr(4824, 4880, 1), new Range16.ptr(4882, 4885, 1), new Range16.ptr(4888, 4954, 1), new Range16.ptr(4957, 4988, 1), new Range16.ptr(4992, 5017, 1), new Range16.ptr(11648, 11670, 1), new Range16.ptr(11680, 11686, 1), new Range16.ptr(11688, 11694, 1), new Range16.ptr(11696, 11702, 1), new Range16.ptr(11704, 11710, 1), new Range16.ptr(11712, 11718, 1), new Range16.ptr(11720, 11726, 1), new Range16.ptr(11728, 11734, 1), new Range16.ptr(11736, 11742, 1), new Range16.ptr(43777, 43782, 1), new Range16.ptr(43785, 43790, 1), new Range16.ptr(43793, 43798, 1), new Range16.ptr(43808, 43814, 1), new Range16.ptr(43816, 43822, 1)]), sliceType$1.nil, 0);
|
|
_Georgian = new RangeTable.ptr(new sliceType([new Range16.ptr(4256, 4293, 1), new Range16.ptr(4295, 4295, 1), new Range16.ptr(4301, 4301, 1), new Range16.ptr(4304, 4346, 1), new Range16.ptr(4348, 4351, 1), new Range16.ptr(11520, 11557, 1), new Range16.ptr(11559, 11559, 1), new Range16.ptr(11565, 11565, 1)]), sliceType$1.nil, 0);
|
|
_Glagolitic = new RangeTable.ptr(new sliceType([new Range16.ptr(11264, 11310, 1), new Range16.ptr(11312, 11358, 1)]), new sliceType$1([new Range32.ptr(122880, 122886, 1), new Range32.ptr(122888, 122904, 1), new Range32.ptr(122907, 122913, 1), new Range32.ptr(122915, 122916, 1), new Range32.ptr(122918, 122922, 1)]), 0);
|
|
_Gothic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66352, 66378, 1)]), 0);
|
|
_Grantha = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70400, 70403, 1), new Range32.ptr(70405, 70412, 1), new Range32.ptr(70415, 70416, 1), new Range32.ptr(70419, 70440, 1), new Range32.ptr(70442, 70448, 1), new Range32.ptr(70450, 70451, 1), new Range32.ptr(70453, 70457, 1), new Range32.ptr(70460, 70468, 1), new Range32.ptr(70471, 70472, 1), new Range32.ptr(70475, 70477, 1), new Range32.ptr(70480, 70480, 1), new Range32.ptr(70487, 70487, 1), new Range32.ptr(70493, 70499, 1), new Range32.ptr(70502, 70508, 1), new Range32.ptr(70512, 70516, 1)]), 0);
|
|
_Greek = new RangeTable.ptr(new sliceType([new Range16.ptr(880, 883, 1), new Range16.ptr(885, 887, 1), new Range16.ptr(890, 893, 1), new Range16.ptr(895, 895, 1), new Range16.ptr(900, 900, 1), new Range16.ptr(902, 902, 1), new Range16.ptr(904, 906, 1), new Range16.ptr(908, 908, 1), new Range16.ptr(910, 929, 1), new Range16.ptr(931, 993, 1), new Range16.ptr(1008, 1023, 1), new Range16.ptr(7462, 7466, 1), new Range16.ptr(7517, 7521, 1), new Range16.ptr(7526, 7530, 1), new Range16.ptr(7615, 7615, 1), new Range16.ptr(7936, 7957, 1), new Range16.ptr(7960, 7965, 1), new Range16.ptr(7968, 8005, 1), new Range16.ptr(8008, 8013, 1), new Range16.ptr(8016, 8023, 1), new Range16.ptr(8025, 8025, 1), new Range16.ptr(8027, 8027, 1), new Range16.ptr(8029, 8029, 1), new Range16.ptr(8031, 8061, 1), new Range16.ptr(8064, 8116, 1), new Range16.ptr(8118, 8132, 1), new Range16.ptr(8134, 8147, 1), new Range16.ptr(8150, 8155, 1), new Range16.ptr(8157, 8175, 1), new Range16.ptr(8178, 8180, 1), new Range16.ptr(8182, 8190, 1), new Range16.ptr(8486, 8486, 1), new Range16.ptr(43877, 43877, 1)]), new sliceType$1([new Range32.ptr(65856, 65934, 1), new Range32.ptr(65952, 65952, 1), new Range32.ptr(119296, 119365, 1)]), 0);
|
|
_Gujarati = new RangeTable.ptr(new sliceType([new Range16.ptr(2689, 2691, 1), new Range16.ptr(2693, 2701, 1), new Range16.ptr(2703, 2705, 1), new Range16.ptr(2707, 2728, 1), new Range16.ptr(2730, 2736, 1), new Range16.ptr(2738, 2739, 1), new Range16.ptr(2741, 2745, 1), new Range16.ptr(2748, 2757, 1), new Range16.ptr(2759, 2761, 1), new Range16.ptr(2763, 2765, 1), new Range16.ptr(2768, 2768, 1), new Range16.ptr(2784, 2787, 1), new Range16.ptr(2790, 2801, 1), new Range16.ptr(2809, 2815, 1)]), sliceType$1.nil, 0);
|
|
_Gurmukhi = new RangeTable.ptr(new sliceType([new Range16.ptr(2561, 2563, 1), new Range16.ptr(2565, 2570, 1), new Range16.ptr(2575, 2576, 1), new Range16.ptr(2579, 2600, 1), new Range16.ptr(2602, 2608, 1), new Range16.ptr(2610, 2611, 1), new Range16.ptr(2613, 2614, 1), new Range16.ptr(2616, 2617, 1), new Range16.ptr(2620, 2620, 1), new Range16.ptr(2622, 2626, 1), new Range16.ptr(2631, 2632, 1), new Range16.ptr(2635, 2637, 1), new Range16.ptr(2641, 2641, 1), new Range16.ptr(2649, 2652, 1), new Range16.ptr(2654, 2654, 1), new Range16.ptr(2662, 2677, 1)]), sliceType$1.nil, 0);
|
|
_Han = new RangeTable.ptr(new sliceType([new Range16.ptr(11904, 11929, 1), new Range16.ptr(11931, 12019, 1), new Range16.ptr(12032, 12245, 1), new Range16.ptr(12293, 12293, 1), new Range16.ptr(12295, 12295, 1), new Range16.ptr(12321, 12329, 1), new Range16.ptr(12344, 12347, 1), new Range16.ptr(13312, 19893, 1), new Range16.ptr(19968, 40938, 1), new Range16.ptr(63744, 64109, 1), new Range16.ptr(64112, 64217, 1)]), new sliceType$1([new Range32.ptr(131072, 173782, 1), new Range32.ptr(173824, 177972, 1), new Range32.ptr(177984, 178205, 1), new Range32.ptr(178208, 183969, 1), new Range32.ptr(183984, 191456, 1), new Range32.ptr(194560, 195101, 1)]), 0);
|
|
_Hangul = new RangeTable.ptr(new sliceType([new Range16.ptr(4352, 4607, 1), new Range16.ptr(12334, 12335, 1), new Range16.ptr(12593, 12686, 1), new Range16.ptr(12800, 12830, 1), new Range16.ptr(12896, 12926, 1), new Range16.ptr(43360, 43388, 1), new Range16.ptr(44032, 55203, 1), new Range16.ptr(55216, 55238, 1), new Range16.ptr(55243, 55291, 1), new Range16.ptr(65440, 65470, 1), new Range16.ptr(65474, 65479, 1), new Range16.ptr(65482, 65487, 1), new Range16.ptr(65490, 65495, 1), new Range16.ptr(65498, 65500, 1)]), sliceType$1.nil, 0);
|
|
_Hanunoo = new RangeTable.ptr(new sliceType([new Range16.ptr(5920, 5940, 1)]), sliceType$1.nil, 0);
|
|
_Hatran = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67808, 67826, 1), new Range32.ptr(67828, 67829, 1), new Range32.ptr(67835, 67839, 1)]), 0);
|
|
_Hebrew = new RangeTable.ptr(new sliceType([new Range16.ptr(1425, 1479, 1), new Range16.ptr(1488, 1514, 1), new Range16.ptr(1520, 1524, 1), new Range16.ptr(64285, 64310, 1), new Range16.ptr(64312, 64316, 1), new Range16.ptr(64318, 64318, 1), new Range16.ptr(64320, 64321, 1), new Range16.ptr(64323, 64324, 1), new Range16.ptr(64326, 64335, 1)]), sliceType$1.nil, 0);
|
|
_Hiragana = new RangeTable.ptr(new sliceType([new Range16.ptr(12353, 12438, 1), new Range16.ptr(12445, 12447, 1)]), new sliceType$1([new Range32.ptr(110593, 110878, 1), new Range32.ptr(127488, 127488, 1)]), 0);
|
|
_Imperial_Aramaic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67648, 67669, 1), new Range32.ptr(67671, 67679, 1)]), 0);
|
|
_Inherited = new RangeTable.ptr(new sliceType([new Range16.ptr(768, 879, 1), new Range16.ptr(1157, 1158, 1), new Range16.ptr(1611, 1621, 1), new Range16.ptr(1648, 1648, 1), new Range16.ptr(2385, 2386, 1), new Range16.ptr(6832, 6846, 1), new Range16.ptr(7376, 7378, 1), new Range16.ptr(7380, 7392, 1), new Range16.ptr(7394, 7400, 1), new Range16.ptr(7405, 7405, 1), new Range16.ptr(7412, 7412, 1), new Range16.ptr(7416, 7417, 1), new Range16.ptr(7616, 7673, 1), new Range16.ptr(7675, 7679, 1), new Range16.ptr(8204, 8205, 1), new Range16.ptr(8400, 8432, 1), new Range16.ptr(12330, 12333, 1), new Range16.ptr(12441, 12442, 1), new Range16.ptr(65024, 65039, 1), new Range16.ptr(65056, 65069, 1)]), new sliceType$1([new Range32.ptr(66045, 66045, 1), new Range32.ptr(66272, 66272, 1), new Range32.ptr(119143, 119145, 1), new Range32.ptr(119163, 119170, 1), new Range32.ptr(119173, 119179, 1), new Range32.ptr(119210, 119213, 1), new Range32.ptr(917760, 917999, 1)]), 0);
|
|
_Inscriptional_Pahlavi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68448, 68466, 1), new Range32.ptr(68472, 68479, 1)]), 0);
|
|
_Inscriptional_Parthian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68416, 68437, 1), new Range32.ptr(68440, 68447, 1)]), 0);
|
|
_Javanese = new RangeTable.ptr(new sliceType([new Range16.ptr(43392, 43469, 1), new Range16.ptr(43472, 43481, 1), new Range16.ptr(43486, 43487, 1)]), sliceType$1.nil, 0);
|
|
_Kaithi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(69760, 69825, 1)]), 0);
|
|
_Kannada = new RangeTable.ptr(new sliceType([new Range16.ptr(3200, 3203, 1), new Range16.ptr(3205, 3212, 1), new Range16.ptr(3214, 3216, 1), new Range16.ptr(3218, 3240, 1), new Range16.ptr(3242, 3251, 1), new Range16.ptr(3253, 3257, 1), new Range16.ptr(3260, 3268, 1), new Range16.ptr(3270, 3272, 1), new Range16.ptr(3274, 3277, 1), new Range16.ptr(3285, 3286, 1), new Range16.ptr(3294, 3294, 1), new Range16.ptr(3296, 3299, 1), new Range16.ptr(3302, 3311, 1), new Range16.ptr(3313, 3314, 1)]), sliceType$1.nil, 0);
|
|
_Katakana = new RangeTable.ptr(new sliceType([new Range16.ptr(12449, 12538, 1), new Range16.ptr(12541, 12543, 1), new Range16.ptr(12784, 12799, 1), new Range16.ptr(13008, 13054, 1), new Range16.ptr(13056, 13143, 1), new Range16.ptr(65382, 65391, 1), new Range16.ptr(65393, 65437, 1)]), new sliceType$1([new Range32.ptr(110592, 110592, 1)]), 0);
|
|
_Kayah_Li = new RangeTable.ptr(new sliceType([new Range16.ptr(43264, 43309, 1), new Range16.ptr(43311, 43311, 1)]), sliceType$1.nil, 0);
|
|
_Kharoshthi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68096, 68099, 1), new Range32.ptr(68101, 68102, 1), new Range32.ptr(68108, 68115, 1), new Range32.ptr(68117, 68119, 1), new Range32.ptr(68121, 68147, 1), new Range32.ptr(68152, 68154, 1), new Range32.ptr(68159, 68167, 1), new Range32.ptr(68176, 68184, 1)]), 0);
|
|
_Khmer = new RangeTable.ptr(new sliceType([new Range16.ptr(6016, 6109, 1), new Range16.ptr(6112, 6121, 1), new Range16.ptr(6128, 6137, 1), new Range16.ptr(6624, 6655, 1)]), sliceType$1.nil, 0);
|
|
_Khojki = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70144, 70161, 1), new Range32.ptr(70163, 70206, 1)]), 0);
|
|
_Khudawadi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70320, 70378, 1), new Range32.ptr(70384, 70393, 1)]), 0);
|
|
_Lao = new RangeTable.ptr(new sliceType([new Range16.ptr(3713, 3714, 1), new Range16.ptr(3716, 3716, 1), new Range16.ptr(3719, 3720, 1), new Range16.ptr(3722, 3722, 1), new Range16.ptr(3725, 3725, 1), new Range16.ptr(3732, 3735, 1), new Range16.ptr(3737, 3743, 1), new Range16.ptr(3745, 3747, 1), new Range16.ptr(3749, 3749, 1), new Range16.ptr(3751, 3751, 1), new Range16.ptr(3754, 3755, 1), new Range16.ptr(3757, 3769, 1), new Range16.ptr(3771, 3773, 1), new Range16.ptr(3776, 3780, 1), new Range16.ptr(3782, 3782, 1), new Range16.ptr(3784, 3789, 1), new Range16.ptr(3792, 3801, 1), new Range16.ptr(3804, 3807, 1)]), sliceType$1.nil, 0);
|
|
_Latin = new RangeTable.ptr(new sliceType([new Range16.ptr(65, 90, 1), new Range16.ptr(97, 122, 1), new Range16.ptr(170, 170, 1), new Range16.ptr(186, 186, 1), new Range16.ptr(192, 214, 1), new Range16.ptr(216, 246, 1), new Range16.ptr(248, 696, 1), new Range16.ptr(736, 740, 1), new Range16.ptr(7424, 7461, 1), new Range16.ptr(7468, 7516, 1), new Range16.ptr(7522, 7525, 1), new Range16.ptr(7531, 7543, 1), new Range16.ptr(7545, 7614, 1), new Range16.ptr(7680, 7935, 1), new Range16.ptr(8305, 8305, 1), new Range16.ptr(8319, 8319, 1), new Range16.ptr(8336, 8348, 1), new Range16.ptr(8490, 8491, 1), new Range16.ptr(8498, 8498, 1), new Range16.ptr(8526, 8526, 1), new Range16.ptr(8544, 8584, 1), new Range16.ptr(11360, 11391, 1), new Range16.ptr(42786, 42887, 1), new Range16.ptr(42891, 42926, 1), new Range16.ptr(42928, 42935, 1), new Range16.ptr(42999, 43007, 1), new Range16.ptr(43824, 43866, 1), new Range16.ptr(43868, 43876, 1), new Range16.ptr(64256, 64262, 1), new Range16.ptr(65313, 65338, 1), new Range16.ptr(65345, 65370, 1)]), sliceType$1.nil, 6);
|
|
_Lepcha = new RangeTable.ptr(new sliceType([new Range16.ptr(7168, 7223, 1), new Range16.ptr(7227, 7241, 1), new Range16.ptr(7245, 7247, 1)]), sliceType$1.nil, 0);
|
|
_Limbu = new RangeTable.ptr(new sliceType([new Range16.ptr(6400, 6430, 1), new Range16.ptr(6432, 6443, 1), new Range16.ptr(6448, 6459, 1), new Range16.ptr(6464, 6464, 1), new Range16.ptr(6468, 6479, 1)]), sliceType$1.nil, 0);
|
|
_Linear_A = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67072, 67382, 1), new Range32.ptr(67392, 67413, 1), new Range32.ptr(67424, 67431, 1)]), 0);
|
|
_Linear_B = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(65536, 65547, 1), new Range32.ptr(65549, 65574, 1), new Range32.ptr(65576, 65594, 1), new Range32.ptr(65596, 65597, 1), new Range32.ptr(65599, 65613, 1), new Range32.ptr(65616, 65629, 1), new Range32.ptr(65664, 65786, 1)]), 0);
|
|
_Lisu = new RangeTable.ptr(new sliceType([new Range16.ptr(42192, 42239, 1)]), sliceType$1.nil, 0);
|
|
_Lycian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66176, 66204, 1)]), 0);
|
|
_Lydian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67872, 67897, 1), new Range32.ptr(67903, 67903, 1)]), 0);
|
|
_Mahajani = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(69968, 70006, 1)]), 0);
|
|
_Malayalam = new RangeTable.ptr(new sliceType([new Range16.ptr(3328, 3331, 1), new Range16.ptr(3333, 3340, 1), new Range16.ptr(3342, 3344, 1), new Range16.ptr(3346, 3396, 1), new Range16.ptr(3398, 3400, 1), new Range16.ptr(3402, 3407, 1), new Range16.ptr(3412, 3427, 1), new Range16.ptr(3430, 3455, 1)]), sliceType$1.nil, 0);
|
|
_Mandaic = new RangeTable.ptr(new sliceType([new Range16.ptr(2112, 2139, 1), new Range16.ptr(2142, 2142, 1)]), sliceType$1.nil, 0);
|
|
_Manichaean = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68288, 68326, 1), new Range32.ptr(68331, 68342, 1)]), 0);
|
|
_Marchen = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72816, 72847, 1), new Range32.ptr(72850, 72871, 1), new Range32.ptr(72873, 72886, 1)]), 0);
|
|
_Masaram_Gondi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72960, 72966, 1), new Range32.ptr(72968, 72969, 1), new Range32.ptr(72971, 73014, 1), new Range32.ptr(73018, 73018, 1), new Range32.ptr(73020, 73021, 1), new Range32.ptr(73023, 73031, 1), new Range32.ptr(73040, 73049, 1)]), 0);
|
|
_Meetei_Mayek = new RangeTable.ptr(new sliceType([new Range16.ptr(43744, 43766, 1), new Range16.ptr(43968, 44013, 1), new Range16.ptr(44016, 44025, 1)]), sliceType$1.nil, 0);
|
|
_Mende_Kikakui = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(124928, 125124, 1), new Range32.ptr(125127, 125142, 1)]), 0);
|
|
_Meroitic_Cursive = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68000, 68023, 1), new Range32.ptr(68028, 68047, 1), new Range32.ptr(68050, 68095, 1)]), 0);
|
|
_Meroitic_Hieroglyphs = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67968, 67999, 1)]), 0);
|
|
_Miao = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(93952, 94020, 1), new Range32.ptr(94032, 94078, 1), new Range32.ptr(94095, 94111, 1)]), 0);
|
|
_Modi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(71168, 71236, 1), new Range32.ptr(71248, 71257, 1)]), 0);
|
|
_Mongolian = new RangeTable.ptr(new sliceType([new Range16.ptr(6144, 6145, 1), new Range16.ptr(6148, 6148, 1), new Range16.ptr(6150, 6158, 1), new Range16.ptr(6160, 6169, 1), new Range16.ptr(6176, 6263, 1), new Range16.ptr(6272, 6314, 1)]), new sliceType$1([new Range32.ptr(71264, 71276, 1)]), 0);
|
|
_Mro = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(92736, 92766, 1), new Range32.ptr(92768, 92777, 1), new Range32.ptr(92782, 92783, 1)]), 0);
|
|
_Multani = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70272, 70278, 1), new Range32.ptr(70280, 70280, 1), new Range32.ptr(70282, 70285, 1), new Range32.ptr(70287, 70301, 1), new Range32.ptr(70303, 70313, 1)]), 0);
|
|
_Myanmar = new RangeTable.ptr(new sliceType([new Range16.ptr(4096, 4255, 1), new Range16.ptr(43488, 43518, 1), new Range16.ptr(43616, 43647, 1)]), sliceType$1.nil, 0);
|
|
_Nabataean = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67712, 67742, 1), new Range32.ptr(67751, 67759, 1)]), 0);
|
|
_New_Tai_Lue = new RangeTable.ptr(new sliceType([new Range16.ptr(6528, 6571, 1), new Range16.ptr(6576, 6601, 1), new Range16.ptr(6608, 6618, 1), new Range16.ptr(6622, 6623, 1)]), sliceType$1.nil, 0);
|
|
_Newa = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70656, 70745, 1), new Range32.ptr(70747, 70747, 1), new Range32.ptr(70749, 70749, 1)]), 0);
|
|
_Nko = new RangeTable.ptr(new sliceType([new Range16.ptr(1984, 2042, 1)]), sliceType$1.nil, 0);
|
|
_Nushu = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(94177, 94177, 1), new Range32.ptr(110960, 111355, 1)]), 0);
|
|
_Ogham = new RangeTable.ptr(new sliceType([new Range16.ptr(5760, 5788, 1)]), sliceType$1.nil, 0);
|
|
_Ol_Chiki = new RangeTable.ptr(new sliceType([new Range16.ptr(7248, 7295, 1)]), sliceType$1.nil, 0);
|
|
_Old_Hungarian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68736, 68786, 1), new Range32.ptr(68800, 68850, 1), new Range32.ptr(68858, 68863, 1)]), 0);
|
|
_Old_Italic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66304, 66339, 1), new Range32.ptr(66349, 66351, 1)]), 0);
|
|
_Old_North_Arabian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68224, 68255, 1)]), 0);
|
|
_Old_Permic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66384, 66426, 1)]), 0);
|
|
_Old_Persian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66464, 66499, 1), new Range32.ptr(66504, 66517, 1)]), 0);
|
|
_Old_South_Arabian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68192, 68223, 1)]), 0);
|
|
_Old_Turkic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68608, 68680, 1)]), 0);
|
|
_Oriya = new RangeTable.ptr(new sliceType([new Range16.ptr(2817, 2819, 1), new Range16.ptr(2821, 2828, 1), new Range16.ptr(2831, 2832, 1), new Range16.ptr(2835, 2856, 1), new Range16.ptr(2858, 2864, 1), new Range16.ptr(2866, 2867, 1), new Range16.ptr(2869, 2873, 1), new Range16.ptr(2876, 2884, 1), new Range16.ptr(2887, 2888, 1), new Range16.ptr(2891, 2893, 1), new Range16.ptr(2902, 2903, 1), new Range16.ptr(2908, 2909, 1), new Range16.ptr(2911, 2915, 1), new Range16.ptr(2918, 2935, 1)]), sliceType$1.nil, 0);
|
|
_Osage = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66736, 66771, 1), new Range32.ptr(66776, 66811, 1)]), 0);
|
|
_Osmanya = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66688, 66717, 1), new Range32.ptr(66720, 66729, 1)]), 0);
|
|
_Pahawh_Hmong = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(92928, 92997, 1), new Range32.ptr(93008, 93017, 1), new Range32.ptr(93019, 93025, 1), new Range32.ptr(93027, 93047, 1), new Range32.ptr(93053, 93071, 1)]), 0);
|
|
_Palmyrene = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67680, 67711, 1)]), 0);
|
|
_Pau_Cin_Hau = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72384, 72440, 1)]), 0);
|
|
_Phags_Pa = new RangeTable.ptr(new sliceType([new Range16.ptr(43072, 43127, 1)]), sliceType$1.nil, 0);
|
|
_Phoenician = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(67840, 67867, 1), new Range32.ptr(67871, 67871, 1)]), 0);
|
|
_Psalter_Pahlavi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(68480, 68497, 1), new Range32.ptr(68505, 68508, 1), new Range32.ptr(68521, 68527, 1)]), 0);
|
|
_Rejang = new RangeTable.ptr(new sliceType([new Range16.ptr(43312, 43347, 1), new Range16.ptr(43359, 43359, 1)]), sliceType$1.nil, 0);
|
|
_Runic = new RangeTable.ptr(new sliceType([new Range16.ptr(5792, 5866, 1), new Range16.ptr(5870, 5880, 1)]), sliceType$1.nil, 0);
|
|
_Samaritan = new RangeTable.ptr(new sliceType([new Range16.ptr(2048, 2093, 1), new Range16.ptr(2096, 2110, 1)]), sliceType$1.nil, 0);
|
|
_Saurashtra = new RangeTable.ptr(new sliceType([new Range16.ptr(43136, 43205, 1), new Range16.ptr(43214, 43225, 1)]), sliceType$1.nil, 0);
|
|
_Sharada = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70016, 70093, 1), new Range32.ptr(70096, 70111, 1)]), 0);
|
|
_Shavian = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66640, 66687, 1)]), 0);
|
|
_Siddham = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(71040, 71093, 1), new Range32.ptr(71096, 71133, 1)]), 0);
|
|
_SignWriting = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(120832, 121483, 1), new Range32.ptr(121499, 121503, 1), new Range32.ptr(121505, 121519, 1)]), 0);
|
|
_Sinhala = new RangeTable.ptr(new sliceType([new Range16.ptr(3458, 3459, 1), new Range16.ptr(3461, 3478, 1), new Range16.ptr(3482, 3505, 1), new Range16.ptr(3507, 3515, 1), new Range16.ptr(3517, 3517, 1), new Range16.ptr(3520, 3526, 1), new Range16.ptr(3530, 3530, 1), new Range16.ptr(3535, 3540, 1), new Range16.ptr(3542, 3542, 1), new Range16.ptr(3544, 3551, 1), new Range16.ptr(3558, 3567, 1), new Range16.ptr(3570, 3572, 1)]), new sliceType$1([new Range32.ptr(70113, 70132, 1)]), 0);
|
|
_Sora_Sompeng = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(69840, 69864, 1), new Range32.ptr(69872, 69881, 1)]), 0);
|
|
_Soyombo = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72272, 72323, 1), new Range32.ptr(72326, 72348, 1), new Range32.ptr(72350, 72354, 1)]), 0);
|
|
_Sundanese = new RangeTable.ptr(new sliceType([new Range16.ptr(7040, 7103, 1), new Range16.ptr(7360, 7367, 1)]), sliceType$1.nil, 0);
|
|
_Syloti_Nagri = new RangeTable.ptr(new sliceType([new Range16.ptr(43008, 43051, 1)]), sliceType$1.nil, 0);
|
|
_Syriac = new RangeTable.ptr(new sliceType([new Range16.ptr(1792, 1805, 1), new Range16.ptr(1807, 1866, 1), new Range16.ptr(1869, 1871, 1), new Range16.ptr(2144, 2154, 1)]), sliceType$1.nil, 0);
|
|
_Tagalog = new RangeTable.ptr(new sliceType([new Range16.ptr(5888, 5900, 1), new Range16.ptr(5902, 5908, 1)]), sliceType$1.nil, 0);
|
|
_Tagbanwa = new RangeTable.ptr(new sliceType([new Range16.ptr(5984, 5996, 1), new Range16.ptr(5998, 6000, 1), new Range16.ptr(6002, 6003, 1)]), sliceType$1.nil, 0);
|
|
_Tai_Le = new RangeTable.ptr(new sliceType([new Range16.ptr(6480, 6509, 1), new Range16.ptr(6512, 6516, 1)]), sliceType$1.nil, 0);
|
|
_Tai_Tham = new RangeTable.ptr(new sliceType([new Range16.ptr(6688, 6750, 1), new Range16.ptr(6752, 6780, 1), new Range16.ptr(6783, 6793, 1), new Range16.ptr(6800, 6809, 1), new Range16.ptr(6816, 6829, 1)]), sliceType$1.nil, 0);
|
|
_Tai_Viet = new RangeTable.ptr(new sliceType([new Range16.ptr(43648, 43714, 1), new Range16.ptr(43739, 43743, 1)]), sliceType$1.nil, 0);
|
|
_Takri = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(71296, 71351, 1), new Range32.ptr(71360, 71369, 1)]), 0);
|
|
_Tamil = new RangeTable.ptr(new sliceType([new Range16.ptr(2946, 2947, 1), new Range16.ptr(2949, 2954, 1), new Range16.ptr(2958, 2960, 1), new Range16.ptr(2962, 2965, 1), new Range16.ptr(2969, 2970, 1), new Range16.ptr(2972, 2972, 1), new Range16.ptr(2974, 2975, 1), new Range16.ptr(2979, 2980, 1), new Range16.ptr(2984, 2986, 1), new Range16.ptr(2990, 3001, 1), new Range16.ptr(3006, 3010, 1), new Range16.ptr(3014, 3016, 1), new Range16.ptr(3018, 3021, 1), new Range16.ptr(3024, 3024, 1), new Range16.ptr(3031, 3031, 1), new Range16.ptr(3046, 3066, 1)]), sliceType$1.nil, 0);
|
|
_Tangut = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(94176, 94176, 1), new Range32.ptr(94208, 100332, 1), new Range32.ptr(100352, 101106, 1)]), 0);
|
|
_Telugu = new RangeTable.ptr(new sliceType([new Range16.ptr(3072, 3075, 1), new Range16.ptr(3077, 3084, 1), new Range16.ptr(3086, 3088, 1), new Range16.ptr(3090, 3112, 1), new Range16.ptr(3114, 3129, 1), new Range16.ptr(3133, 3140, 1), new Range16.ptr(3142, 3144, 1), new Range16.ptr(3146, 3149, 1), new Range16.ptr(3157, 3158, 1), new Range16.ptr(3160, 3162, 1), new Range16.ptr(3168, 3171, 1), new Range16.ptr(3174, 3183, 1), new Range16.ptr(3192, 3199, 1)]), sliceType$1.nil, 0);
|
|
_Thaana = new RangeTable.ptr(new sliceType([new Range16.ptr(1920, 1969, 1)]), sliceType$1.nil, 0);
|
|
_Thai = new RangeTable.ptr(new sliceType([new Range16.ptr(3585, 3642, 1), new Range16.ptr(3648, 3675, 1)]), sliceType$1.nil, 0);
|
|
_Tibetan = new RangeTable.ptr(new sliceType([new Range16.ptr(3840, 3911, 1), new Range16.ptr(3913, 3948, 1), new Range16.ptr(3953, 3991, 1), new Range16.ptr(3993, 4028, 1), new Range16.ptr(4030, 4044, 1), new Range16.ptr(4046, 4052, 1), new Range16.ptr(4057, 4058, 1)]), sliceType$1.nil, 0);
|
|
_Tifinagh = new RangeTable.ptr(new sliceType([new Range16.ptr(11568, 11623, 1), new Range16.ptr(11631, 11632, 1), new Range16.ptr(11647, 11647, 1)]), sliceType$1.nil, 0);
|
|
_Tirhuta = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(70784, 70855, 1), new Range32.ptr(70864, 70873, 1)]), 0);
|
|
_Ugaritic = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(66432, 66461, 1), new Range32.ptr(66463, 66463, 1)]), 0);
|
|
_Vai = new RangeTable.ptr(new sliceType([new Range16.ptr(42240, 42539, 1)]), sliceType$1.nil, 0);
|
|
_Warang_Citi = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(71840, 71922, 1), new Range32.ptr(71935, 71935, 1)]), 0);
|
|
_Yi = new RangeTable.ptr(new sliceType([new Range16.ptr(40960, 42124, 1), new Range16.ptr(42128, 42182, 1)]), sliceType$1.nil, 0);
|
|
_Zanabazar_Square = new RangeTable.ptr(new sliceType([]), new sliceType$1([new Range32.ptr(72192, 72263, 1)]), 0);
|
|
$pkg.Adlam = _Adlam;
|
|
$pkg.Ahom = _Ahom;
|
|
$pkg.Anatolian_Hieroglyphs = _Anatolian_Hieroglyphs;
|
|
$pkg.Arabic = _Arabic;
|
|
$pkg.Armenian = _Armenian;
|
|
$pkg.Avestan = _Avestan;
|
|
$pkg.Balinese = _Balinese;
|
|
$pkg.Bamum = _Bamum;
|
|
$pkg.Bassa_Vah = _Bassa_Vah;
|
|
$pkg.Batak = _Batak;
|
|
$pkg.Bengali = _Bengali;
|
|
$pkg.Bhaiksuki = _Bhaiksuki;
|
|
$pkg.Bopomofo = _Bopomofo;
|
|
$pkg.Brahmi = _Brahmi;
|
|
$pkg.Braille = _Braille;
|
|
$pkg.Buginese = _Buginese;
|
|
$pkg.Buhid = _Buhid;
|
|
$pkg.Canadian_Aboriginal = _Canadian_Aboriginal;
|
|
$pkg.Carian = _Carian;
|
|
$pkg.Caucasian_Albanian = _Caucasian_Albanian;
|
|
$pkg.Chakma = _Chakma;
|
|
$pkg.Cham = _Cham;
|
|
$pkg.Cherokee = _Cherokee;
|
|
$pkg.Common = _Common;
|
|
$pkg.Coptic = _Coptic;
|
|
$pkg.Cuneiform = _Cuneiform;
|
|
$pkg.Cypriot = _Cypriot;
|
|
$pkg.Cyrillic = _Cyrillic;
|
|
$pkg.Deseret = _Deseret;
|
|
$pkg.Devanagari = _Devanagari;
|
|
$pkg.Duployan = _Duployan;
|
|
$pkg.Egyptian_Hieroglyphs = _Egyptian_Hieroglyphs;
|
|
$pkg.Elbasan = _Elbasan;
|
|
$pkg.Ethiopic = _Ethiopic;
|
|
$pkg.Georgian = _Georgian;
|
|
$pkg.Glagolitic = _Glagolitic;
|
|
$pkg.Gothic = _Gothic;
|
|
$pkg.Grantha = _Grantha;
|
|
$pkg.Greek = _Greek;
|
|
$pkg.Gujarati = _Gujarati;
|
|
$pkg.Gurmukhi = _Gurmukhi;
|
|
$pkg.Han = _Han;
|
|
$pkg.Hangul = _Hangul;
|
|
$pkg.Hanunoo = _Hanunoo;
|
|
$pkg.Hatran = _Hatran;
|
|
$pkg.Hebrew = _Hebrew;
|
|
$pkg.Hiragana = _Hiragana;
|
|
$pkg.Imperial_Aramaic = _Imperial_Aramaic;
|
|
$pkg.Inherited = _Inherited;
|
|
$pkg.Inscriptional_Pahlavi = _Inscriptional_Pahlavi;
|
|
$pkg.Inscriptional_Parthian = _Inscriptional_Parthian;
|
|
$pkg.Javanese = _Javanese;
|
|
$pkg.Kaithi = _Kaithi;
|
|
$pkg.Kannada = _Kannada;
|
|
$pkg.Katakana = _Katakana;
|
|
$pkg.Kayah_Li = _Kayah_Li;
|
|
$pkg.Kharoshthi = _Kharoshthi;
|
|
$pkg.Khmer = _Khmer;
|
|
$pkg.Khojki = _Khojki;
|
|
$pkg.Khudawadi = _Khudawadi;
|
|
$pkg.Lao = _Lao;
|
|
$pkg.Latin = _Latin;
|
|
$pkg.Lepcha = _Lepcha;
|
|
$pkg.Limbu = _Limbu;
|
|
$pkg.Linear_A = _Linear_A;
|
|
$pkg.Linear_B = _Linear_B;
|
|
$pkg.Lisu = _Lisu;
|
|
$pkg.Lycian = _Lycian;
|
|
$pkg.Lydian = _Lydian;
|
|
$pkg.Mahajani = _Mahajani;
|
|
$pkg.Malayalam = _Malayalam;
|
|
$pkg.Mandaic = _Mandaic;
|
|
$pkg.Manichaean = _Manichaean;
|
|
$pkg.Marchen = _Marchen;
|
|
$pkg.Masaram_Gondi = _Masaram_Gondi;
|
|
$pkg.Meetei_Mayek = _Meetei_Mayek;
|
|
$pkg.Mende_Kikakui = _Mende_Kikakui;
|
|
$pkg.Meroitic_Cursive = _Meroitic_Cursive;
|
|
$pkg.Meroitic_Hieroglyphs = _Meroitic_Hieroglyphs;
|
|
$pkg.Miao = _Miao;
|
|
$pkg.Modi = _Modi;
|
|
$pkg.Mongolian = _Mongolian;
|
|
$pkg.Mro = _Mro;
|
|
$pkg.Multani = _Multani;
|
|
$pkg.Myanmar = _Myanmar;
|
|
$pkg.Nabataean = _Nabataean;
|
|
$pkg.New_Tai_Lue = _New_Tai_Lue;
|
|
$pkg.Newa = _Newa;
|
|
$pkg.Nko = _Nko;
|
|
$pkg.Nushu = _Nushu;
|
|
$pkg.Ogham = _Ogham;
|
|
$pkg.Ol_Chiki = _Ol_Chiki;
|
|
$pkg.Old_Hungarian = _Old_Hungarian;
|
|
$pkg.Old_Italic = _Old_Italic;
|
|
$pkg.Old_North_Arabian = _Old_North_Arabian;
|
|
$pkg.Old_Permic = _Old_Permic;
|
|
$pkg.Old_Persian = _Old_Persian;
|
|
$pkg.Old_South_Arabian = _Old_South_Arabian;
|
|
$pkg.Old_Turkic = _Old_Turkic;
|
|
$pkg.Oriya = _Oriya;
|
|
$pkg.Osage = _Osage;
|
|
$pkg.Osmanya = _Osmanya;
|
|
$pkg.Pahawh_Hmong = _Pahawh_Hmong;
|
|
$pkg.Palmyrene = _Palmyrene;
|
|
$pkg.Pau_Cin_Hau = _Pau_Cin_Hau;
|
|
$pkg.Phags_Pa = _Phags_Pa;
|
|
$pkg.Phoenician = _Phoenician;
|
|
$pkg.Psalter_Pahlavi = _Psalter_Pahlavi;
|
|
$pkg.Rejang = _Rejang;
|
|
$pkg.Runic = _Runic;
|
|
$pkg.Samaritan = _Samaritan;
|
|
$pkg.Saurashtra = _Saurashtra;
|
|
$pkg.Sharada = _Sharada;
|
|
$pkg.Shavian = _Shavian;
|
|
$pkg.Siddham = _Siddham;
|
|
$pkg.SignWriting = _SignWriting;
|
|
$pkg.Sinhala = _Sinhala;
|
|
$pkg.Sora_Sompeng = _Sora_Sompeng;
|
|
$pkg.Soyombo = _Soyombo;
|
|
$pkg.Sundanese = _Sundanese;
|
|
$pkg.Syloti_Nagri = _Syloti_Nagri;
|
|
$pkg.Syriac = _Syriac;
|
|
$pkg.Tagalog = _Tagalog;
|
|
$pkg.Tagbanwa = _Tagbanwa;
|
|
$pkg.Tai_Le = _Tai_Le;
|
|
$pkg.Tai_Tham = _Tai_Tham;
|
|
$pkg.Tai_Viet = _Tai_Viet;
|
|
$pkg.Takri = _Takri;
|
|
$pkg.Tamil = _Tamil;
|
|
$pkg.Tangut = _Tangut;
|
|
$pkg.Telugu = _Telugu;
|
|
$pkg.Thaana = _Thaana;
|
|
$pkg.Thai = _Thai;
|
|
$pkg.Tibetan = _Tibetan;
|
|
$pkg.Tifinagh = _Tifinagh;
|
|
$pkg.Tirhuta = _Tirhuta;
|
|
$pkg.Ugaritic = _Ugaritic;
|
|
$pkg.Vai = _Vai;
|
|
$pkg.Warang_Citi = _Warang_Citi;
|
|
$pkg.Yi = _Yi;
|
|
$pkg.Zanabazar_Square = _Zanabazar_Square;
|
|
$pkg.Scripts = $makeMap($String.keyFor, [{ k: "Adlam", v: $pkg.Adlam }, { k: "Ahom", v: $pkg.Ahom }, { k: "Anatolian_Hieroglyphs", v: $pkg.Anatolian_Hieroglyphs }, { k: "Arabic", v: $pkg.Arabic }, { k: "Armenian", v: $pkg.Armenian }, { k: "Avestan", v: $pkg.Avestan }, { k: "Balinese", v: $pkg.Balinese }, { k: "Bamum", v: $pkg.Bamum }, { k: "Bassa_Vah", v: $pkg.Bassa_Vah }, { k: "Batak", v: $pkg.Batak }, { k: "Bengali", v: $pkg.Bengali }, { k: "Bhaiksuki", v: $pkg.Bhaiksuki }, { k: "Bopomofo", v: $pkg.Bopomofo }, { k: "Brahmi", v: $pkg.Brahmi }, { k: "Braille", v: $pkg.Braille }, { k: "Buginese", v: $pkg.Buginese }, { k: "Buhid", v: $pkg.Buhid }, { k: "Canadian_Aboriginal", v: $pkg.Canadian_Aboriginal }, { k: "Carian", v: $pkg.Carian }, { k: "Caucasian_Albanian", v: $pkg.Caucasian_Albanian }, { k: "Chakma", v: $pkg.Chakma }, { k: "Cham", v: $pkg.Cham }, { k: "Cherokee", v: $pkg.Cherokee }, { k: "Common", v: $pkg.Common }, { k: "Coptic", v: $pkg.Coptic }, { k: "Cuneiform", v: $pkg.Cuneiform }, { k: "Cypriot", v: $pkg.Cypriot }, { k: "Cyrillic", v: $pkg.Cyrillic }, { k: "Deseret", v: $pkg.Deseret }, { k: "Devanagari", v: $pkg.Devanagari }, { k: "Duployan", v: $pkg.Duployan }, { k: "Egyptian_Hieroglyphs", v: $pkg.Egyptian_Hieroglyphs }, { k: "Elbasan", v: $pkg.Elbasan }, { k: "Ethiopic", v: $pkg.Ethiopic }, { k: "Georgian", v: $pkg.Georgian }, { k: "Glagolitic", v: $pkg.Glagolitic }, { k: "Gothic", v: $pkg.Gothic }, { k: "Grantha", v: $pkg.Grantha }, { k: "Greek", v: $pkg.Greek }, { k: "Gujarati", v: $pkg.Gujarati }, { k: "Gurmukhi", v: $pkg.Gurmukhi }, { k: "Han", v: $pkg.Han }, { k: "Hangul", v: $pkg.Hangul }, { k: "Hanunoo", v: $pkg.Hanunoo }, { k: "Hatran", v: $pkg.Hatran }, { k: "Hebrew", v: $pkg.Hebrew }, { k: "Hiragana", v: $pkg.Hiragana }, { k: "Imperial_Aramaic", v: $pkg.Imperial_Aramaic }, { k: "Inherited", v: $pkg.Inherited }, { k: "Inscriptional_Pahlavi", v: $pkg.Inscriptional_Pahlavi }, { k: "Inscriptional_Parthian", v: $pkg.Inscriptional_Parthian }, { k: "Javanese", v: $pkg.Javanese }, { k: "Kaithi", v: $pkg.Kaithi }, { k: "Kannada", v: $pkg.Kannada }, { k: "Katakana", v: $pkg.Katakana }, { k: "Kayah_Li", v: $pkg.Kayah_Li }, { k: "Kharoshthi", v: $pkg.Kharoshthi }, { k: "Khmer", v: $pkg.Khmer }, { k: "Khojki", v: $pkg.Khojki }, { k: "Khudawadi", v: $pkg.Khudawadi }, { k: "Lao", v: $pkg.Lao }, { k: "Latin", v: $pkg.Latin }, { k: "Lepcha", v: $pkg.Lepcha }, { k: "Limbu", v: $pkg.Limbu }, { k: "Linear_A", v: $pkg.Linear_A }, { k: "Linear_B", v: $pkg.Linear_B }, { k: "Lisu", v: $pkg.Lisu }, { k: "Lycian", v: $pkg.Lycian }, { k: "Lydian", v: $pkg.Lydian }, { k: "Mahajani", v: $pkg.Mahajani }, { k: "Malayalam", v: $pkg.Malayalam }, { k: "Mandaic", v: $pkg.Mandaic }, { k: "Manichaean", v: $pkg.Manichaean }, { k: "Marchen", v: $pkg.Marchen }, { k: "Masaram_Gondi", v: $pkg.Masaram_Gondi }, { k: "Meetei_Mayek", v: $pkg.Meetei_Mayek }, { k: "Mende_Kikakui", v: $pkg.Mende_Kikakui }, { k: "Meroitic_Cursive", v: $pkg.Meroitic_Cursive }, { k: "Meroitic_Hieroglyphs", v: $pkg.Meroitic_Hieroglyphs }, { k: "Miao", v: $pkg.Miao }, { k: "Modi", v: $pkg.Modi }, { k: "Mongolian", v: $pkg.Mongolian }, { k: "Mro", v: $pkg.Mro }, { k: "Multani", v: $pkg.Multani }, { k: "Myanmar", v: $pkg.Myanmar }, { k: "Nabataean", v: $pkg.Nabataean }, { k: "New_Tai_Lue", v: $pkg.New_Tai_Lue }, { k: "Newa", v: $pkg.Newa }, { k: "Nko", v: $pkg.Nko }, { k: "Nushu", v: $pkg.Nushu }, { k: "Ogham", v: $pkg.Ogham }, { k: "Ol_Chiki", v: $pkg.Ol_Chiki }, { k: "Old_Hungarian", v: $pkg.Old_Hungarian }, { k: "Old_Italic", v: $pkg.Old_Italic }, { k: "Old_North_Arabian", v: $pkg.Old_North_Arabian }, { k: "Old_Permic", v: $pkg.Old_Permic }, { k: "Old_Persian", v: $pkg.Old_Persian }, { k: "Old_South_Arabian", v: $pkg.Old_South_Arabian }, { k: "Old_Turkic", v: $pkg.Old_Turkic }, { k: "Oriya", v: $pkg.Oriya }, { k: "Osage", v: $pkg.Osage }, { k: "Osmanya", v: $pkg.Osmanya }, { k: "Pahawh_Hmong", v: $pkg.Pahawh_Hmong }, { k: "Palmyrene", v: $pkg.Palmyrene }, { k: "Pau_Cin_Hau", v: $pkg.Pau_Cin_Hau }, { k: "Phags_Pa", v: $pkg.Phags_Pa }, { k: "Phoenician", v: $pkg.Phoenician }, { k: "Psalter_Pahlavi", v: $pkg.Psalter_Pahlavi }, { k: "Rejang", v: $pkg.Rejang }, { k: "Runic", v: $pkg.Runic }, { k: "Samaritan", v: $pkg.Samaritan }, { k: "Saurashtra", v: $pkg.Saurashtra }, { k: "Sharada", v: $pkg.Sharada }, { k: "Shavian", v: $pkg.Shavian }, { k: "Siddham", v: $pkg.Siddham }, { k: "SignWriting", v: $pkg.SignWriting }, { k: "Sinhala", v: $pkg.Sinhala }, { k: "Sora_Sompeng", v: $pkg.Sora_Sompeng }, { k: "Soyombo", v: $pkg.Soyombo }, { k: "Sundanese", v: $pkg.Sundanese }, { k: "Syloti_Nagri", v: $pkg.Syloti_Nagri }, { k: "Syriac", v: $pkg.Syriac }, { k: "Tagalog", v: $pkg.Tagalog }, { k: "Tagbanwa", v: $pkg.Tagbanwa }, { k: "Tai_Le", v: $pkg.Tai_Le }, { k: "Tai_Tham", v: $pkg.Tai_Tham }, { k: "Tai_Viet", v: $pkg.Tai_Viet }, { k: "Takri", v: $pkg.Takri }, { k: "Tamil", v: $pkg.Tamil }, { k: "Tangut", v: $pkg.Tangut }, { k: "Telugu", v: $pkg.Telugu }, { k: "Thaana", v: $pkg.Thaana }, { k: "Thai", v: $pkg.Thai }, { k: "Tibetan", v: $pkg.Tibetan }, { k: "Tifinagh", v: $pkg.Tifinagh }, { k: "Tirhuta", v: $pkg.Tirhuta }, { k: "Ugaritic", v: $pkg.Ugaritic }, { k: "Vai", v: $pkg.Vai }, { k: "Warang_Citi", v: $pkg.Warang_Citi }, { k: "Yi", v: $pkg.Yi }, { k: "Zanabazar_Square", v: $pkg.Zanabazar_Square }]);
|
|
_CaseRanges = new sliceType$3([new CaseRange.ptr(65, 90, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(97, 122, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(181, 181, $toNativeArray($kindInt32, [743, 0, 743])), new CaseRange.ptr(192, 214, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(216, 222, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(224, 246, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(248, 254, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(255, 255, $toNativeArray($kindInt32, [121, 0, 121])), new CaseRange.ptr(256, 303, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(304, 304, $toNativeArray($kindInt32, [0, -199, 0])), new CaseRange.ptr(305, 305, $toNativeArray($kindInt32, [-232, 0, -232])), new CaseRange.ptr(306, 311, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(313, 328, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(330, 375, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(376, 376, $toNativeArray($kindInt32, [0, -121, 0])), new CaseRange.ptr(377, 382, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(383, 383, $toNativeArray($kindInt32, [-300, 0, -300])), new CaseRange.ptr(384, 384, $toNativeArray($kindInt32, [195, 0, 195])), new CaseRange.ptr(385, 385, $toNativeArray($kindInt32, [0, 210, 0])), new CaseRange.ptr(386, 389, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(390, 390, $toNativeArray($kindInt32, [0, 206, 0])), new CaseRange.ptr(391, 392, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(393, 394, $toNativeArray($kindInt32, [0, 205, 0])), new CaseRange.ptr(395, 396, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(398, 398, $toNativeArray($kindInt32, [0, 79, 0])), new CaseRange.ptr(399, 399, $toNativeArray($kindInt32, [0, 202, 0])), new CaseRange.ptr(400, 400, $toNativeArray($kindInt32, [0, 203, 0])), new CaseRange.ptr(401, 402, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(403, 403, $toNativeArray($kindInt32, [0, 205, 0])), new CaseRange.ptr(404, 404, $toNativeArray($kindInt32, [0, 207, 0])), new CaseRange.ptr(405, 405, $toNativeArray($kindInt32, [97, 0, 97])), new CaseRange.ptr(406, 406, $toNativeArray($kindInt32, [0, 211, 0])), new CaseRange.ptr(407, 407, $toNativeArray($kindInt32, [0, 209, 0])), new CaseRange.ptr(408, 409, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(410, 410, $toNativeArray($kindInt32, [163, 0, 163])), new CaseRange.ptr(412, 412, $toNativeArray($kindInt32, [0, 211, 0])), new CaseRange.ptr(413, 413, $toNativeArray($kindInt32, [0, 213, 0])), new CaseRange.ptr(414, 414, $toNativeArray($kindInt32, [130, 0, 130])), new CaseRange.ptr(415, 415, $toNativeArray($kindInt32, [0, 214, 0])), new CaseRange.ptr(416, 421, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(422, 422, $toNativeArray($kindInt32, [0, 218, 0])), new CaseRange.ptr(423, 424, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(425, 425, $toNativeArray($kindInt32, [0, 218, 0])), new CaseRange.ptr(428, 429, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(430, 430, $toNativeArray($kindInt32, [0, 218, 0])), new CaseRange.ptr(431, 432, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(433, 434, $toNativeArray($kindInt32, [0, 217, 0])), new CaseRange.ptr(435, 438, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(439, 439, $toNativeArray($kindInt32, [0, 219, 0])), new CaseRange.ptr(440, 441, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(444, 445, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(447, 447, $toNativeArray($kindInt32, [56, 0, 56])), new CaseRange.ptr(452, 452, $toNativeArray($kindInt32, [0, 2, 1])), new CaseRange.ptr(453, 453, $toNativeArray($kindInt32, [-1, 1, 0])), new CaseRange.ptr(454, 454, $toNativeArray($kindInt32, [-2, 0, -1])), new CaseRange.ptr(455, 455, $toNativeArray($kindInt32, [0, 2, 1])), new CaseRange.ptr(456, 456, $toNativeArray($kindInt32, [-1, 1, 0])), new CaseRange.ptr(457, 457, $toNativeArray($kindInt32, [-2, 0, -1])), new CaseRange.ptr(458, 458, $toNativeArray($kindInt32, [0, 2, 1])), new CaseRange.ptr(459, 459, $toNativeArray($kindInt32, [-1, 1, 0])), new CaseRange.ptr(460, 460, $toNativeArray($kindInt32, [-2, 0, -1])), new CaseRange.ptr(461, 476, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(477, 477, $toNativeArray($kindInt32, [-79, 0, -79])), new CaseRange.ptr(478, 495, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(497, 497, $toNativeArray($kindInt32, [0, 2, 1])), new CaseRange.ptr(498, 498, $toNativeArray($kindInt32, [-1, 1, 0])), new CaseRange.ptr(499, 499, $toNativeArray($kindInt32, [-2, 0, -1])), new CaseRange.ptr(500, 501, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(502, 502, $toNativeArray($kindInt32, [0, -97, 0])), new CaseRange.ptr(503, 503, $toNativeArray($kindInt32, [0, -56, 0])), new CaseRange.ptr(504, 543, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(544, 544, $toNativeArray($kindInt32, [0, -130, 0])), new CaseRange.ptr(546, 563, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(570, 570, $toNativeArray($kindInt32, [0, 10795, 0])), new CaseRange.ptr(571, 572, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(573, 573, $toNativeArray($kindInt32, [0, -163, 0])), new CaseRange.ptr(574, 574, $toNativeArray($kindInt32, [0, 10792, 0])), new CaseRange.ptr(575, 576, $toNativeArray($kindInt32, [10815, 0, 10815])), new CaseRange.ptr(577, 578, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(579, 579, $toNativeArray($kindInt32, [0, -195, 0])), new CaseRange.ptr(580, 580, $toNativeArray($kindInt32, [0, 69, 0])), new CaseRange.ptr(581, 581, $toNativeArray($kindInt32, [0, 71, 0])), new CaseRange.ptr(582, 591, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(592, 592, $toNativeArray($kindInt32, [10783, 0, 10783])), new CaseRange.ptr(593, 593, $toNativeArray($kindInt32, [10780, 0, 10780])), new CaseRange.ptr(594, 594, $toNativeArray($kindInt32, [10782, 0, 10782])), new CaseRange.ptr(595, 595, $toNativeArray($kindInt32, [-210, 0, -210])), new CaseRange.ptr(596, 596, $toNativeArray($kindInt32, [-206, 0, -206])), new CaseRange.ptr(598, 599, $toNativeArray($kindInt32, [-205, 0, -205])), new CaseRange.ptr(601, 601, $toNativeArray($kindInt32, [-202, 0, -202])), new CaseRange.ptr(603, 603, $toNativeArray($kindInt32, [-203, 0, -203])), new CaseRange.ptr(604, 604, $toNativeArray($kindInt32, [42319, 0, 42319])), new CaseRange.ptr(608, 608, $toNativeArray($kindInt32, [-205, 0, -205])), new CaseRange.ptr(609, 609, $toNativeArray($kindInt32, [42315, 0, 42315])), new CaseRange.ptr(611, 611, $toNativeArray($kindInt32, [-207, 0, -207])), new CaseRange.ptr(613, 613, $toNativeArray($kindInt32, [42280, 0, 42280])), new CaseRange.ptr(614, 614, $toNativeArray($kindInt32, [42308, 0, 42308])), new CaseRange.ptr(616, 616, $toNativeArray($kindInt32, [-209, 0, -209])), new CaseRange.ptr(617, 617, $toNativeArray($kindInt32, [-211, 0, -211])), new CaseRange.ptr(618, 618, $toNativeArray($kindInt32, [42308, 0, 42308])), new CaseRange.ptr(619, 619, $toNativeArray($kindInt32, [10743, 0, 10743])), new CaseRange.ptr(620, 620, $toNativeArray($kindInt32, [42305, 0, 42305])), new CaseRange.ptr(623, 623, $toNativeArray($kindInt32, [-211, 0, -211])), new CaseRange.ptr(625, 625, $toNativeArray($kindInt32, [10749, 0, 10749])), new CaseRange.ptr(626, 626, $toNativeArray($kindInt32, [-213, 0, -213])), new CaseRange.ptr(629, 629, $toNativeArray($kindInt32, [-214, 0, -214])), new CaseRange.ptr(637, 637, $toNativeArray($kindInt32, [10727, 0, 10727])), new CaseRange.ptr(640, 640, $toNativeArray($kindInt32, [-218, 0, -218])), new CaseRange.ptr(643, 643, $toNativeArray($kindInt32, [-218, 0, -218])), new CaseRange.ptr(647, 647, $toNativeArray($kindInt32, [42282, 0, 42282])), new CaseRange.ptr(648, 648, $toNativeArray($kindInt32, [-218, 0, -218])), new CaseRange.ptr(649, 649, $toNativeArray($kindInt32, [-69, 0, -69])), new CaseRange.ptr(650, 651, $toNativeArray($kindInt32, [-217, 0, -217])), new CaseRange.ptr(652, 652, $toNativeArray($kindInt32, [-71, 0, -71])), new CaseRange.ptr(658, 658, $toNativeArray($kindInt32, [-219, 0, -219])), new CaseRange.ptr(669, 669, $toNativeArray($kindInt32, [42261, 0, 42261])), new CaseRange.ptr(670, 670, $toNativeArray($kindInt32, [42258, 0, 42258])), new CaseRange.ptr(837, 837, $toNativeArray($kindInt32, [84, 0, 84])), new CaseRange.ptr(880, 883, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(886, 887, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(891, 893, $toNativeArray($kindInt32, [130, 0, 130])), new CaseRange.ptr(895, 895, $toNativeArray($kindInt32, [0, 116, 0])), new CaseRange.ptr(902, 902, $toNativeArray($kindInt32, [0, 38, 0])), new CaseRange.ptr(904, 906, $toNativeArray($kindInt32, [0, 37, 0])), new CaseRange.ptr(908, 908, $toNativeArray($kindInt32, [0, 64, 0])), new CaseRange.ptr(910, 911, $toNativeArray($kindInt32, [0, 63, 0])), new CaseRange.ptr(913, 929, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(931, 939, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(940, 940, $toNativeArray($kindInt32, [-38, 0, -38])), new CaseRange.ptr(941, 943, $toNativeArray($kindInt32, [-37, 0, -37])), new CaseRange.ptr(945, 961, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(962, 962, $toNativeArray($kindInt32, [-31, 0, -31])), new CaseRange.ptr(963, 971, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(972, 972, $toNativeArray($kindInt32, [-64, 0, -64])), new CaseRange.ptr(973, 974, $toNativeArray($kindInt32, [-63, 0, -63])), new CaseRange.ptr(975, 975, $toNativeArray($kindInt32, [0, 8, 0])), new CaseRange.ptr(976, 976, $toNativeArray($kindInt32, [-62, 0, -62])), new CaseRange.ptr(977, 977, $toNativeArray($kindInt32, [-57, 0, -57])), new CaseRange.ptr(981, 981, $toNativeArray($kindInt32, [-47, 0, -47])), new CaseRange.ptr(982, 982, $toNativeArray($kindInt32, [-54, 0, -54])), new CaseRange.ptr(983, 983, $toNativeArray($kindInt32, [-8, 0, -8])), new CaseRange.ptr(984, 1007, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1008, 1008, $toNativeArray($kindInt32, [-86, 0, -86])), new CaseRange.ptr(1009, 1009, $toNativeArray($kindInt32, [-80, 0, -80])), new CaseRange.ptr(1010, 1010, $toNativeArray($kindInt32, [7, 0, 7])), new CaseRange.ptr(1011, 1011, $toNativeArray($kindInt32, [-116, 0, -116])), new CaseRange.ptr(1012, 1012, $toNativeArray($kindInt32, [0, -60, 0])), new CaseRange.ptr(1013, 1013, $toNativeArray($kindInt32, [-96, 0, -96])), new CaseRange.ptr(1015, 1016, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1017, 1017, $toNativeArray($kindInt32, [0, -7, 0])), new CaseRange.ptr(1018, 1019, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1021, 1023, $toNativeArray($kindInt32, [0, -130, 0])), new CaseRange.ptr(1024, 1039, $toNativeArray($kindInt32, [0, 80, 0])), new CaseRange.ptr(1040, 1071, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(1072, 1103, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(1104, 1119, $toNativeArray($kindInt32, [-80, 0, -80])), new CaseRange.ptr(1120, 1153, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1162, 1215, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1216, 1216, $toNativeArray($kindInt32, [0, 15, 0])), new CaseRange.ptr(1217, 1230, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1231, 1231, $toNativeArray($kindInt32, [-15, 0, -15])), new CaseRange.ptr(1232, 1327, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(1329, 1366, $toNativeArray($kindInt32, [0, 48, 0])), new CaseRange.ptr(1377, 1414, $toNativeArray($kindInt32, [-48, 0, -48])), new CaseRange.ptr(4256, 4293, $toNativeArray($kindInt32, [0, 7264, 0])), new CaseRange.ptr(4295, 4295, $toNativeArray($kindInt32, [0, 7264, 0])), new CaseRange.ptr(4301, 4301, $toNativeArray($kindInt32, [0, 7264, 0])), new CaseRange.ptr(5024, 5103, $toNativeArray($kindInt32, [0, 38864, 0])), new CaseRange.ptr(5104, 5109, $toNativeArray($kindInt32, [0, 8, 0])), new CaseRange.ptr(5112, 5117, $toNativeArray($kindInt32, [-8, 0, -8])), new CaseRange.ptr(7296, 7296, $toNativeArray($kindInt32, [-6254, 0, -6254])), new CaseRange.ptr(7297, 7297, $toNativeArray($kindInt32, [-6253, 0, -6253])), new CaseRange.ptr(7298, 7298, $toNativeArray($kindInt32, [-6244, 0, -6244])), new CaseRange.ptr(7299, 7300, $toNativeArray($kindInt32, [-6242, 0, -6242])), new CaseRange.ptr(7301, 7301, $toNativeArray($kindInt32, [-6243, 0, -6243])), new CaseRange.ptr(7302, 7302, $toNativeArray($kindInt32, [-6236, 0, -6236])), new CaseRange.ptr(7303, 7303, $toNativeArray($kindInt32, [-6181, 0, -6181])), new CaseRange.ptr(7304, 7304, $toNativeArray($kindInt32, [35266, 0, 35266])), new CaseRange.ptr(7545, 7545, $toNativeArray($kindInt32, [35332, 0, 35332])), new CaseRange.ptr(7549, 7549, $toNativeArray($kindInt32, [3814, 0, 3814])), new CaseRange.ptr(7680, 7829, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(7835, 7835, $toNativeArray($kindInt32, [-59, 0, -59])), new CaseRange.ptr(7838, 7838, $toNativeArray($kindInt32, [0, -7615, 0])), new CaseRange.ptr(7840, 7935, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(7936, 7943, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(7944, 7951, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(7952, 7957, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(7960, 7965, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(7968, 7975, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(7976, 7983, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(7984, 7991, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(7992, 7999, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8000, 8005, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8008, 8013, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8017, 8017, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8019, 8019, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8021, 8021, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8023, 8023, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8025, 8025, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8027, 8027, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8029, 8029, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8031, 8031, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8032, 8039, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8040, 8047, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8048, 8049, $toNativeArray($kindInt32, [74, 0, 74])), new CaseRange.ptr(8050, 8053, $toNativeArray($kindInt32, [86, 0, 86])), new CaseRange.ptr(8054, 8055, $toNativeArray($kindInt32, [100, 0, 100])), new CaseRange.ptr(8056, 8057, $toNativeArray($kindInt32, [128, 0, 128])), new CaseRange.ptr(8058, 8059, $toNativeArray($kindInt32, [112, 0, 112])), new CaseRange.ptr(8060, 8061, $toNativeArray($kindInt32, [126, 0, 126])), new CaseRange.ptr(8064, 8071, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8072, 8079, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8080, 8087, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8088, 8095, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8096, 8103, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8104, 8111, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8112, 8113, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8115, 8115, $toNativeArray($kindInt32, [9, 0, 9])), new CaseRange.ptr(8120, 8121, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8122, 8123, $toNativeArray($kindInt32, [0, -74, 0])), new CaseRange.ptr(8124, 8124, $toNativeArray($kindInt32, [0, -9, 0])), new CaseRange.ptr(8126, 8126, $toNativeArray($kindInt32, [-7205, 0, -7205])), new CaseRange.ptr(8131, 8131, $toNativeArray($kindInt32, [9, 0, 9])), new CaseRange.ptr(8136, 8139, $toNativeArray($kindInt32, [0, -86, 0])), new CaseRange.ptr(8140, 8140, $toNativeArray($kindInt32, [0, -9, 0])), new CaseRange.ptr(8144, 8145, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8152, 8153, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8154, 8155, $toNativeArray($kindInt32, [0, -100, 0])), new CaseRange.ptr(8160, 8161, $toNativeArray($kindInt32, [8, 0, 8])), new CaseRange.ptr(8165, 8165, $toNativeArray($kindInt32, [7, 0, 7])), new CaseRange.ptr(8168, 8169, $toNativeArray($kindInt32, [0, -8, 0])), new CaseRange.ptr(8170, 8171, $toNativeArray($kindInt32, [0, -112, 0])), new CaseRange.ptr(8172, 8172, $toNativeArray($kindInt32, [0, -7, 0])), new CaseRange.ptr(8179, 8179, $toNativeArray($kindInt32, [9, 0, 9])), new CaseRange.ptr(8184, 8185, $toNativeArray($kindInt32, [0, -128, 0])), new CaseRange.ptr(8186, 8187, $toNativeArray($kindInt32, [0, -126, 0])), new CaseRange.ptr(8188, 8188, $toNativeArray($kindInt32, [0, -9, 0])), new CaseRange.ptr(8486, 8486, $toNativeArray($kindInt32, [0, -7517, 0])), new CaseRange.ptr(8490, 8490, $toNativeArray($kindInt32, [0, -8383, 0])), new CaseRange.ptr(8491, 8491, $toNativeArray($kindInt32, [0, -8262, 0])), new CaseRange.ptr(8498, 8498, $toNativeArray($kindInt32, [0, 28, 0])), new CaseRange.ptr(8526, 8526, $toNativeArray($kindInt32, [-28, 0, -28])), new CaseRange.ptr(8544, 8559, $toNativeArray($kindInt32, [0, 16, 0])), new CaseRange.ptr(8560, 8575, $toNativeArray($kindInt32, [-16, 0, -16])), new CaseRange.ptr(8579, 8580, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(9398, 9423, $toNativeArray($kindInt32, [0, 26, 0])), new CaseRange.ptr(9424, 9449, $toNativeArray($kindInt32, [-26, 0, -26])), new CaseRange.ptr(11264, 11310, $toNativeArray($kindInt32, [0, 48, 0])), new CaseRange.ptr(11312, 11358, $toNativeArray($kindInt32, [-48, 0, -48])), new CaseRange.ptr(11360, 11361, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11362, 11362, $toNativeArray($kindInt32, [0, -10743, 0])), new CaseRange.ptr(11363, 11363, $toNativeArray($kindInt32, [0, -3814, 0])), new CaseRange.ptr(11364, 11364, $toNativeArray($kindInt32, [0, -10727, 0])), new CaseRange.ptr(11365, 11365, $toNativeArray($kindInt32, [-10795, 0, -10795])), new CaseRange.ptr(11366, 11366, $toNativeArray($kindInt32, [-10792, 0, -10792])), new CaseRange.ptr(11367, 11372, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11373, 11373, $toNativeArray($kindInt32, [0, -10780, 0])), new CaseRange.ptr(11374, 11374, $toNativeArray($kindInt32, [0, -10749, 0])), new CaseRange.ptr(11375, 11375, $toNativeArray($kindInt32, [0, -10783, 0])), new CaseRange.ptr(11376, 11376, $toNativeArray($kindInt32, [0, -10782, 0])), new CaseRange.ptr(11378, 11379, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11381, 11382, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11390, 11391, $toNativeArray($kindInt32, [0, -10815, 0])), new CaseRange.ptr(11392, 11491, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11499, 11502, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11506, 11507, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(11520, 11557, $toNativeArray($kindInt32, [-7264, 0, -7264])), new CaseRange.ptr(11559, 11559, $toNativeArray($kindInt32, [-7264, 0, -7264])), new CaseRange.ptr(11565, 11565, $toNativeArray($kindInt32, [-7264, 0, -7264])), new CaseRange.ptr(42560, 42605, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42624, 42651, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42786, 42799, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42802, 42863, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42873, 42876, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42877, 42877, $toNativeArray($kindInt32, [0, -35332, 0])), new CaseRange.ptr(42878, 42887, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42891, 42892, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42893, 42893, $toNativeArray($kindInt32, [0, -42280, 0])), new CaseRange.ptr(42896, 42899, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42902, 42921, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(42922, 42922, $toNativeArray($kindInt32, [0, -42308, 0])), new CaseRange.ptr(42923, 42923, $toNativeArray($kindInt32, [0, -42319, 0])), new CaseRange.ptr(42924, 42924, $toNativeArray($kindInt32, [0, -42315, 0])), new CaseRange.ptr(42925, 42925, $toNativeArray($kindInt32, [0, -42305, 0])), new CaseRange.ptr(42926, 42926, $toNativeArray($kindInt32, [0, -42308, 0])), new CaseRange.ptr(42928, 42928, $toNativeArray($kindInt32, [0, -42258, 0])), new CaseRange.ptr(42929, 42929, $toNativeArray($kindInt32, [0, -42282, 0])), new CaseRange.ptr(42930, 42930, $toNativeArray($kindInt32, [0, -42261, 0])), new CaseRange.ptr(42931, 42931, $toNativeArray($kindInt32, [0, 928, 0])), new CaseRange.ptr(42932, 42935, $toNativeArray($kindInt32, [1114112, 1114112, 1114112])), new CaseRange.ptr(43859, 43859, $toNativeArray($kindInt32, [-928, 0, -928])), new CaseRange.ptr(43888, 43967, $toNativeArray($kindInt32, [-38864, 0, -38864])), new CaseRange.ptr(65313, 65338, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(65345, 65370, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(66560, 66599, $toNativeArray($kindInt32, [0, 40, 0])), new CaseRange.ptr(66600, 66639, $toNativeArray($kindInt32, [-40, 0, -40])), new CaseRange.ptr(66736, 66771, $toNativeArray($kindInt32, [0, 40, 0])), new CaseRange.ptr(66776, 66811, $toNativeArray($kindInt32, [-40, 0, -40])), new CaseRange.ptr(68736, 68786, $toNativeArray($kindInt32, [0, 64, 0])), new CaseRange.ptr(68800, 68850, $toNativeArray($kindInt32, [-64, 0, -64])), new CaseRange.ptr(71840, 71871, $toNativeArray($kindInt32, [0, 32, 0])), new CaseRange.ptr(71872, 71903, $toNativeArray($kindInt32, [-32, 0, -32])), new CaseRange.ptr(125184, 125217, $toNativeArray($kindInt32, [0, 34, 0])), new CaseRange.ptr(125218, 125251, $toNativeArray($kindInt32, [-34, 0, -34]))]);
|
|
$pkg.CaseRanges = _CaseRanges;
|
|
properties = $toNativeArray($kindUint8, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 144, 130, 130, 130, 136, 130, 130, 130, 130, 130, 130, 136, 130, 130, 130, 130, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 130, 130, 136, 136, 136, 130, 130, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 130, 130, 130, 136, 130, 136, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 130, 136, 130, 136, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 130, 136, 136, 136, 136, 136, 130, 136, 136, 224, 130, 136, 0, 136, 136, 136, 136, 132, 132, 136, 192, 130, 130, 136, 132, 224, 130, 132, 132, 132, 130, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 136, 160, 160, 160, 160, 160, 160, 160, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 136, 192, 192, 192, 192, 192, 192, 192, 192]);
|
|
asciiFold = $toNativeArray($kindUint16, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 8490, 76, 77, 78, 79, 80, 81, 82, 383, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127]);
|
|
caseOrbit = new sliceType$4([new foldPair.ptr(75, 107), new foldPair.ptr(83, 115), new foldPair.ptr(107, 8490), new foldPair.ptr(115, 383), new foldPair.ptr(181, 924), new foldPair.ptr(197, 229), new foldPair.ptr(223, 7838), new foldPair.ptr(229, 8491), new foldPair.ptr(304, 304), new foldPair.ptr(305, 305), new foldPair.ptr(383, 83), new foldPair.ptr(452, 453), new foldPair.ptr(453, 454), new foldPair.ptr(454, 452), new foldPair.ptr(455, 456), new foldPair.ptr(456, 457), new foldPair.ptr(457, 455), new foldPair.ptr(458, 459), new foldPair.ptr(459, 460), new foldPair.ptr(460, 458), new foldPair.ptr(497, 498), new foldPair.ptr(498, 499), new foldPair.ptr(499, 497), new foldPair.ptr(837, 921), new foldPair.ptr(914, 946), new foldPair.ptr(917, 949), new foldPair.ptr(920, 952), new foldPair.ptr(921, 953), new foldPair.ptr(922, 954), new foldPair.ptr(924, 956), new foldPair.ptr(928, 960), new foldPair.ptr(929, 961), new foldPair.ptr(931, 962), new foldPair.ptr(934, 966), new foldPair.ptr(937, 969), new foldPair.ptr(946, 976), new foldPair.ptr(949, 1013), new foldPair.ptr(952, 977), new foldPair.ptr(953, 8126), new foldPair.ptr(954, 1008), new foldPair.ptr(956, 181), new foldPair.ptr(960, 982), new foldPair.ptr(961, 1009), new foldPair.ptr(962, 963), new foldPair.ptr(963, 931), new foldPair.ptr(966, 981), new foldPair.ptr(969, 8486), new foldPair.ptr(976, 914), new foldPair.ptr(977, 1012), new foldPair.ptr(981, 934), new foldPair.ptr(982, 928), new foldPair.ptr(1008, 922), new foldPair.ptr(1009, 929), new foldPair.ptr(1012, 920), new foldPair.ptr(1013, 917), new foldPair.ptr(1042, 1074), new foldPair.ptr(1044, 1076), new foldPair.ptr(1054, 1086), new foldPair.ptr(1057, 1089), new foldPair.ptr(1058, 1090), new foldPair.ptr(1066, 1098), new foldPair.ptr(1074, 7296), new foldPair.ptr(1076, 7297), new foldPair.ptr(1086, 7298), new foldPair.ptr(1089, 7299), new foldPair.ptr(1090, 7300), new foldPair.ptr(1098, 7302), new foldPair.ptr(1122, 1123), new foldPair.ptr(1123, 7303), new foldPair.ptr(7296, 1042), new foldPair.ptr(7297, 1044), new foldPair.ptr(7298, 1054), new foldPair.ptr(7299, 1057), new foldPair.ptr(7300, 7301), new foldPair.ptr(7301, 1058), new foldPair.ptr(7302, 1066), new foldPair.ptr(7303, 1122), new foldPair.ptr(7304, 42570), new foldPair.ptr(7776, 7777), new foldPair.ptr(7777, 7835), new foldPair.ptr(7835, 7776), new foldPair.ptr(7838, 223), new foldPair.ptr(8126, 837), new foldPair.ptr(8486, 937), new foldPair.ptr(8490, 75), new foldPair.ptr(8491, 197), new foldPair.ptr(42570, 42571), new foldPair.ptr(42571, 7304)]);
|
|
foldL = new RangeTable.ptr(new sliceType([new Range16.ptr(837, 837, 1)]), sliceType$1.nil, 0);
|
|
foldLl = new RangeTable.ptr(new sliceType([new Range16.ptr(65, 90, 1), new Range16.ptr(192, 214, 1), new Range16.ptr(216, 222, 1), new Range16.ptr(256, 302, 2), new Range16.ptr(306, 310, 2), new Range16.ptr(313, 327, 2), new Range16.ptr(330, 376, 2), new Range16.ptr(377, 381, 2), new Range16.ptr(385, 386, 1), new Range16.ptr(388, 390, 2), new Range16.ptr(391, 393, 2), new Range16.ptr(394, 395, 1), new Range16.ptr(398, 401, 1), new Range16.ptr(403, 404, 1), new Range16.ptr(406, 408, 1), new Range16.ptr(412, 413, 1), new Range16.ptr(415, 416, 1), new Range16.ptr(418, 422, 2), new Range16.ptr(423, 425, 2), new Range16.ptr(428, 430, 2), new Range16.ptr(431, 433, 2), new Range16.ptr(434, 435, 1), new Range16.ptr(437, 439, 2), new Range16.ptr(440, 444, 4), new Range16.ptr(452, 453, 1), new Range16.ptr(455, 456, 1), new Range16.ptr(458, 459, 1), new Range16.ptr(461, 475, 2), new Range16.ptr(478, 494, 2), new Range16.ptr(497, 498, 1), new Range16.ptr(500, 502, 2), new Range16.ptr(503, 504, 1), new Range16.ptr(506, 562, 2), new Range16.ptr(570, 571, 1), new Range16.ptr(573, 574, 1), new Range16.ptr(577, 579, 2), new Range16.ptr(580, 582, 1), new Range16.ptr(584, 590, 2), new Range16.ptr(837, 880, 43), new Range16.ptr(882, 886, 4), new Range16.ptr(895, 902, 7), new Range16.ptr(904, 906, 1), new Range16.ptr(908, 910, 2), new Range16.ptr(911, 913, 2), new Range16.ptr(914, 929, 1), new Range16.ptr(931, 939, 1), new Range16.ptr(975, 984, 9), new Range16.ptr(986, 1006, 2), new Range16.ptr(1012, 1015, 3), new Range16.ptr(1017, 1018, 1), new Range16.ptr(1021, 1071, 1), new Range16.ptr(1120, 1152, 2), new Range16.ptr(1162, 1216, 2), new Range16.ptr(1217, 1229, 2), new Range16.ptr(1232, 1326, 2), new Range16.ptr(1329, 1366, 1), new Range16.ptr(4256, 4293, 1), new Range16.ptr(4295, 4301, 6), new Range16.ptr(5024, 5109, 1), new Range16.ptr(7680, 7828, 2), new Range16.ptr(7838, 7934, 2), new Range16.ptr(7944, 7951, 1), new Range16.ptr(7960, 7965, 1), new Range16.ptr(7976, 7983, 1), new Range16.ptr(7992, 7999, 1), new Range16.ptr(8008, 8013, 1), new Range16.ptr(8025, 8031, 2), new Range16.ptr(8040, 8047, 1), new Range16.ptr(8072, 8079, 1), new Range16.ptr(8088, 8095, 1), new Range16.ptr(8104, 8111, 1), new Range16.ptr(8120, 8124, 1), new Range16.ptr(8136, 8140, 1), new Range16.ptr(8152, 8155, 1), new Range16.ptr(8168, 8172, 1), new Range16.ptr(8184, 8188, 1), new Range16.ptr(8486, 8490, 4), new Range16.ptr(8491, 8498, 7), new Range16.ptr(8579, 11264, 2685), new Range16.ptr(11265, 11310, 1), new Range16.ptr(11360, 11362, 2), new Range16.ptr(11363, 11364, 1), new Range16.ptr(11367, 11373, 2), new Range16.ptr(11374, 11376, 1), new Range16.ptr(11378, 11381, 3), new Range16.ptr(11390, 11392, 1), new Range16.ptr(11394, 11490, 2), new Range16.ptr(11499, 11501, 2), new Range16.ptr(11506, 42560, 31054), new Range16.ptr(42562, 42604, 2), new Range16.ptr(42624, 42650, 2), new Range16.ptr(42786, 42798, 2), new Range16.ptr(42802, 42862, 2), new Range16.ptr(42873, 42877, 2), new Range16.ptr(42878, 42886, 2), new Range16.ptr(42891, 42893, 2), new Range16.ptr(42896, 42898, 2), new Range16.ptr(42902, 42922, 2), new Range16.ptr(42923, 42926, 1), new Range16.ptr(42928, 42932, 1), new Range16.ptr(42934, 65313, 22379), new Range16.ptr(65314, 65338, 1)]), new sliceType$1([new Range32.ptr(66560, 66599, 1), new Range32.ptr(66736, 66771, 1), new Range32.ptr(68736, 68786, 1), new Range32.ptr(71840, 71871, 1), new Range32.ptr(125184, 125217, 1)]), 3);
|
|
foldLt = new RangeTable.ptr(new sliceType([new Range16.ptr(452, 454, 2), new Range16.ptr(455, 457, 2), new Range16.ptr(458, 460, 2), new Range16.ptr(497, 499, 2), new Range16.ptr(8064, 8071, 1), new Range16.ptr(8080, 8087, 1), new Range16.ptr(8096, 8103, 1), new Range16.ptr(8115, 8131, 16), new Range16.ptr(8179, 8179, 1)]), sliceType$1.nil, 0);
|
|
foldLu = new RangeTable.ptr(new sliceType([new Range16.ptr(97, 122, 1), new Range16.ptr(181, 223, 42), new Range16.ptr(224, 246, 1), new Range16.ptr(248, 255, 1), new Range16.ptr(257, 303, 2), new Range16.ptr(307, 311, 2), new Range16.ptr(314, 328, 2), new Range16.ptr(331, 375, 2), new Range16.ptr(378, 382, 2), new Range16.ptr(383, 384, 1), new Range16.ptr(387, 389, 2), new Range16.ptr(392, 396, 4), new Range16.ptr(402, 405, 3), new Range16.ptr(409, 410, 1), new Range16.ptr(414, 417, 3), new Range16.ptr(419, 421, 2), new Range16.ptr(424, 429, 5), new Range16.ptr(432, 436, 4), new Range16.ptr(438, 441, 3), new Range16.ptr(445, 447, 2), new Range16.ptr(453, 454, 1), new Range16.ptr(456, 457, 1), new Range16.ptr(459, 460, 1), new Range16.ptr(462, 476, 2), new Range16.ptr(477, 495, 2), new Range16.ptr(498, 499, 1), new Range16.ptr(501, 505, 4), new Range16.ptr(507, 543, 2), new Range16.ptr(547, 563, 2), new Range16.ptr(572, 575, 3), new Range16.ptr(576, 578, 2), new Range16.ptr(583, 591, 2), new Range16.ptr(592, 596, 1), new Range16.ptr(598, 599, 1), new Range16.ptr(601, 603, 2), new Range16.ptr(604, 608, 4), new Range16.ptr(609, 613, 2), new Range16.ptr(614, 616, 2), new Range16.ptr(617, 620, 1), new Range16.ptr(623, 625, 2), new Range16.ptr(626, 629, 3), new Range16.ptr(637, 643, 3), new Range16.ptr(647, 652, 1), new Range16.ptr(658, 669, 11), new Range16.ptr(670, 837, 167), new Range16.ptr(881, 883, 2), new Range16.ptr(887, 891, 4), new Range16.ptr(892, 893, 1), new Range16.ptr(940, 943, 1), new Range16.ptr(945, 974, 1), new Range16.ptr(976, 977, 1), new Range16.ptr(981, 983, 1), new Range16.ptr(985, 1007, 2), new Range16.ptr(1008, 1011, 1), new Range16.ptr(1013, 1019, 3), new Range16.ptr(1072, 1119, 1), new Range16.ptr(1121, 1153, 2), new Range16.ptr(1163, 1215, 2), new Range16.ptr(1218, 1230, 2), new Range16.ptr(1231, 1327, 2), new Range16.ptr(1377, 1414, 1), new Range16.ptr(5112, 5117, 1), new Range16.ptr(7296, 7304, 1), new Range16.ptr(7545, 7549, 4), new Range16.ptr(7681, 7829, 2), new Range16.ptr(7835, 7841, 6), new Range16.ptr(7843, 7935, 2), new Range16.ptr(7936, 7943, 1), new Range16.ptr(7952, 7957, 1), new Range16.ptr(7968, 7975, 1), new Range16.ptr(7984, 7991, 1), new Range16.ptr(8000, 8005, 1), new Range16.ptr(8017, 8023, 2), new Range16.ptr(8032, 8039, 1), new Range16.ptr(8048, 8061, 1), new Range16.ptr(8112, 8113, 1), new Range16.ptr(8126, 8144, 18), new Range16.ptr(8145, 8160, 15), new Range16.ptr(8161, 8165, 4), new Range16.ptr(8526, 8580, 54), new Range16.ptr(11312, 11358, 1), new Range16.ptr(11361, 11365, 4), new Range16.ptr(11366, 11372, 2), new Range16.ptr(11379, 11382, 3), new Range16.ptr(11393, 11491, 2), new Range16.ptr(11500, 11502, 2), new Range16.ptr(11507, 11520, 13), new Range16.ptr(11521, 11557, 1), new Range16.ptr(11559, 11565, 6), new Range16.ptr(42561, 42605, 2), new Range16.ptr(42625, 42651, 2), new Range16.ptr(42787, 42799, 2), new Range16.ptr(42803, 42863, 2), new Range16.ptr(42874, 42876, 2), new Range16.ptr(42879, 42887, 2), new Range16.ptr(42892, 42897, 5), new Range16.ptr(42899, 42903, 4), new Range16.ptr(42905, 42921, 2), new Range16.ptr(42933, 42935, 2), new Range16.ptr(43859, 43888, 29), new Range16.ptr(43889, 43967, 1), new Range16.ptr(65345, 65370, 1)]), new sliceType$1([new Range32.ptr(66600, 66639, 1), new Range32.ptr(66776, 66811, 1), new Range32.ptr(68800, 68850, 1), new Range32.ptr(71872, 71903, 1), new Range32.ptr(125218, 125251, 1)]), 4);
|
|
foldM = new RangeTable.ptr(new sliceType([new Range16.ptr(921, 953, 32), new Range16.ptr(8126, 8126, 1)]), sliceType$1.nil, 0);
|
|
foldMn = new RangeTable.ptr(new sliceType([new Range16.ptr(921, 953, 32), new Range16.ptr(8126, 8126, 1)]), sliceType$1.nil, 0);
|
|
$pkg.FoldCategory = $makeMap($String.keyFor, [{ k: "L", v: foldL }, { k: "Ll", v: foldLl }, { k: "Lt", v: foldLt }, { k: "Lu", v: foldLu }, { k: "M", v: foldM }, { k: "Mn", v: foldMn }]);
|
|
foldCommon = new RangeTable.ptr(new sliceType([new Range16.ptr(924, 956, 32)]), sliceType$1.nil, 0);
|
|
foldGreek = new RangeTable.ptr(new sliceType([new Range16.ptr(181, 837, 656)]), sliceType$1.nil, 0);
|
|
foldInherited = new RangeTable.ptr(new sliceType([new Range16.ptr(921, 953, 32), new Range16.ptr(8126, 8126, 1)]), sliceType$1.nil, 0);
|
|
$pkg.FoldScript = $makeMap($String.keyFor, [{ k: "Common", v: foldCommon }, { k: "Greek", v: foldGreek }, { k: "Inherited", v: foldInherited }]);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["reflect"] = (function() {
|
|
var $pkg = {}, $init, errors, js, math, runtime, strconv, sync, unicode, utf8, uncommonType, funcType, name, nameData, mapIter, Type, Kind, tflag, rtype, typeAlg, method, ChanDir, arrayType, chanType, imethod, interfaceType, mapType, ptrType, sliceType, structField, structType, Method, nameOff, typeOff, textOff, StructField, StructTag, fieldScan, Value, flag, ValueError, MapIter, sliceType$1, ptrType$1, sliceType$2, sliceType$3, ptrType$2, funcType$1, sliceType$4, ptrType$3, ptrType$4, sliceType$5, sliceType$6, sliceType$7, ptrType$5, ptrType$6, structType$3, sliceType$8, sliceType$9, ptrType$7, ptrType$8, sliceType$10, sliceType$11, ptrType$9, ptrType$10, sliceType$13, sliceType$14, ptrType$11, sliceType$15, ptrType$17, sliceType$18, funcType$3, funcType$4, funcType$5, ptrType$18, arrayType$8, ptrType$19, ptrType$20, initialized, uncommonTypeMap, nameMap, nameOffList, typeOffList, callHelper, jsObjectPtr, selectHelper, kindNames, uint8Type, init, jsType, reflectType, setKindType, newName, newNameOff, newTypeOff, internalStr, isWrapped, copyStruct, makeValue, MakeSlice, TypeOf, ValueOf, FuncOf, SliceOf, Zero, unsafe_New, makeInt, typedmemmove, keyFor, mapaccess, mapassign, mapdelete, mapiterinit, mapiterkey, mapitervalue, mapiternext, maplen, cvtDirect, methodReceiver, valueInterface, ifaceE2I, methodName, makeMethodValue, wrapJsObject, unwrapJsObject, getJsTag, chanrecv, chansend, PtrTo, implements$1, directlyAssignable, haveIdenticalType, haveIdenticalUnderlyingType, toType, ifaceIndir, copyVal, overflowFloat32, Indirect, New, convertOp, makeFloat, makeComplex, makeString, makeBytes, makeRunes, cvtInt, cvtUint, cvtFloatInt, cvtFloatUint, cvtIntFloat, cvtUintFloat, cvtFloat, cvtComplex, cvtIntString, cvtUintString, cvtBytesString, cvtStringBytes, cvtRunesString, cvtStringRunes, cvtT2I, cvtI2I;
|
|
errors = $packages["errors"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
math = $packages["math"];
|
|
runtime = $packages["runtime"];
|
|
strconv = $packages["strconv"];
|
|
sync = $packages["sync"];
|
|
unicode = $packages["unicode"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
uncommonType = $pkg.uncommonType = $newType(0, $kindStruct, "reflect.uncommonType", true, "reflect", false, function(pkgPath_, mcount_, xcount_, moff_, _methods_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.pkgPath = 0;
|
|
this.mcount = 0;
|
|
this.xcount = 0;
|
|
this.moff = 0;
|
|
this._methods = sliceType$5.nil;
|
|
return;
|
|
}
|
|
this.pkgPath = pkgPath_;
|
|
this.mcount = mcount_;
|
|
this.xcount = xcount_;
|
|
this.moff = moff_;
|
|
this._methods = _methods_;
|
|
});
|
|
funcType = $pkg.funcType = $newType(0, $kindStruct, "reflect.funcType", true, "reflect", false, function(rtype_, inCount_, outCount_, _in_, _out_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.inCount = 0;
|
|
this.outCount = 0;
|
|
this._in = sliceType$2.nil;
|
|
this._out = sliceType$2.nil;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.inCount = inCount_;
|
|
this.outCount = outCount_;
|
|
this._in = _in_;
|
|
this._out = _out_;
|
|
});
|
|
name = $pkg.name = $newType(0, $kindStruct, "reflect.name", true, "reflect", false, function(bytes_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.bytes = ptrType$4.nil;
|
|
return;
|
|
}
|
|
this.bytes = bytes_;
|
|
});
|
|
nameData = $pkg.nameData = $newType(0, $kindStruct, "reflect.nameData", true, "reflect", false, function(name_, tag_, exported_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = "";
|
|
this.tag = "";
|
|
this.exported = false;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.tag = tag_;
|
|
this.exported = exported_;
|
|
});
|
|
mapIter = $pkg.mapIter = $newType(0, $kindStruct, "reflect.mapIter", true, "reflect", false, function(t_, m_, keys_, i_, last_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.t = $ifaceNil;
|
|
this.m = null;
|
|
this.keys = null;
|
|
this.i = 0;
|
|
this.last = null;
|
|
return;
|
|
}
|
|
this.t = t_;
|
|
this.m = m_;
|
|
this.keys = keys_;
|
|
this.i = i_;
|
|
this.last = last_;
|
|
});
|
|
Type = $pkg.Type = $newType(8, $kindInterface, "reflect.Type", true, "reflect", true, null);
|
|
Kind = $pkg.Kind = $newType(4, $kindUint, "reflect.Kind", true, "reflect", true, null);
|
|
tflag = $pkg.tflag = $newType(1, $kindUint8, "reflect.tflag", true, "reflect", false, null);
|
|
rtype = $pkg.rtype = $newType(0, $kindStruct, "reflect.rtype", true, "reflect", false, function(size_, ptrdata_, hash_, tflag_, align_, fieldAlign_, kind_, alg_, gcdata_, str_, ptrToThis_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.size = 0;
|
|
this.ptrdata = 0;
|
|
this.hash = 0;
|
|
this.tflag = 0;
|
|
this.align = 0;
|
|
this.fieldAlign = 0;
|
|
this.kind = 0;
|
|
this.alg = ptrType$3.nil;
|
|
this.gcdata = ptrType$4.nil;
|
|
this.str = 0;
|
|
this.ptrToThis = 0;
|
|
return;
|
|
}
|
|
this.size = size_;
|
|
this.ptrdata = ptrdata_;
|
|
this.hash = hash_;
|
|
this.tflag = tflag_;
|
|
this.align = align_;
|
|
this.fieldAlign = fieldAlign_;
|
|
this.kind = kind_;
|
|
this.alg = alg_;
|
|
this.gcdata = gcdata_;
|
|
this.str = str_;
|
|
this.ptrToThis = ptrToThis_;
|
|
});
|
|
typeAlg = $pkg.typeAlg = $newType(0, $kindStruct, "reflect.typeAlg", true, "reflect", false, function(hash_, equal_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.hash = $throwNilPointerError;
|
|
this.equal = $throwNilPointerError;
|
|
return;
|
|
}
|
|
this.hash = hash_;
|
|
this.equal = equal_;
|
|
});
|
|
method = $pkg.method = $newType(0, $kindStruct, "reflect.method", true, "reflect", false, function(name_, mtyp_, ifn_, tfn_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = 0;
|
|
this.mtyp = 0;
|
|
this.ifn = 0;
|
|
this.tfn = 0;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.mtyp = mtyp_;
|
|
this.ifn = ifn_;
|
|
this.tfn = tfn_;
|
|
});
|
|
ChanDir = $pkg.ChanDir = $newType(4, $kindInt, "reflect.ChanDir", true, "reflect", true, null);
|
|
arrayType = $pkg.arrayType = $newType(0, $kindStruct, "reflect.arrayType", true, "reflect", false, function(rtype_, elem_, slice_, len_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.elem = ptrType$1.nil;
|
|
this.slice = ptrType$1.nil;
|
|
this.len = 0;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.elem = elem_;
|
|
this.slice = slice_;
|
|
this.len = len_;
|
|
});
|
|
chanType = $pkg.chanType = $newType(0, $kindStruct, "reflect.chanType", true, "reflect", false, function(rtype_, elem_, dir_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.elem = ptrType$1.nil;
|
|
this.dir = 0;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.elem = elem_;
|
|
this.dir = dir_;
|
|
});
|
|
imethod = $pkg.imethod = $newType(0, $kindStruct, "reflect.imethod", true, "reflect", false, function(name_, typ_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = 0;
|
|
this.typ = 0;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.typ = typ_;
|
|
});
|
|
interfaceType = $pkg.interfaceType = $newType(0, $kindStruct, "reflect.interfaceType", true, "reflect", false, function(rtype_, pkgPath_, methods_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.pkgPath = new name.ptr(ptrType$4.nil);
|
|
this.methods = sliceType$6.nil;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.pkgPath = pkgPath_;
|
|
this.methods = methods_;
|
|
});
|
|
mapType = $pkg.mapType = $newType(0, $kindStruct, "reflect.mapType", true, "reflect", false, function(rtype_, key_, elem_, bucket_, keysize_, valuesize_, bucketsize_, flags_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.key = ptrType$1.nil;
|
|
this.elem = ptrType$1.nil;
|
|
this.bucket = ptrType$1.nil;
|
|
this.keysize = 0;
|
|
this.valuesize = 0;
|
|
this.bucketsize = 0;
|
|
this.flags = 0;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.key = key_;
|
|
this.elem = elem_;
|
|
this.bucket = bucket_;
|
|
this.keysize = keysize_;
|
|
this.valuesize = valuesize_;
|
|
this.bucketsize = bucketsize_;
|
|
this.flags = flags_;
|
|
});
|
|
ptrType = $pkg.ptrType = $newType(0, $kindStruct, "reflect.ptrType", true, "reflect", false, function(rtype_, elem_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.elem = ptrType$1.nil;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.elem = elem_;
|
|
});
|
|
sliceType = $pkg.sliceType = $newType(0, $kindStruct, "reflect.sliceType", true, "reflect", false, function(rtype_, elem_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.elem = ptrType$1.nil;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.elem = elem_;
|
|
});
|
|
structField = $pkg.structField = $newType(0, $kindStruct, "reflect.structField", true, "reflect", false, function(name_, typ_, offsetEmbed_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = new name.ptr(ptrType$4.nil);
|
|
this.typ = ptrType$1.nil;
|
|
this.offsetEmbed = 0;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.typ = typ_;
|
|
this.offsetEmbed = offsetEmbed_;
|
|
});
|
|
structType = $pkg.structType = $newType(0, $kindStruct, "reflect.structType", true, "reflect", false, function(rtype_, pkgPath_, fields_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
this.pkgPath = new name.ptr(ptrType$4.nil);
|
|
this.fields = sliceType$7.nil;
|
|
return;
|
|
}
|
|
this.rtype = rtype_;
|
|
this.pkgPath = pkgPath_;
|
|
this.fields = fields_;
|
|
});
|
|
Method = $pkg.Method = $newType(0, $kindStruct, "reflect.Method", true, "reflect", true, function(Name_, PkgPath_, Type_, Func_, Index_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Name = "";
|
|
this.PkgPath = "";
|
|
this.Type = $ifaceNil;
|
|
this.Func = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
this.Index = 0;
|
|
return;
|
|
}
|
|
this.Name = Name_;
|
|
this.PkgPath = PkgPath_;
|
|
this.Type = Type_;
|
|
this.Func = Func_;
|
|
this.Index = Index_;
|
|
});
|
|
nameOff = $pkg.nameOff = $newType(4, $kindInt32, "reflect.nameOff", true, "reflect", false, null);
|
|
typeOff = $pkg.typeOff = $newType(4, $kindInt32, "reflect.typeOff", true, "reflect", false, null);
|
|
textOff = $pkg.textOff = $newType(4, $kindInt32, "reflect.textOff", true, "reflect", false, null);
|
|
StructField = $pkg.StructField = $newType(0, $kindStruct, "reflect.StructField", true, "reflect", true, function(Name_, PkgPath_, Type_, Tag_, Offset_, Index_, Anonymous_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Name = "";
|
|
this.PkgPath = "";
|
|
this.Type = $ifaceNil;
|
|
this.Tag = "";
|
|
this.Offset = 0;
|
|
this.Index = sliceType$13.nil;
|
|
this.Anonymous = false;
|
|
return;
|
|
}
|
|
this.Name = Name_;
|
|
this.PkgPath = PkgPath_;
|
|
this.Type = Type_;
|
|
this.Tag = Tag_;
|
|
this.Offset = Offset_;
|
|
this.Index = Index_;
|
|
this.Anonymous = Anonymous_;
|
|
});
|
|
StructTag = $pkg.StructTag = $newType(8, $kindString, "reflect.StructTag", true, "reflect", true, null);
|
|
fieldScan = $pkg.fieldScan = $newType(0, $kindStruct, "reflect.fieldScan", true, "reflect", false, function(typ_, index_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.typ = ptrType$11.nil;
|
|
this.index = sliceType$13.nil;
|
|
return;
|
|
}
|
|
this.typ = typ_;
|
|
this.index = index_;
|
|
});
|
|
Value = $pkg.Value = $newType(0, $kindStruct, "reflect.Value", true, "reflect", true, function(typ_, ptr_, flag_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.typ = ptrType$1.nil;
|
|
this.ptr = 0;
|
|
this.flag = 0;
|
|
return;
|
|
}
|
|
this.typ = typ_;
|
|
this.ptr = ptr_;
|
|
this.flag = flag_;
|
|
});
|
|
flag = $pkg.flag = $newType(4, $kindUintptr, "reflect.flag", true, "reflect", false, null);
|
|
ValueError = $pkg.ValueError = $newType(0, $kindStruct, "reflect.ValueError", true, "reflect", true, function(Method_, Kind_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Method = "";
|
|
this.Kind = 0;
|
|
return;
|
|
}
|
|
this.Method = Method_;
|
|
this.Kind = Kind_;
|
|
});
|
|
MapIter = $pkg.MapIter = $newType(0, $kindStruct, "reflect.MapIter", true, "reflect", true, function(m_, it_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.m = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
this.it = 0;
|
|
return;
|
|
}
|
|
this.m = m_;
|
|
this.it = it_;
|
|
});
|
|
sliceType$1 = $sliceType(name);
|
|
ptrType$1 = $ptrType(rtype);
|
|
sliceType$2 = $sliceType(ptrType$1);
|
|
sliceType$3 = $sliceType($emptyInterface);
|
|
ptrType$2 = $ptrType(js.Object);
|
|
funcType$1 = $funcType([sliceType$3], [ptrType$2], true);
|
|
sliceType$4 = $sliceType($String);
|
|
ptrType$3 = $ptrType(typeAlg);
|
|
ptrType$4 = $ptrType($Uint8);
|
|
sliceType$5 = $sliceType(method);
|
|
sliceType$6 = $sliceType(imethod);
|
|
sliceType$7 = $sliceType(structField);
|
|
ptrType$5 = $ptrType(uncommonType);
|
|
ptrType$6 = $ptrType(nameData);
|
|
structType$3 = $structType("reflect", [{prop: "str", name: "str", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
sliceType$8 = $sliceType(ptrType$2);
|
|
sliceType$9 = $sliceType(Value);
|
|
ptrType$7 = $ptrType(mapIter);
|
|
ptrType$8 = $ptrType(funcType);
|
|
sliceType$10 = $sliceType(Type);
|
|
sliceType$11 = $sliceType(sliceType$8);
|
|
ptrType$9 = $ptrType(interfaceType);
|
|
ptrType$10 = $ptrType(imethod);
|
|
sliceType$13 = $sliceType($Int);
|
|
sliceType$14 = $sliceType(fieldScan);
|
|
ptrType$11 = $ptrType(structType);
|
|
sliceType$15 = $sliceType($Uint8);
|
|
ptrType$17 = $ptrType($UnsafePointer);
|
|
sliceType$18 = $sliceType($Int32);
|
|
funcType$3 = $funcType([$String], [$Bool], false);
|
|
funcType$4 = $funcType([$UnsafePointer, $Uintptr], [$Uintptr], false);
|
|
funcType$5 = $funcType([$UnsafePointer, $UnsafePointer], [$Bool], false);
|
|
ptrType$18 = $ptrType(structField);
|
|
arrayType$8 = $arrayType($Uintptr, 2);
|
|
ptrType$19 = $ptrType(MapIter);
|
|
ptrType$20 = $ptrType(ValueError);
|
|
init = function() {
|
|
var used, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; used = $f.used; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
used = (function(i) {
|
|
var i;
|
|
});
|
|
$r = used((x = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new x.constructor.elem(x))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$1 = new uncommonType.ptr(0, 0, 0, 0, sliceType$5.nil), new x$1.constructor.elem(x$1))); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$2 = new method.ptr(0, 0, 0, 0), new x$2.constructor.elem(x$2))); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$3 = new arrayType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, ptrType$1.nil, 0), new x$3.constructor.elem(x$3))); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$4 = new chanType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, 0), new x$4.constructor.elem(x$4))); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$5 = new funcType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), 0, 0, sliceType$2.nil, sliceType$2.nil), new x$5.constructor.elem(x$5))); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$6 = new interfaceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new name.ptr(ptrType$4.nil), sliceType$6.nil), new x$6.constructor.elem(x$6))); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$7 = new mapType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, ptrType$1.nil, ptrType$1.nil, 0, 0, 0, 0), new x$7.constructor.elem(x$7))); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$8 = new ptrType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil), new x$8.constructor.elem(x$8))); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$9 = new sliceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil), new x$9.constructor.elem(x$9))); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$10 = new structType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new name.ptr(ptrType$4.nil), sliceType$7.nil), new x$10.constructor.elem(x$10))); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$11 = new imethod.ptr(0, 0), new x$11.constructor.elem(x$11))); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = used((x$12 = new structField.ptr(new name.ptr(ptrType$4.nil), ptrType$1.nil, 0), new x$12.constructor.elem(x$12))); /* */ $s = 13; case 13: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
initialized = true;
|
|
uint8Type = $assertType(TypeOf(new $Uint8(0)), ptrType$1);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: init }; } $f.used = used; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
jsType = function(typ) {
|
|
var typ;
|
|
return typ.jsType;
|
|
};
|
|
reflectType = function(typ) {
|
|
var _1, _i, _i$1, _i$2, _i$3, _key, _ref, _ref$1, _ref$2, _ref$3, dir, exported, exported$1, f, fields, i, i$1, i$2, i$3, i$4, i$5, imethods, in$1, m, m$1, m$2, methodSet, methods, offsetEmbed, out, outCount, params, reflectFields, reflectMethods, results, rt, typ, ut, xcount;
|
|
if (typ.reflectType === undefined) {
|
|
rt = new rtype.ptr(((($parseInt(typ.size) >> 0) >>> 0)), 0, 0, 0, 0, 0, ((($parseInt(typ.kind) >> 0) << 24 >>> 24)), ptrType$3.nil, ptrType$4.nil, newNameOff($clone(newName(internalStr(typ.string), "", !!(typ.exported)), name)), 0);
|
|
rt.jsType = typ;
|
|
typ.reflectType = rt;
|
|
methodSet = $methodSet(typ);
|
|
if (!(($parseInt(methodSet.length) === 0)) || !!(typ.named)) {
|
|
rt.tflag = (rt.tflag | (1)) >>> 0;
|
|
if (!!(typ.named)) {
|
|
rt.tflag = (rt.tflag | (4)) >>> 0;
|
|
}
|
|
reflectMethods = sliceType$5.nil;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < $parseInt(methodSet.length))) { break; }
|
|
m = methodSet[i];
|
|
exported = internalStr(m.pkg) === "";
|
|
if (!exported) {
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
reflectMethods = $append(reflectMethods, new method.ptr(newNameOff($clone(newName(internalStr(m.name), "", exported), name)), newTypeOff(reflectType(m.typ)), 0, 0));
|
|
i = i + (1) >> 0;
|
|
}
|
|
xcount = ((reflectMethods.$length << 16 >>> 16));
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < $parseInt(methodSet.length))) { break; }
|
|
m$1 = methodSet[i$1];
|
|
exported$1 = internalStr(m$1.pkg) === "";
|
|
if (exported$1) {
|
|
i$1 = i$1 + (1) >> 0;
|
|
continue;
|
|
}
|
|
reflectMethods = $append(reflectMethods, new method.ptr(newNameOff($clone(newName(internalStr(m$1.name), "", exported$1), name)), newTypeOff(reflectType(m$1.typ)), 0, 0));
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
ut = new uncommonType.ptr(newNameOff($clone(newName(internalStr(typ.pkg), "", false), name)), (($parseInt(methodSet.length) << 16 >>> 16)), xcount, 0, reflectMethods);
|
|
_key = rt; (uncommonTypeMap || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: ut };
|
|
ut.jsType = typ;
|
|
}
|
|
_1 = rt.Kind();
|
|
if (_1 === (17)) {
|
|
setKindType(rt, new arrayType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem), ptrType$1.nil, ((($parseInt(typ.len) >> 0) >>> 0))));
|
|
} else if (_1 === (18)) {
|
|
dir = 3;
|
|
if (!!(typ.sendOnly)) {
|
|
dir = 2;
|
|
}
|
|
if (!!(typ.recvOnly)) {
|
|
dir = 1;
|
|
}
|
|
setKindType(rt, new chanType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem), ((dir >>> 0))));
|
|
} else if (_1 === (19)) {
|
|
params = typ.params;
|
|
in$1 = $makeSlice(sliceType$2, $parseInt(params.length));
|
|
_ref = in$1;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i$2 = _i;
|
|
((i$2 < 0 || i$2 >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + i$2] = reflectType(params[i$2]));
|
|
_i++;
|
|
}
|
|
results = typ.results;
|
|
out = $makeSlice(sliceType$2, $parseInt(results.length));
|
|
_ref$1 = out;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$3 = _i$1;
|
|
((i$3 < 0 || i$3 >= out.$length) ? ($throwRuntimeError("index out of range"), undefined) : out.$array[out.$offset + i$3] = reflectType(results[i$3]));
|
|
_i$1++;
|
|
}
|
|
outCount = (($parseInt(results.length) << 16 >>> 16));
|
|
if (!!(typ.variadic)) {
|
|
outCount = (outCount | (32768)) >>> 0;
|
|
}
|
|
setKindType(rt, new funcType.ptr($clone(rt, rtype), (($parseInt(params.length) << 16 >>> 16)), outCount, in$1, out));
|
|
} else if (_1 === (20)) {
|
|
methods = typ.methods;
|
|
imethods = $makeSlice(sliceType$6, $parseInt(methods.length));
|
|
_ref$2 = imethods;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
i$4 = _i$2;
|
|
m$2 = methods[i$4];
|
|
imethod.copy(((i$4 < 0 || i$4 >= imethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : imethods.$array[imethods.$offset + i$4]), new imethod.ptr(newNameOff($clone(newName(internalStr(m$2.name), "", internalStr(m$2.pkg) === ""), name)), newTypeOff(reflectType(m$2.typ))));
|
|
_i$2++;
|
|
}
|
|
setKindType(rt, new interfaceType.ptr($clone(rt, rtype), $clone(newName(internalStr(typ.pkg), "", false), name), imethods));
|
|
} else if (_1 === (21)) {
|
|
setKindType(rt, new mapType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.key), reflectType(typ.elem), ptrType$1.nil, 0, 0, 0, 0));
|
|
} else if (_1 === (22)) {
|
|
setKindType(rt, new ptrType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem)));
|
|
} else if (_1 === (23)) {
|
|
setKindType(rt, new sliceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem)));
|
|
} else if (_1 === (25)) {
|
|
fields = typ.fields;
|
|
reflectFields = $makeSlice(sliceType$7, $parseInt(fields.length));
|
|
_ref$3 = reflectFields;
|
|
_i$3 = 0;
|
|
while (true) {
|
|
if (!(_i$3 < _ref$3.$length)) { break; }
|
|
i$5 = _i$3;
|
|
f = fields[i$5];
|
|
offsetEmbed = ((i$5 >>> 0)) << 1 >>> 0;
|
|
if (!!(f.embedded)) {
|
|
offsetEmbed = (offsetEmbed | (1)) >>> 0;
|
|
}
|
|
structField.copy(((i$5 < 0 || i$5 >= reflectFields.$length) ? ($throwRuntimeError("index out of range"), undefined) : reflectFields.$array[reflectFields.$offset + i$5]), new structField.ptr($clone(newName(internalStr(f.name), internalStr(f.tag), !!(f.exported)), name), reflectType(f.typ), offsetEmbed));
|
|
_i$3++;
|
|
}
|
|
setKindType(rt, new structType.ptr($clone(rt, rtype), $clone(newName(internalStr(typ.pkgPath), "", false), name), reflectFields));
|
|
}
|
|
}
|
|
return ((typ.reflectType));
|
|
};
|
|
setKindType = function(rt, kindType) {
|
|
var kindType, rt;
|
|
rt.kindType = kindType;
|
|
kindType.rtype = rt;
|
|
};
|
|
uncommonType.ptr.prototype.methods = function() {
|
|
var t;
|
|
t = this;
|
|
return t._methods;
|
|
};
|
|
uncommonType.prototype.methods = function() { return this.$val.methods(); };
|
|
uncommonType.ptr.prototype.exportedMethods = function() {
|
|
var t;
|
|
t = this;
|
|
return $subslice(t._methods, 0, t.xcount, t.xcount);
|
|
};
|
|
uncommonType.prototype.exportedMethods = function() { return this.$val.exportedMethods(); };
|
|
rtype.ptr.prototype.uncommon = function() {
|
|
var _entry, t;
|
|
t = this;
|
|
return (_entry = uncommonTypeMap[ptrType$1.keyFor(t)], _entry !== undefined ? _entry.v : ptrType$5.nil);
|
|
};
|
|
rtype.prototype.uncommon = function() { return this.$val.uncommon(); };
|
|
funcType.ptr.prototype.in$ = function() {
|
|
var t;
|
|
t = this;
|
|
return t._in;
|
|
};
|
|
funcType.prototype.in$ = function() { return this.$val.in$(); };
|
|
funcType.ptr.prototype.out = function() {
|
|
var t;
|
|
t = this;
|
|
return t._out;
|
|
};
|
|
funcType.prototype.out = function() { return this.$val.out(); };
|
|
name.ptr.prototype.name = function() {
|
|
var _entry, n, s;
|
|
s = "";
|
|
n = this;
|
|
s = (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).name;
|
|
return s;
|
|
};
|
|
name.prototype.name = function() { return this.$val.name(); };
|
|
name.ptr.prototype.tag = function() {
|
|
var _entry, n, s;
|
|
s = "";
|
|
n = this;
|
|
s = (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).tag;
|
|
return s;
|
|
};
|
|
name.prototype.tag = function() { return this.$val.tag(); };
|
|
name.ptr.prototype.pkgPath = function() {
|
|
var n;
|
|
n = this;
|
|
return "";
|
|
};
|
|
name.prototype.pkgPath = function() { return this.$val.pkgPath(); };
|
|
name.ptr.prototype.isExported = function() {
|
|
var _entry, n;
|
|
n = this;
|
|
return (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).exported;
|
|
};
|
|
name.prototype.isExported = function() { return this.$val.isExported(); };
|
|
newName = function(n, tag, exported) {
|
|
var _key, b, exported, n, tag;
|
|
b = $newDataPointer(0, ptrType$4);
|
|
_key = b; (nameMap || $throwRuntimeError("assignment to entry in nil map"))[ptrType$4.keyFor(_key)] = { k: _key, v: new nameData.ptr(n, tag, exported) };
|
|
return new name.ptr(b);
|
|
};
|
|
rtype.ptr.prototype.nameOff = function(off) {
|
|
var off, t, x;
|
|
t = this;
|
|
return (x = ((off >> 0)), ((x < 0 || x >= nameOffList.$length) ? ($throwRuntimeError("index out of range"), undefined) : nameOffList.$array[nameOffList.$offset + x]));
|
|
};
|
|
rtype.prototype.nameOff = function(off) { return this.$val.nameOff(off); };
|
|
newNameOff = function(n) {
|
|
var i, n;
|
|
i = nameOffList.$length;
|
|
nameOffList = $append(nameOffList, n);
|
|
return ((i >> 0));
|
|
};
|
|
rtype.ptr.prototype.typeOff = function(off) {
|
|
var off, t, x;
|
|
t = this;
|
|
return (x = ((off >> 0)), ((x < 0 || x >= typeOffList.$length) ? ($throwRuntimeError("index out of range"), undefined) : typeOffList.$array[typeOffList.$offset + x]));
|
|
};
|
|
rtype.prototype.typeOff = function(off) { return this.$val.typeOff(off); };
|
|
newTypeOff = function(t) {
|
|
var i, t;
|
|
i = typeOffList.$length;
|
|
typeOffList = $append(typeOffList, t);
|
|
return ((i >> 0));
|
|
};
|
|
internalStr = function(strObj) {
|
|
var c, strObj;
|
|
c = new structType$3.ptr("");
|
|
c.str = strObj;
|
|
return c.str;
|
|
};
|
|
isWrapped = function(typ) {
|
|
var typ;
|
|
return !!(jsType(typ).wrapped);
|
|
};
|
|
copyStruct = function(dst, src, typ) {
|
|
var dst, fields, i, prop, src, typ;
|
|
fields = jsType(typ).fields;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < $parseInt(fields.length))) { break; }
|
|
prop = $internalize(fields[i].prop, $String);
|
|
dst[$externalize(prop, $String)] = src[$externalize(prop, $String)];
|
|
i = i + (1) >> 0;
|
|
}
|
|
};
|
|
makeValue = function(t, v, fl) {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, _r$5, _v, _v$1, fl, rt, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _v = $f._v; _v$1 = $f._v$1; fl = $f.fl; rt = $f.rt; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
rt = _r;
|
|
_r$1 = t.Kind(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
if (_r$1 === 17) { _v$1 = true; $s = 5; continue s; }
|
|
_r$2 = t.Kind(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v$1 = _r$2 === 25; case 5:
|
|
if (_v$1) { _v = true; $s = 4; continue s; }
|
|
_r$3 = t.Kind(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_v = _r$3 === 22; case 4:
|
|
/* */ if (_v) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (_v) { */ case 2:
|
|
_r$4 = t.Kind(); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$s = -1; return new Value.ptr(rt, (v), (fl | ((_r$4 >>> 0))) >>> 0);
|
|
/* } */ case 3:
|
|
_r$5 = t.Kind(); /* */ $s = 10; case 10: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$s = -1; return new Value.ptr(rt, ($newDataPointer(v, jsType(rt.ptrTo()))), (((fl | ((_r$5 >>> 0))) >>> 0) | 128) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeValue }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._v = _v; $f._v$1 = _v$1; $f.fl = fl; $f.rt = rt; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
MakeSlice = function(typ, len, cap) {
|
|
var _r, _r$1, cap, len, typ, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; cap = $f.cap; len = $f.len; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
typ = [typ];
|
|
_r = typ[0].Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 23))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 23))) { */ case 1:
|
|
$panic(new $String("reflect.MakeSlice of non-slice type"));
|
|
/* } */ case 2:
|
|
if (len < 0) {
|
|
$panic(new $String("reflect.MakeSlice: negative len"));
|
|
}
|
|
if (cap < 0) {
|
|
$panic(new $String("reflect.MakeSlice: negative cap"));
|
|
}
|
|
if (len > cap) {
|
|
$panic(new $String("reflect.MakeSlice: len > cap"));
|
|
}
|
|
_r$1 = makeValue(typ[0], $makeSlice(jsType(typ[0]), len, cap, (function(typ) { return function $b() {
|
|
var _r$1, _r$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$1 = typ[0].Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = jsType(_r$1); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2.zero();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(typ)), 0); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: MakeSlice }; } $f._r = _r; $f._r$1 = _r$1; $f.cap = cap; $f.len = len; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.MakeSlice = MakeSlice;
|
|
TypeOf = function(i) {
|
|
var i;
|
|
if (!initialized) {
|
|
return new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
|
|
}
|
|
if ($interfaceIsEqual(i, $ifaceNil)) {
|
|
return $ifaceNil;
|
|
}
|
|
return reflectType(i.constructor);
|
|
};
|
|
$pkg.TypeOf = TypeOf;
|
|
ValueOf = function(i) {
|
|
var _r, i, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if ($interfaceIsEqual(i, $ifaceNil)) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
_r = makeValue(reflectType(i.constructor), i.$val, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ValueOf }; } $f._r = _r; $f.i = i; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.ValueOf = ValueOf;
|
|
FuncOf = function(in$1, out, variadic) {
|
|
var _i, _i$1, _r, _ref, _ref$1, _v, _v$1, i, i$1, in$1, jsIn, jsOut, out, v, v$1, variadic, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _ref = $f._ref; _ref$1 = $f._ref$1; _v = $f._v; _v$1 = $f._v$1; i = $f.i; i$1 = $f.i$1; in$1 = $f.in$1; jsIn = $f.jsIn; jsOut = $f.jsOut; out = $f.out; v = $f.v; v$1 = $f.v$1; variadic = $f.variadic; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (!(variadic)) { _v = false; $s = 3; continue s; }
|
|
if (in$1.$length === 0) { _v$1 = true; $s = 4; continue s; }
|
|
_r = (x = in$1.$length - 1 >> 0, ((x < 0 || x >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + x])).Kind(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v$1 = !((_r === 23)); case 4:
|
|
_v = _v$1; case 3:
|
|
/* */ if (_v) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_v) { */ case 1:
|
|
$panic(new $String("reflect.FuncOf: last arg of variadic func must be slice"));
|
|
/* } */ case 2:
|
|
jsIn = $makeSlice(sliceType$8, in$1.$length);
|
|
_ref = in$1;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
v = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
((i < 0 || i >= jsIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : jsIn.$array[jsIn.$offset + i] = jsType(v));
|
|
_i++;
|
|
}
|
|
jsOut = $makeSlice(sliceType$8, out.$length);
|
|
_ref$1 = out;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
v$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
((i$1 < 0 || i$1 >= jsOut.$length) ? ($throwRuntimeError("index out of range"), undefined) : jsOut.$array[jsOut.$offset + i$1] = jsType(v$1));
|
|
_i$1++;
|
|
}
|
|
$s = -1; return reflectType($funcType($externalize(jsIn, sliceType$8), $externalize(jsOut, sliceType$8), $externalize(variadic, $Bool)));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FuncOf }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._ref = _ref; $f._ref$1 = _ref$1; $f._v = _v; $f._v$1 = _v$1; $f.i = i; $f.i$1 = i$1; $f.in$1 = in$1; $f.jsIn = jsIn; $f.jsOut = jsOut; $f.out = out; $f.v = v; $f.v$1 = v$1; $f.variadic = variadic; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.FuncOf = FuncOf;
|
|
rtype.ptr.prototype.ptrTo = function() {
|
|
var t;
|
|
t = this;
|
|
return reflectType($ptrType(jsType(t)));
|
|
};
|
|
rtype.prototype.ptrTo = function() { return this.$val.ptrTo(); };
|
|
SliceOf = function(t) {
|
|
var t;
|
|
return reflectType($sliceType(jsType(t)));
|
|
};
|
|
$pkg.SliceOf = SliceOf;
|
|
Zero = function(typ) {
|
|
var _r, typ, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeValue(typ, jsType(typ).zero(), 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Zero }; } $f._r = _r; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Zero = Zero;
|
|
unsafe_New = function(typ) {
|
|
var _1, typ;
|
|
_1 = typ.Kind();
|
|
if (_1 === (25)) {
|
|
return (new (jsType(typ).ptr)());
|
|
} else if (_1 === (17)) {
|
|
return (jsType(typ).zero());
|
|
} else {
|
|
return ($newDataPointer(jsType(typ).zero(), jsType(typ.ptrTo())));
|
|
}
|
|
};
|
|
makeInt = function(f, bits, t) {
|
|
var _1, _r, bits, f, ptr, t, typ, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; bits = $f.bits; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
typ = _r;
|
|
ptr = unsafe_New(typ);
|
|
_1 = typ.Kind();
|
|
if (_1 === (3)) {
|
|
(ptr).$set(((bits.$low << 24 >> 24)));
|
|
} else if (_1 === (4)) {
|
|
(ptr).$set(((bits.$low << 16 >> 16)));
|
|
} else if ((_1 === (2)) || (_1 === (5))) {
|
|
(ptr).$set(((bits.$low >> 0)));
|
|
} else if (_1 === (6)) {
|
|
(ptr).$set((new $Int64(bits.$high, bits.$low)));
|
|
} else if (_1 === (8)) {
|
|
(ptr).$set(((bits.$low << 24 >>> 24)));
|
|
} else if (_1 === (9)) {
|
|
(ptr).$set(((bits.$low << 16 >>> 16)));
|
|
} else if ((_1 === (7)) || (_1 === (10)) || (_1 === (12))) {
|
|
(ptr).$set(((bits.$low >>> 0)));
|
|
} else if (_1 === (11)) {
|
|
(ptr).$set((bits));
|
|
}
|
|
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeInt }; } $f._1 = _1; $f._r = _r; $f.bits = bits; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
typedmemmove = function(t, dst, src) {
|
|
var dst, src, t;
|
|
dst.$set(src.$get());
|
|
};
|
|
keyFor = function(t, key) {
|
|
var k, key, kv, t;
|
|
kv = key;
|
|
if (!(kv.$get === undefined)) {
|
|
kv = kv.$get();
|
|
}
|
|
k = $internalize(jsType(t.Key()).keyFor(kv), $String);
|
|
return [kv, k];
|
|
};
|
|
mapaccess = function(t, m, key) {
|
|
var _tuple, entry, k, key, m, t;
|
|
_tuple = keyFor(t, key);
|
|
k = _tuple[1];
|
|
entry = m[$externalize(k, $String)];
|
|
if (entry === undefined) {
|
|
return 0;
|
|
}
|
|
return ($newDataPointer(entry.v, jsType(PtrTo(t.Elem()))));
|
|
};
|
|
mapassign = function(t, m, key, val) {
|
|
var _r, _tuple, entry, et, jsVal, k, key, kv, m, newVal, t, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; entry = $f.entry; et = $f.et; jsVal = $f.jsVal; k = $f.k; key = $f.key; kv = $f.kv; m = $f.m; newVal = $f.newVal; t = $f.t; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tuple = keyFor(t, key);
|
|
kv = _tuple[0];
|
|
k = _tuple[1];
|
|
jsVal = val.$get();
|
|
et = t.Elem();
|
|
_r = et.Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r === 25) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r === 25) { */ case 1:
|
|
newVal = jsType(et).zero();
|
|
copyStruct(newVal, jsVal, et);
|
|
jsVal = newVal;
|
|
/* } */ case 2:
|
|
entry = new ($global.Object)();
|
|
entry.k = kv;
|
|
entry.v = jsVal;
|
|
m[$externalize(k, $String)] = entry;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: mapassign }; } $f._r = _r; $f._tuple = _tuple; $f.entry = entry; $f.et = et; $f.jsVal = jsVal; $f.k = k; $f.key = key; $f.kv = kv; $f.m = m; $f.newVal = newVal; $f.t = t; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
mapdelete = function(t, m, key) {
|
|
var _tuple, k, key, m, t;
|
|
_tuple = keyFor(t, key);
|
|
k = _tuple[1];
|
|
delete m[$externalize(k, $String)];
|
|
};
|
|
mapIter.ptr.prototype.skipUntilValidKey = function() {
|
|
var iter, k;
|
|
iter = this;
|
|
while (true) {
|
|
if (!(iter.i < $parseInt(iter.keys.length))) { break; }
|
|
k = iter.keys[iter.i];
|
|
if (!(iter.m[$externalize($internalize(k, $String), $String)] === undefined)) {
|
|
break;
|
|
}
|
|
iter.i = iter.i + (1) >> 0;
|
|
}
|
|
};
|
|
mapIter.prototype.skipUntilValidKey = function() { return this.$val.skipUntilValidKey(); };
|
|
mapiterinit = function(t, m) {
|
|
var m, t;
|
|
return (new mapIter.ptr(t, m, $keys(m), 0, null));
|
|
};
|
|
mapiterkey = function(it) {
|
|
var _r, _r$1, _r$2, it, iter, k, kv, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; it = $f.it; iter = $f.iter; k = $f.k; kv = $f.kv; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
iter = ($pointerOfStructConversion(it, ptrType$7));
|
|
kv = null;
|
|
if (!(iter.last === null)) {
|
|
kv = iter.last;
|
|
} else {
|
|
iter.skipUntilValidKey();
|
|
if (iter.i === $parseInt(iter.keys.length)) {
|
|
$s = -1; return 0;
|
|
}
|
|
k = iter.keys[iter.i];
|
|
kv = iter.m[$externalize($internalize(k, $String), $String)];
|
|
iter.last = kv;
|
|
}
|
|
_r = iter.t.Key(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = PtrTo(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = jsType(_r$1); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return ($newDataPointer(kv.k, _r$2));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: mapiterkey }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.it = it; $f.iter = iter; $f.k = k; $f.kv = kv; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
mapitervalue = function(it) {
|
|
var _r, _r$1, _r$2, it, iter, k, kv, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; it = $f.it; iter = $f.iter; k = $f.k; kv = $f.kv; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
iter = ($pointerOfStructConversion(it, ptrType$7));
|
|
kv = null;
|
|
if (!(iter.last === null)) {
|
|
kv = iter.last;
|
|
} else {
|
|
iter.skipUntilValidKey();
|
|
if (iter.i === $parseInt(iter.keys.length)) {
|
|
$s = -1; return 0;
|
|
}
|
|
k = iter.keys[iter.i];
|
|
kv = iter.m[$externalize($internalize(k, $String), $String)];
|
|
iter.last = kv;
|
|
}
|
|
_r = iter.t.Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = PtrTo(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = jsType(_r$1); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return ($newDataPointer(kv.v, _r$2));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: mapitervalue }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.it = it; $f.iter = iter; $f.k = k; $f.kv = kv; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
mapiternext = function(it) {
|
|
var it, iter;
|
|
iter = ($pointerOfStructConversion(it, ptrType$7));
|
|
iter.last = null;
|
|
iter.i = iter.i + (1) >> 0;
|
|
};
|
|
maplen = function(m) {
|
|
var m;
|
|
return $parseInt($keys(m).length);
|
|
};
|
|
cvtDirect = function(v, typ) {
|
|
var _1, _arg, _arg$1, _arg$2, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, k, slice, srcVal, typ, v, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; k = $f.k; slice = $f.slice; srcVal = $f.srcVal; typ = $f.typ; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
srcVal = $clone(v, Value).object();
|
|
/* */ if (srcVal === jsType(v.typ).nil) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (srcVal === jsType(v.typ).nil) { */ case 1:
|
|
_r = makeValue(typ, jsType(typ).nil, v.flag); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
val = null;
|
|
_r$1 = typ.Kind(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
k = _r$1;
|
|
_1 = k;
|
|
/* */ if (_1 === (23)) { $s = 6; continue; }
|
|
/* */ if (_1 === (22)) { $s = 7; continue; }
|
|
/* */ if (_1 === (25)) { $s = 8; continue; }
|
|
/* */ if ((_1 === (17)) || (_1 === (1)) || (_1 === (18)) || (_1 === (19)) || (_1 === (20)) || (_1 === (21)) || (_1 === (24))) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_1 === (23)) { */ case 6:
|
|
slice = new (jsType(typ))(srcVal.$array);
|
|
slice.$offset = srcVal.$offset;
|
|
slice.$length = srcVal.$length;
|
|
slice.$capacity = srcVal.$capacity;
|
|
val = $newDataPointer(slice, jsType(PtrTo(typ)));
|
|
$s = 11; continue;
|
|
/* } else if (_1 === (22)) { */ case 7:
|
|
_r$2 = typ.Elem(); /* */ $s = 14; case 14: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$3 = _r$2.Kind(); /* */ $s = 15; case 15: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (_r$3 === 25) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (_r$3 === 25) { */ case 12:
|
|
_r$4 = typ.Elem(); /* */ $s = 18; case 18: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
/* */ if ($interfaceIsEqual(_r$4, v.typ.Elem())) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if ($interfaceIsEqual(_r$4, v.typ.Elem())) { */ case 16:
|
|
val = srcVal;
|
|
/* break; */ $s = 4; continue;
|
|
/* } */ case 17:
|
|
val = new (jsType(typ))();
|
|
_arg = val;
|
|
_arg$1 = srcVal;
|
|
_r$5 = typ.Elem(); /* */ $s = 19; case 19: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$5;
|
|
$r = copyStruct(_arg, _arg$1, _arg$2); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* break; */ $s = 4; continue;
|
|
/* } */ case 13:
|
|
val = new (jsType(typ))(srcVal.$get, srcVal.$set);
|
|
$s = 11; continue;
|
|
/* } else if (_1 === (25)) { */ case 8:
|
|
val = new (jsType(typ).ptr)();
|
|
copyStruct(val, srcVal, typ);
|
|
$s = 11; continue;
|
|
/* } else if ((_1 === (17)) || (_1 === (1)) || (_1 === (18)) || (_1 === (19)) || (_1 === (20)) || (_1 === (21)) || (_1 === (24))) { */ case 9:
|
|
val = v.ptr;
|
|
$s = 11; continue;
|
|
/* } else { */ case 10:
|
|
$panic(new ValueError.ptr("reflect.Convert", k));
|
|
/* } */ case 11:
|
|
case 4:
|
|
_r$6 = typ.common(); /* */ $s = 21; case 21: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$7 = typ.Kind(); /* */ $s = 22; case 22: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$s = -1; return new Value.ptr(_r$6, (val), (((new flag(v.flag).ro() | ((v.flag & 128) >>> 0)) >>> 0) | ((_r$7 >>> 0))) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtDirect }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f.k = k; $f.slice = slice; $f.srcVal = srcVal; $f.typ = typ; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
methodReceiver = function(op, v, i) {
|
|
var _$39, fn, i, m, m$1, ms, op, prop, rcvr, t, tt, v, x;
|
|
_$39 = ptrType$1.nil;
|
|
t = ptrType$8.nil;
|
|
fn = 0;
|
|
prop = "";
|
|
if (v.typ.Kind() === 20) {
|
|
tt = (v.typ.kindType);
|
|
if (i < 0 || i >= tt.methods.$length) {
|
|
$panic(new $String("reflect: internal error: invalid method index"));
|
|
}
|
|
m = (x = tt.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
if (!$clone(tt.rtype.nameOff(m.name), name).isExported()) {
|
|
$panic(new $String("reflect: " + op + " of unexported method"));
|
|
}
|
|
t = (tt.rtype.typeOff(m.typ).kindType);
|
|
prop = $clone(tt.rtype.nameOff(m.name), name).name();
|
|
} else {
|
|
ms = v.typ.exportedMethods();
|
|
if (((i >>> 0)) >= ((ms.$length >>> 0))) {
|
|
$panic(new $String("reflect: internal error: invalid method index"));
|
|
}
|
|
m$1 = $clone(((i < 0 || i >= ms.$length) ? ($throwRuntimeError("index out of range"), undefined) : ms.$array[ms.$offset + i]), method);
|
|
if (!$clone(v.typ.nameOff(m$1.name), name).isExported()) {
|
|
$panic(new $String("reflect: " + op + " of unexported method"));
|
|
}
|
|
t = (v.typ.typeOff(m$1.mtyp).kindType);
|
|
prop = $internalize($methodSet(jsType(v.typ))[i].prop, $String);
|
|
}
|
|
rcvr = $clone(v, Value).object();
|
|
if (isWrapped(v.typ)) {
|
|
rcvr = new (jsType(v.typ))(rcvr);
|
|
}
|
|
fn = (rcvr[$externalize(prop, $String)]);
|
|
return [_$39, t, fn];
|
|
};
|
|
valueInterface = function(v, safe) {
|
|
var _r, safe, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; safe = $f.safe; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (v.flag === 0) {
|
|
$panic(new ValueError.ptr("reflect.Value.Interface", 0));
|
|
}
|
|
if (safe && !((((v.flag & 96) >>> 0) === 0))) {
|
|
$panic(new $String("reflect.Value.Interface: cannot return value obtained from unexported field or method"));
|
|
}
|
|
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
|
|
_r = makeMethodValue("Interface", $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
/* } */ case 2:
|
|
if (isWrapped(v.typ)) {
|
|
$s = -1; return ((new (jsType(v.typ))($clone(v, Value).object())));
|
|
}
|
|
$s = -1; return (($clone(v, Value).object()));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: valueInterface }; } $f._r = _r; $f.safe = safe; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ifaceE2I = function(t, src, dst) {
|
|
var dst, src, t;
|
|
dst.$set(src);
|
|
};
|
|
methodName = function() {
|
|
return "?FIXME?";
|
|
};
|
|
makeMethodValue = function(op, v) {
|
|
var _r, _tuple, fn, fv, op, rcvr, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; fn = $f.fn; fv = $f.fv; op = $f.op; rcvr = $f.rcvr; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fn = [fn];
|
|
rcvr = [rcvr];
|
|
if (((v.flag & 512) >>> 0) === 0) {
|
|
$panic(new $String("reflect: internal error: invalid use of makePartialFunc"));
|
|
}
|
|
_tuple = methodReceiver(op, $clone(v, Value), ((v.flag >> 0)) >> 10 >> 0);
|
|
fn[0] = _tuple[2];
|
|
rcvr[0] = $clone(v, Value).object();
|
|
if (isWrapped(v.typ)) {
|
|
rcvr[0] = new (jsType(v.typ))(rcvr[0]);
|
|
}
|
|
fv = js.MakeFunc((function(fn, rcvr) { return function(this$1, arguments$1) {
|
|
var arguments$1, this$1;
|
|
return new $jsObjectPtr(fn[0].apply(rcvr[0], $externalize(arguments$1, sliceType$8)));
|
|
}; })(fn, rcvr));
|
|
_r = $clone(v, Value).Type().common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return new Value.ptr(_r, (fv), (new flag(v.flag).ro() | 19) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeMethodValue }; } $f._r = _r; $f._tuple = _tuple; $f.fn = fn; $f.fv = fv; $f.op = op; $f.rcvr = rcvr; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.ptr.prototype.pointers = function() {
|
|
var _1, t;
|
|
t = this;
|
|
_1 = t.Kind();
|
|
if ((_1 === (22)) || (_1 === (21)) || (_1 === (18)) || (_1 === (19)) || (_1 === (25)) || (_1 === (17))) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
};
|
|
rtype.prototype.pointers = function() { return this.$val.pointers(); };
|
|
rtype.ptr.prototype.Comparable = function() {
|
|
var _1, _r, _r$1, i, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; i = $f.i; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_1 = t.Kind();
|
|
/* */ if ((_1 === (19)) || (_1 === (23)) || (_1 === (21))) { $s = 2; continue; }
|
|
/* */ if (_1 === (17)) { $s = 3; continue; }
|
|
/* */ if (_1 === (25)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ((_1 === (19)) || (_1 === (23)) || (_1 === (21))) { */ case 2:
|
|
$s = -1; return false;
|
|
/* } else if (_1 === (17)) { */ case 3:
|
|
_r = t.Elem().Comparable(); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } else if (_1 === (25)) { */ case 4:
|
|
i = 0;
|
|
/* while (true) { */ case 7:
|
|
/* if (!(i < t.NumField())) { break; } */ if(!(i < t.NumField())) { $s = 8; continue; }
|
|
_r$1 = t.Field(i).Type.Comparable(); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!_r$1) { */ case 9:
|
|
$s = -1; return false;
|
|
/* } */ case 10:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 7; continue; case 8:
|
|
/* } */ case 5:
|
|
case 1:
|
|
$s = -1; return true;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Comparable }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.Comparable = function() { return this.$val.Comparable(); };
|
|
rtype.ptr.prototype.Method = function(i) {
|
|
var _i, _i$1, _r, _ref, _ref$1, arg, fl, fn, ft, i, in$1, m, methods, mt, mtyp, out, p, pname, prop, ret, t, tt, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _ref = $f._ref; _ref$1 = $f._ref$1; arg = $f.arg; fl = $f.fl; fn = $f.fn; ft = $f.ft; i = $f.i; in$1 = $f.in$1; m = $f.m; methods = $f.methods; mt = $f.mt; mtyp = $f.mtyp; out = $f.out; p = $f.p; pname = $f.pname; prop = $f.prop; ret = $f.ret; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
prop = [prop];
|
|
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
t = this;
|
|
if (t.Kind() === 20) {
|
|
tt = (t.kindType);
|
|
Method.copy(m, tt.Method(i));
|
|
$s = -1; return m;
|
|
}
|
|
methods = t.exportedMethods();
|
|
if (i < 0 || i >= methods.$length) {
|
|
$panic(new $String("reflect: Method index out of range"));
|
|
}
|
|
p = $clone(((i < 0 || i >= methods.$length) ? ($throwRuntimeError("index out of range"), undefined) : methods.$array[methods.$offset + i]), method);
|
|
pname = $clone(t.nameOff(p.name), name);
|
|
m.Name = $clone(pname, name).name();
|
|
fl = 19;
|
|
mtyp = t.typeOff(p.mtyp);
|
|
ft = (mtyp.kindType);
|
|
in$1 = $makeSlice(sliceType$10, 0, (1 + ft.in$().$length >> 0));
|
|
in$1 = $append(in$1, t);
|
|
_ref = ft.in$();
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
arg = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
in$1 = $append(in$1, arg);
|
|
_i++;
|
|
}
|
|
out = $makeSlice(sliceType$10, 0, ft.out().$length);
|
|
_ref$1 = ft.out();
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
ret = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
out = $append(out, ret);
|
|
_i$1++;
|
|
}
|
|
_r = FuncOf(in$1, out, ft.rtype.IsVariadic()); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
mt = _r;
|
|
m.Type = mt;
|
|
prop[0] = $internalize($methodSet(t.jsType)[i].prop, $String);
|
|
fn = js.MakeFunc((function(prop) { return function(this$1, arguments$1) {
|
|
var arguments$1, rcvr, this$1;
|
|
rcvr = (0 >= arguments$1.$length ? ($throwRuntimeError("index out of range"), undefined) : arguments$1.$array[arguments$1.$offset + 0]);
|
|
return new $jsObjectPtr(rcvr[$externalize(prop[0], $String)].apply(rcvr, $externalize($subslice(arguments$1, 1), sliceType$8)));
|
|
}; })(prop));
|
|
m.Func = new Value.ptr($assertType(mt, ptrType$1), (fn), fl);
|
|
m.Index = i;
|
|
Method.copy(m, m);
|
|
$s = -1; return m;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Method }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._ref = _ref; $f._ref$1 = _ref$1; $f.arg = arg; $f.fl = fl; $f.fn = fn; $f.ft = ft; $f.i = i; $f.in$1 = in$1; $f.m = m; $f.methods = methods; $f.mt = mt; $f.mtyp = mtyp; $f.out = out; $f.p = p; $f.pname = pname; $f.prop = prop; $f.ret = ret; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.Method = function(i) { return this.$val.Method(i); };
|
|
Value.ptr.prototype.object = function() {
|
|
var _1, newVal, v, val;
|
|
v = this;
|
|
if ((v.typ.Kind() === 17) || (v.typ.Kind() === 25)) {
|
|
return v.ptr;
|
|
}
|
|
if (!((((v.flag & 128) >>> 0) === 0))) {
|
|
val = v.ptr.$get();
|
|
if (!(val === $ifaceNil) && !(val.constructor === jsType(v.typ))) {
|
|
switch (0) { default:
|
|
_1 = v.typ.Kind();
|
|
if ((_1 === (11)) || (_1 === (6))) {
|
|
val = new (jsType(v.typ))(val.$high, val.$low);
|
|
} else if ((_1 === (15)) || (_1 === (16))) {
|
|
val = new (jsType(v.typ))(val.$real, val.$imag);
|
|
} else if (_1 === (23)) {
|
|
if (val === val.constructor.nil) {
|
|
val = jsType(v.typ).nil;
|
|
break;
|
|
}
|
|
newVal = new (jsType(v.typ))(val.$array);
|
|
newVal.$offset = val.$offset;
|
|
newVal.$length = val.$length;
|
|
newVal.$capacity = val.$capacity;
|
|
val = newVal;
|
|
}
|
|
}
|
|
}
|
|
return val;
|
|
}
|
|
return v.ptr;
|
|
};
|
|
Value.prototype.object = function() { return this.$val.object(); };
|
|
Value.ptr.prototype.assignTo = function(context, dst, target) {
|
|
var _r, _r$1, _r$2, context, dst, fl, target, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; context = $f.context; dst = $f.dst; fl = $f.fl; target = $f.target; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
|
|
_r = makeMethodValue(context, $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
/* } */ case 2:
|
|
_r$1 = directlyAssignable(dst, v.typ); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 5; continue; }
|
|
/* */ if (implements$1(dst, v.typ)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (_r$1) { */ case 5:
|
|
fl = (((v.flag & 384) >>> 0) | new flag(v.flag).ro()) >>> 0;
|
|
fl = (fl | (((dst.Kind() >>> 0)))) >>> 0;
|
|
$s = -1; return new Value.ptr(dst, v.ptr, fl);
|
|
/* } else if (implements$1(dst, v.typ)) { */ case 6:
|
|
if (target === 0) {
|
|
target = unsafe_New(dst);
|
|
}
|
|
_r$2 = valueInterface($clone(v, Value), false); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
x = _r$2;
|
|
if (dst.NumMethod() === 0) {
|
|
(target).$set(x);
|
|
} else {
|
|
ifaceE2I(dst, x, target);
|
|
}
|
|
$s = -1; return new Value.ptr(dst, target, 148);
|
|
/* } */ case 7:
|
|
case 4:
|
|
$panic(new $String(context + ": value of type " + v.typ.String() + " is not assignable to type " + dst.String()));
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.assignTo }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.context = context; $f.dst = dst; $f.fl = fl; $f.target = target; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.assignTo = function(context, dst, target) { return this.$val.assignTo(context, dst, target); };
|
|
Value.ptr.prototype.call = function(op, in$1) {
|
|
var _1, _arg, _arg$1, _arg$2, _arg$3, _i, _i$1, _i$2, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _ref$1, _ref$2, _tmp, _tmp$1, _tuple, arg, argsArray, elem, fn, i, i$1, i$2, i$3, in$1, isSlice, m, n, nin, nout, op, origIn, rcvr, results, ret, slice, t, targ, v, x, x$1, x$2, xt, xt$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _arg$3 = $f._arg$3; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; arg = $f.arg; argsArray = $f.argsArray; elem = $f.elem; fn = $f.fn; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; in$1 = $f.in$1; isSlice = $f.isSlice; m = $f.m; n = $f.n; nin = $f.nin; nout = $f.nout; op = $f.op; origIn = $f.origIn; rcvr = $f.rcvr; results = $f.results; ret = $f.ret; slice = $f.slice; t = $f.t; targ = $f.targ; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; xt = $f.xt; xt$1 = $f.xt$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
t = ptrType$8.nil;
|
|
fn = 0;
|
|
rcvr = null;
|
|
if (!((((v.flag & 512) >>> 0) === 0))) {
|
|
_tuple = methodReceiver(op, $clone(v, Value), ((v.flag >> 0)) >> 10 >> 0);
|
|
t = _tuple[1];
|
|
fn = _tuple[2];
|
|
rcvr = $clone(v, Value).object();
|
|
if (isWrapped(v.typ)) {
|
|
rcvr = new (jsType(v.typ))(rcvr);
|
|
}
|
|
} else {
|
|
t = (v.typ.kindType);
|
|
fn = ($clone(v, Value).object());
|
|
rcvr = undefined;
|
|
}
|
|
if (fn === 0) {
|
|
$panic(new $String("reflect.Value.Call: call of nil function"));
|
|
}
|
|
isSlice = op === "CallSlice";
|
|
n = t.rtype.NumIn();
|
|
if (isSlice) {
|
|
if (!t.rtype.IsVariadic()) {
|
|
$panic(new $String("reflect: CallSlice of non-variadic function"));
|
|
}
|
|
if (in$1.$length < n) {
|
|
$panic(new $String("reflect: CallSlice with too few input arguments"));
|
|
}
|
|
if (in$1.$length > n) {
|
|
$panic(new $String("reflect: CallSlice with too many input arguments"));
|
|
}
|
|
} else {
|
|
if (t.rtype.IsVariadic()) {
|
|
n = n - (1) >> 0;
|
|
}
|
|
if (in$1.$length < n) {
|
|
$panic(new $String("reflect: Call with too few input arguments"));
|
|
}
|
|
if (!t.rtype.IsVariadic() && in$1.$length > n) {
|
|
$panic(new $String("reflect: Call with too many input arguments"));
|
|
}
|
|
}
|
|
_ref = in$1;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if ($clone(x, Value).Kind() === 0) {
|
|
$panic(new $String("reflect: " + op + " using zero Value argument"));
|
|
}
|
|
_i++;
|
|
}
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 2; continue; }
|
|
_tmp = $clone(((i < 0 || i >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + i]), Value).Type();
|
|
_tmp$1 = t.rtype.In(i);
|
|
xt = _tmp;
|
|
targ = _tmp$1;
|
|
_r = xt.AssignableTo(targ); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!_r) { */ case 3:
|
|
_r$1 = xt.String(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = targ.String(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$panic(new $String("reflect: " + op + " using " + _r$1 + " as type " + _r$2));
|
|
/* } */ case 4:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
/* */ if (!isSlice && t.rtype.IsVariadic()) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (!isSlice && t.rtype.IsVariadic()) { */ case 8:
|
|
m = in$1.$length - n >> 0;
|
|
_r$3 = MakeSlice(t.rtype.In(n), m, m); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
slice = _r$3;
|
|
_r$4 = t.rtype.In(n).Elem(); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
elem = _r$4;
|
|
i$1 = 0;
|
|
/* while (true) { */ case 12:
|
|
/* if (!(i$1 < m)) { break; } */ if(!(i$1 < m)) { $s = 13; continue; }
|
|
x$2 = (x$1 = n + i$1 >> 0, ((x$1 < 0 || x$1 >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + x$1]));
|
|
xt$1 = $clone(x$2, Value).Type();
|
|
_r$5 = xt$1.AssignableTo(elem); /* */ $s = 16; case 16: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$5) { $s = 14; continue; }
|
|
/* */ $s = 15; continue;
|
|
/* if (!_r$5) { */ case 14:
|
|
_r$6 = xt$1.String(); /* */ $s = 17; case 17: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$7 = elem.String(); /* */ $s = 18; case 18: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$panic(new $String("reflect: cannot use " + _r$6 + " as type " + _r$7 + " in " + op));
|
|
/* } */ case 15:
|
|
_r$8 = $clone(slice, Value).Index(i$1); /* */ $s = 19; case 19: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$r = $clone(_r$8, Value).Set($clone(x$2, Value)); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 12; continue; case 13:
|
|
origIn = in$1;
|
|
in$1 = $makeSlice(sliceType$9, (n + 1 >> 0));
|
|
$copySlice($subslice(in$1, 0, n), origIn);
|
|
((n < 0 || n >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + n] = slice);
|
|
/* } */ case 9:
|
|
nin = in$1.$length;
|
|
if (!((nin === t.rtype.NumIn()))) {
|
|
$panic(new $String("reflect.Value.Call: wrong argument count"));
|
|
}
|
|
nout = t.rtype.NumOut();
|
|
argsArray = new ($global.Array)(t.rtype.NumIn());
|
|
_ref$1 = in$1;
|
|
_i$1 = 0;
|
|
/* while (true) { */ case 21:
|
|
/* if (!(_i$1 < _ref$1.$length)) { break; } */ if(!(_i$1 < _ref$1.$length)) { $s = 22; continue; }
|
|
i$2 = _i$1;
|
|
arg = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
_arg = t.rtype.In(i$2);
|
|
_r$9 = t.rtype.In(i$2).common(); /* */ $s = 23; case 23: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_arg$1 = _r$9;
|
|
_arg$2 = 0;
|
|
_r$10 = $clone(arg, Value).assignTo("reflect.Value.Call", _arg$1, _arg$2); /* */ $s = 24; case 24: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_r$11 = $clone(_r$10, Value).object(); /* */ $s = 25; case 25: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
_arg$3 = _r$11;
|
|
_r$12 = unwrapJsObject(_arg, _arg$3); /* */ $s = 26; case 26: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
argsArray[i$2] = _r$12;
|
|
_i$1++;
|
|
/* } */ $s = 21; continue; case 22:
|
|
_r$13 = callHelper(new sliceType$3([new $jsObjectPtr(fn), new $jsObjectPtr(rcvr), new $jsObjectPtr(argsArray)])); /* */ $s = 27; case 27: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
results = _r$13;
|
|
_1 = nout;
|
|
/* */ if (_1 === (0)) { $s = 29; continue; }
|
|
/* */ if (_1 === (1)) { $s = 30; continue; }
|
|
/* */ $s = 31; continue;
|
|
/* if (_1 === (0)) { */ case 29:
|
|
$s = -1; return sliceType$9.nil;
|
|
/* } else if (_1 === (1)) { */ case 30:
|
|
_r$14 = makeValue(t.rtype.Out(0), wrapJsObject(t.rtype.Out(0), results), 0); /* */ $s = 33; case 33: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
$s = -1; return new sliceType$9([$clone(_r$14, Value)]);
|
|
/* } else { */ case 31:
|
|
ret = $makeSlice(sliceType$9, nout);
|
|
_ref$2 = ret;
|
|
_i$2 = 0;
|
|
/* while (true) { */ case 34:
|
|
/* if (!(_i$2 < _ref$2.$length)) { break; } */ if(!(_i$2 < _ref$2.$length)) { $s = 35; continue; }
|
|
i$3 = _i$2;
|
|
_r$15 = makeValue(t.rtype.Out(i$3), wrapJsObject(t.rtype.Out(i$3), results[i$3]), 0); /* */ $s = 36; case 36: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
((i$3 < 0 || i$3 >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i$3] = _r$15);
|
|
_i$2++;
|
|
/* } */ $s = 34; continue; case 35:
|
|
$s = -1; return ret;
|
|
/* } */ case 32:
|
|
case 28:
|
|
$s = -1; return sliceType$9.nil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.call }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._arg$3 = _arg$3; $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.arg = arg; $f.argsArray = argsArray; $f.elem = elem; $f.fn = fn; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.in$1 = in$1; $f.isSlice = isSlice; $f.m = m; $f.n = n; $f.nin = nin; $f.nout = nout; $f.op = op; $f.origIn = origIn; $f.rcvr = rcvr; $f.results = results; $f.ret = ret; $f.slice = slice; $f.t = t; $f.targ = targ; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.xt = xt; $f.xt$1 = xt$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.call = function(op, in$1) { return this.$val.call(op, in$1); };
|
|
Value.ptr.prototype.Cap = function() {
|
|
var _1, k, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (17)) {
|
|
return v.typ.Len();
|
|
} else if ((_1 === (18)) || (_1 === (23))) {
|
|
return $parseInt($clone(v, Value).object().$capacity) >> 0;
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.Cap", k));
|
|
};
|
|
Value.prototype.Cap = function() { return this.$val.Cap(); };
|
|
wrapJsObject = function(typ, val) {
|
|
var typ, val;
|
|
if ($interfaceIsEqual(typ, jsObjectPtr)) {
|
|
return new (jsType(jsObjectPtr))(val);
|
|
}
|
|
return val;
|
|
};
|
|
unwrapJsObject = function(typ, val) {
|
|
var typ, val;
|
|
if ($interfaceIsEqual(typ, jsObjectPtr)) {
|
|
return val.object;
|
|
}
|
|
return val;
|
|
};
|
|
Value.ptr.prototype.Elem = function() {
|
|
var _1, _r, fl, k, tt, typ, v, val, val$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; fl = $f.fl; k = $f.k; tt = $f.tt; typ = $f.typ; v = $f.v; val = $f.val; val$1 = $f.val$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
/* */ if (_1 === (20)) { $s = 2; continue; }
|
|
/* */ if (_1 === (22)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (_1 === (20)) { */ case 2:
|
|
val = $clone(v, Value).object();
|
|
if (val === $ifaceNil) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
typ = reflectType(val.constructor);
|
|
_r = makeValue(typ, val.$val, new flag(v.flag).ro()); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } else if (_1 === (22)) { */ case 3:
|
|
if ($clone(v, Value).IsNil()) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
val$1 = $clone(v, Value).object();
|
|
tt = (v.typ.kindType);
|
|
fl = (((((v.flag & 96) >>> 0) | 128) >>> 0) | 256) >>> 0;
|
|
fl = (fl | (((tt.elem.Kind() >>> 0)))) >>> 0;
|
|
$s = -1; return new Value.ptr(tt.elem, (wrapJsObject(tt.elem, val$1)), fl);
|
|
/* } else { */ case 4:
|
|
$panic(new ValueError.ptr("reflect.Value.Elem", k));
|
|
/* } */ case 5:
|
|
case 1:
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Elem }; } $f._1 = _1; $f._r = _r; $f.fl = fl; $f.k = k; $f.tt = tt; $f.typ = typ; $f.v = v; $f.val = val; $f.val$1 = val$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Elem = function() { return this.$val.Elem(); };
|
|
Value.ptr.prototype.Field = function(i) {
|
|
var _r, _r$1, _r$2, field, fl, i, jsTag, o, prop, s, tag, tt, typ, v, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; field = $f.field; fl = $f.fl; i = $f.i; jsTag = $f.jsTag; o = $f.o; prop = $f.prop; s = $f.s; tag = $f.tag; tt = $f.tt; typ = $f.typ; v = $f.v; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
jsTag = [jsTag];
|
|
prop = [prop];
|
|
s = [s];
|
|
typ = [typ];
|
|
v = this;
|
|
if (!((new flag(v.flag).kind() === 25))) {
|
|
$panic(new ValueError.ptr("reflect.Value.Field", new flag(v.flag).kind()));
|
|
}
|
|
tt = (v.typ.kindType);
|
|
if (((i >>> 0)) >= ((tt.fields.$length >>> 0))) {
|
|
$panic(new $String("reflect: Field index out of range"));
|
|
}
|
|
prop[0] = $internalize(jsType(v.typ).fields[i].prop, $String);
|
|
field = (x = tt.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
typ[0] = field.typ;
|
|
fl = (((v.flag & 416) >>> 0) | ((typ[0].Kind() >>> 0))) >>> 0;
|
|
if (!$clone(field.name, name).isExported()) {
|
|
if (field.embedded()) {
|
|
fl = (fl | (64)) >>> 0;
|
|
} else {
|
|
fl = (fl | (32)) >>> 0;
|
|
}
|
|
}
|
|
tag = $clone((x$1 = tt.fields, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])).name, name).tag();
|
|
/* */ if (!(tag === "") && !((i === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!(tag === "") && !((i === 0))) { */ case 1:
|
|
jsTag[0] = getJsTag(tag);
|
|
/* */ if (!(jsTag[0] === "")) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!(jsTag[0] === "")) { */ case 3:
|
|
/* while (true) { */ case 5:
|
|
o = [o];
|
|
_r = $clone(v, Value).Field(0); /* */ $s = 7; case 7: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
/* */ if (v.typ === jsObjectPtr) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (v.typ === jsObjectPtr) { */ case 8:
|
|
o[0] = $clone(v, Value).object().object;
|
|
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(jsTag, o, prop, s, typ) { return function() {
|
|
return $internalize(o[0][$externalize(jsTag[0], $String)], jsType(typ[0]));
|
|
}; })(jsTag, o, prop, s, typ), (function(jsTag, o, prop, s, typ) { return function(x$2) {
|
|
var x$2;
|
|
o[0][$externalize(jsTag[0], $String)] = $externalize(x$2, jsType(typ[0]));
|
|
}; })(jsTag, o, prop, s, typ))), fl);
|
|
/* } */ case 9:
|
|
/* */ if (v.typ.Kind() === 22) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (v.typ.Kind() === 22) { */ case 10:
|
|
_r$1 = $clone(v, Value).Elem(); /* */ $s = 12; case 12: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v = _r$1;
|
|
/* } */ case 11:
|
|
/* } */ $s = 5; continue; case 6:
|
|
/* } */ case 4:
|
|
/* } */ case 2:
|
|
s[0] = v.ptr;
|
|
/* */ if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { */ case 13:
|
|
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(jsTag, prop, s, typ) { return function() {
|
|
return wrapJsObject(typ[0], s[0][$externalize(prop[0], $String)]);
|
|
}; })(jsTag, prop, s, typ), (function(jsTag, prop, s, typ) { return function(x$2) {
|
|
var x$2;
|
|
s[0][$externalize(prop[0], $String)] = unwrapJsObject(typ[0], x$2);
|
|
}; })(jsTag, prop, s, typ))), fl);
|
|
/* } */ case 14:
|
|
_r$2 = makeValue(typ[0], wrapJsObject(typ[0], s[0][$externalize(prop[0], $String)]), fl); /* */ $s = 15; case 15: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Field }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.field = field; $f.fl = fl; $f.i = i; $f.jsTag = jsTag; $f.o = o; $f.prop = prop; $f.s = s; $f.tag = tag; $f.tt = tt; $f.typ = typ; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Field = function(i) { return this.$val.Field(i); };
|
|
getJsTag = function(tag) {
|
|
var _tuple, i, name$1, qvalue, tag, value;
|
|
while (true) {
|
|
if (!(!(tag === ""))) { break; }
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < tag.length && (tag.charCodeAt(i) === 32))) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
tag = $substring(tag, i);
|
|
if (tag === "") {
|
|
break;
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < tag.length && !((tag.charCodeAt(i) === 32)) && !((tag.charCodeAt(i) === 58)) && !((tag.charCodeAt(i) === 34)))) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
if ((i + 1 >> 0) >= tag.length || !((tag.charCodeAt(i) === 58)) || !((tag.charCodeAt((i + 1 >> 0)) === 34))) {
|
|
break;
|
|
}
|
|
name$1 = ($substring(tag, 0, i));
|
|
tag = $substring(tag, (i + 1 >> 0));
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < tag.length && !((tag.charCodeAt(i) === 34)))) { break; }
|
|
if (tag.charCodeAt(i) === 92) {
|
|
i = i + (1) >> 0;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (i >= tag.length) {
|
|
break;
|
|
}
|
|
qvalue = ($substring(tag, 0, (i + 1 >> 0)));
|
|
tag = $substring(tag, (i + 1 >> 0));
|
|
if (name$1 === "js") {
|
|
_tuple = strconv.Unquote(qvalue);
|
|
value = _tuple[0];
|
|
return value;
|
|
}
|
|
}
|
|
return "";
|
|
};
|
|
Value.ptr.prototype.Index = function(i) {
|
|
var _1, _r, _r$1, a, a$1, c, fl, fl$1, fl$2, i, k, s, str, tt, tt$1, typ, typ$1, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; a = $f.a; a$1 = $f.a$1; c = $f.c; fl = $f.fl; fl$1 = $f.fl$1; fl$2 = $f.fl$2; i = $f.i; k = $f.k; s = $f.s; str = $f.str; tt = $f.tt; tt$1 = $f.tt$1; typ = $f.typ; typ$1 = $f.typ$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
a = [a];
|
|
a$1 = [a$1];
|
|
c = [c];
|
|
i = [i];
|
|
typ = [typ];
|
|
typ$1 = [typ$1];
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
/* */ if (_1 === (17)) { $s = 2; continue; }
|
|
/* */ if (_1 === (23)) { $s = 3; continue; }
|
|
/* */ if (_1 === (24)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_1 === (17)) { */ case 2:
|
|
tt = (v.typ.kindType);
|
|
if (i[0] < 0 || i[0] > ((tt.len >> 0))) {
|
|
$panic(new $String("reflect: array index out of range"));
|
|
}
|
|
typ[0] = tt.elem;
|
|
fl = (((((v.flag & 384) >>> 0) | new flag(v.flag).ro()) >>> 0) | ((typ[0].Kind() >>> 0))) >>> 0;
|
|
a[0] = v.ptr;
|
|
/* */ if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { */ case 7:
|
|
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(a, a$1, c, i, typ, typ$1) { return function() {
|
|
return wrapJsObject(typ[0], a[0][i[0]]);
|
|
}; })(a, a$1, c, i, typ, typ$1), (function(a, a$1, c, i, typ, typ$1) { return function(x) {
|
|
var x;
|
|
a[0][i[0]] = unwrapJsObject(typ[0], x);
|
|
}; })(a, a$1, c, i, typ, typ$1))), fl);
|
|
/* } */ case 8:
|
|
_r = makeValue(typ[0], wrapJsObject(typ[0], a[0][i[0]]), fl); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } else if (_1 === (23)) { */ case 3:
|
|
s = $clone(v, Value).object();
|
|
if (i[0] < 0 || i[0] >= ($parseInt(s.$length) >> 0)) {
|
|
$panic(new $String("reflect: slice index out of range"));
|
|
}
|
|
tt$1 = (v.typ.kindType);
|
|
typ$1[0] = tt$1.elem;
|
|
fl$1 = (((384 | new flag(v.flag).ro()) >>> 0) | ((typ$1[0].Kind() >>> 0))) >>> 0;
|
|
i[0] = i[0] + (($parseInt(s.$offset) >> 0)) >> 0;
|
|
a$1[0] = s.$array;
|
|
/* */ if (!((((fl$1 & 128) >>> 0) === 0)) && !((typ$1[0].Kind() === 17)) && !((typ$1[0].Kind() === 25))) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (!((((fl$1 & 128) >>> 0) === 0)) && !((typ$1[0].Kind() === 17)) && !((typ$1[0].Kind() === 25))) { */ case 10:
|
|
$s = -1; return new Value.ptr(typ$1[0], (new (jsType(PtrTo(typ$1[0])))((function(a, a$1, c, i, typ, typ$1) { return function() {
|
|
return wrapJsObject(typ$1[0], a$1[0][i[0]]);
|
|
}; })(a, a$1, c, i, typ, typ$1), (function(a, a$1, c, i, typ, typ$1) { return function(x) {
|
|
var x;
|
|
a$1[0][i[0]] = unwrapJsObject(typ$1[0], x);
|
|
}; })(a, a$1, c, i, typ, typ$1))), fl$1);
|
|
/* } */ case 11:
|
|
_r$1 = makeValue(typ$1[0], wrapJsObject(typ$1[0], a$1[0][i[0]]), fl$1); /* */ $s = 12; case 12: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } else if (_1 === (24)) { */ case 4:
|
|
str = (v.ptr).$get();
|
|
if (i[0] < 0 || i[0] >= str.length) {
|
|
$panic(new $String("reflect: string index out of range"));
|
|
}
|
|
fl$2 = (((new flag(v.flag).ro() | 8) >>> 0) | 128) >>> 0;
|
|
c[0] = str.charCodeAt(i[0]);
|
|
$s = -1; return new Value.ptr(uint8Type, ((c.$ptr || (c.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, c)))), fl$2);
|
|
/* } else { */ case 5:
|
|
$panic(new ValueError.ptr("reflect.Value.Index", k));
|
|
/* } */ case 6:
|
|
case 1:
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Index }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.a = a; $f.a$1 = a$1; $f.c = c; $f.fl = fl; $f.fl$1 = fl$1; $f.fl$2 = fl$2; $f.i = i; $f.k = k; $f.s = s; $f.str = str; $f.tt = tt; $f.tt$1 = tt$1; $f.typ = typ; $f.typ$1 = typ$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Index = function(i) { return this.$val.Index(i); };
|
|
Value.ptr.prototype.InterfaceData = function() {
|
|
var v;
|
|
v = this;
|
|
$panic(errors.New("InterfaceData is not supported by GopherJS"));
|
|
};
|
|
Value.prototype.InterfaceData = function() { return this.$val.InterfaceData(); };
|
|
Value.ptr.prototype.IsNil = function() {
|
|
var _1, k, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if ((_1 === (22)) || (_1 === (23))) {
|
|
return $clone(v, Value).object() === jsType(v.typ).nil;
|
|
} else if (_1 === (18)) {
|
|
return $clone(v, Value).object() === $chanNil;
|
|
} else if (_1 === (19)) {
|
|
return $clone(v, Value).object() === $throwNilPointerError;
|
|
} else if (_1 === (21)) {
|
|
return $clone(v, Value).object() === false;
|
|
} else if (_1 === (20)) {
|
|
return $clone(v, Value).object() === $ifaceNil;
|
|
} else if (_1 === (26)) {
|
|
return $clone(v, Value).object() === 0;
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.IsNil", k));
|
|
}
|
|
};
|
|
Value.prototype.IsNil = function() { return this.$val.IsNil(); };
|
|
Value.ptr.prototype.Len = function() {
|
|
var _1, k, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if ((_1 === (17)) || (_1 === (24))) {
|
|
return $parseInt($clone(v, Value).object().length);
|
|
} else if (_1 === (23)) {
|
|
return $parseInt($clone(v, Value).object().$length) >> 0;
|
|
} else if (_1 === (18)) {
|
|
return $parseInt($clone(v, Value).object().$buffer.length) >> 0;
|
|
} else if (_1 === (21)) {
|
|
return $parseInt($keys($clone(v, Value).object()).length);
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.Len", k));
|
|
}
|
|
};
|
|
Value.prototype.Len = function() { return this.$val.Len(); };
|
|
Value.ptr.prototype.Pointer = function() {
|
|
var _1, k, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if ((_1 === (18)) || (_1 === (21)) || (_1 === (22)) || (_1 === (26))) {
|
|
if ($clone(v, Value).IsNil()) {
|
|
return 0;
|
|
}
|
|
return $clone(v, Value).object();
|
|
} else if (_1 === (19)) {
|
|
if ($clone(v, Value).IsNil()) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
} else if (_1 === (23)) {
|
|
if ($clone(v, Value).IsNil()) {
|
|
return 0;
|
|
}
|
|
return $clone(v, Value).object().$array;
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.Pointer", k));
|
|
}
|
|
};
|
|
Value.prototype.Pointer = function() { return this.$val.Pointer(); };
|
|
Value.ptr.prototype.Set = function(x) {
|
|
var _1, _r, _r$1, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(x.flag).mustBeExported();
|
|
_r = $clone(x, Value).assignTo("reflect.Set", v.typ, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
x = _r;
|
|
/* */ if (!((((v.flag & 128) >>> 0) === 0))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((((v.flag & 128) >>> 0) === 0))) { */ case 2:
|
|
_1 = v.typ.Kind();
|
|
/* */ if (_1 === (17)) { $s = 5; continue; }
|
|
/* */ if (_1 === (20)) { $s = 6; continue; }
|
|
/* */ if (_1 === (25)) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (_1 === (17)) { */ case 5:
|
|
jsType(v.typ).copy(v.ptr, x.ptr);
|
|
$s = 9; continue;
|
|
/* } else if (_1 === (20)) { */ case 6:
|
|
_r$1 = valueInterface($clone(x, Value), false); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v.ptr.$set(_r$1);
|
|
$s = 9; continue;
|
|
/* } else if (_1 === (25)) { */ case 7:
|
|
copyStruct(v.ptr, x.ptr, v.typ);
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
v.ptr.$set($clone(x, Value).object());
|
|
/* } */ case 9:
|
|
case 4:
|
|
$s = -1; return;
|
|
/* } */ case 3:
|
|
v.ptr = x.ptr;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Set }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Set = function(x) { return this.$val.Set(x); };
|
|
Value.ptr.prototype.SetBytes = function(x) {
|
|
var _r, _r$1, _v, slice, typedSlice, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _v = $f._v; slice = $f.slice; typedSlice = $f.typedSlice; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(23);
|
|
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 8))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 8))) { */ case 1:
|
|
$panic(new $String("reflect.Value.SetBytes of non-byte slice"));
|
|
/* } */ case 2:
|
|
slice = x;
|
|
if (!(v.typ.Name() === "")) { _v = true; $s = 6; continue s; }
|
|
_r$1 = v.typ.Elem().Name(); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v = !(_r$1 === ""); case 6:
|
|
/* */ if (_v) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_v) { */ case 4:
|
|
typedSlice = new (jsType(v.typ))(slice.$array);
|
|
typedSlice.$offset = slice.$offset;
|
|
typedSlice.$length = slice.$length;
|
|
typedSlice.$capacity = slice.$capacity;
|
|
slice = typedSlice;
|
|
/* } */ case 5:
|
|
v.ptr.$set(slice);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.SetBytes }; } $f._r = _r; $f._r$1 = _r$1; $f._v = _v; $f.slice = slice; $f.typedSlice = typedSlice; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.SetBytes = function(x) { return this.$val.SetBytes(x); };
|
|
Value.ptr.prototype.SetCap = function(n) {
|
|
var n, newSlice, s, v;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(23);
|
|
s = v.ptr.$get();
|
|
if (n < ($parseInt(s.$length) >> 0) || n > ($parseInt(s.$capacity) >> 0)) {
|
|
$panic(new $String("reflect: slice capacity out of range in SetCap"));
|
|
}
|
|
newSlice = new (jsType(v.typ))(s.$array);
|
|
newSlice.$offset = s.$offset;
|
|
newSlice.$length = s.$length;
|
|
newSlice.$capacity = n;
|
|
v.ptr.$set(newSlice);
|
|
};
|
|
Value.prototype.SetCap = function(n) { return this.$val.SetCap(n); };
|
|
Value.ptr.prototype.SetLen = function(n) {
|
|
var n, newSlice, s, v;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(23);
|
|
s = v.ptr.$get();
|
|
if (n < 0 || n > ($parseInt(s.$capacity) >> 0)) {
|
|
$panic(new $String("reflect: slice length out of range in SetLen"));
|
|
}
|
|
newSlice = new (jsType(v.typ))(s.$array);
|
|
newSlice.$offset = s.$offset;
|
|
newSlice.$length = n;
|
|
newSlice.$capacity = s.$capacity;
|
|
v.ptr.$set(newSlice);
|
|
};
|
|
Value.prototype.SetLen = function(n) { return this.$val.SetLen(n); };
|
|
Value.ptr.prototype.Slice = function(i, j) {
|
|
var _1, _r, _r$1, cap, i, j, kind, s, str, tt, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; cap = $f.cap; i = $f.i; j = $f.j; kind = $f.kind; s = $f.s; str = $f.str; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
cap = 0;
|
|
typ = $ifaceNil;
|
|
s = null;
|
|
kind = new flag(v.flag).kind();
|
|
_1 = kind;
|
|
/* */ if (_1 === (17)) { $s = 2; continue; }
|
|
/* */ if (_1 === (23)) { $s = 3; continue; }
|
|
/* */ if (_1 === (24)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_1 === (17)) { */ case 2:
|
|
if (((v.flag & 256) >>> 0) === 0) {
|
|
$panic(new $String("reflect.Value.Slice: slice of unaddressable array"));
|
|
}
|
|
tt = (v.typ.kindType);
|
|
cap = ((tt.len >> 0));
|
|
typ = SliceOf(tt.elem);
|
|
s = new (jsType(typ))($clone(v, Value).object());
|
|
$s = 6; continue;
|
|
/* } else if (_1 === (23)) { */ case 3:
|
|
typ = v.typ;
|
|
s = $clone(v, Value).object();
|
|
cap = $parseInt(s.$capacity) >> 0;
|
|
$s = 6; continue;
|
|
/* } else if (_1 === (24)) { */ case 4:
|
|
str = (v.ptr).$get();
|
|
if (i < 0 || j < i || j > str.length) {
|
|
$panic(new $String("reflect.Value.Slice: string slice index out of bounds"));
|
|
}
|
|
_r = ValueOf(new $String($substring(str, i, j))); /* */ $s = 7; case 7: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } else { */ case 5:
|
|
$panic(new ValueError.ptr("reflect.Value.Slice", kind));
|
|
/* } */ case 6:
|
|
case 1:
|
|
if (i < 0 || j < i || j > cap) {
|
|
$panic(new $String("reflect.Value.Slice: slice index out of bounds"));
|
|
}
|
|
_r$1 = makeValue(typ, $subslice(s, i, j), new flag(v.flag).ro()); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Slice }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.cap = cap; $f.i = i; $f.j = j; $f.kind = kind; $f.s = s; $f.str = str; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Slice = function(i, j) { return this.$val.Slice(i, j); };
|
|
Value.ptr.prototype.Slice3 = function(i, j, k) {
|
|
var _1, _r, cap, i, j, k, kind, s, tt, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; cap = $f.cap; i = $f.i; j = $f.j; k = $f.k; kind = $f.kind; s = $f.s; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
cap = 0;
|
|
typ = $ifaceNil;
|
|
s = null;
|
|
kind = new flag(v.flag).kind();
|
|
_1 = kind;
|
|
if (_1 === (17)) {
|
|
if (((v.flag & 256) >>> 0) === 0) {
|
|
$panic(new $String("reflect.Value.Slice: slice of unaddressable array"));
|
|
}
|
|
tt = (v.typ.kindType);
|
|
cap = ((tt.len >> 0));
|
|
typ = SliceOf(tt.elem);
|
|
s = new (jsType(typ))($clone(v, Value).object());
|
|
} else if (_1 === (23)) {
|
|
typ = v.typ;
|
|
s = $clone(v, Value).object();
|
|
cap = $parseInt(s.$capacity) >> 0;
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.Slice3", kind));
|
|
}
|
|
if (i < 0 || j < i || k < j || k > cap) {
|
|
$panic(new $String("reflect.Value.Slice3: slice index out of bounds"));
|
|
}
|
|
_r = makeValue(typ, $subslice(s, i, j, k), new flag(v.flag).ro()); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Slice3 }; } $f._1 = _1; $f._r = _r; $f.cap = cap; $f.i = i; $f.j = j; $f.k = k; $f.kind = kind; $f.s = s; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Slice3 = function(i, j, k) { return this.$val.Slice3(i, j, k); };
|
|
Value.ptr.prototype.Close = function() {
|
|
var v;
|
|
v = this;
|
|
new flag(v.flag).mustBe(18);
|
|
new flag(v.flag).mustBeExported();
|
|
$close($clone(v, Value).object());
|
|
};
|
|
Value.prototype.Close = function() { return this.$val.Close(); };
|
|
chanrecv = function(ch, nb, val) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, ch, comms, nb, received, recvRes, selectRes, selected, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; ch = $f.ch; comms = $f.comms; nb = $f.nb; received = $f.received; recvRes = $f.recvRes; selectRes = $f.selectRes; selected = $f.selected; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
selected = false;
|
|
received = false;
|
|
comms = new sliceType$11([new sliceType$8([ch])]);
|
|
if (nb) {
|
|
comms = $append(comms, new sliceType$8([]));
|
|
}
|
|
_r = selectHelper(new sliceType$3([comms])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
selectRes = _r;
|
|
if (nb && (($parseInt(selectRes[0]) >> 0) === 1)) {
|
|
_tmp = false;
|
|
_tmp$1 = false;
|
|
selected = _tmp;
|
|
received = _tmp$1;
|
|
$s = -1; return [selected, received];
|
|
}
|
|
recvRes = selectRes[1];
|
|
val.$set(recvRes[0]);
|
|
_tmp$2 = true;
|
|
_tmp$3 = !!(recvRes[1]);
|
|
selected = _tmp$2;
|
|
received = _tmp$3;
|
|
$s = -1; return [selected, received];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: chanrecv }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.ch = ch; $f.comms = comms; $f.nb = nb; $f.received = received; $f.recvRes = recvRes; $f.selectRes = selectRes; $f.selected = selected; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
chansend = function(ch, val, nb) {
|
|
var _r, ch, comms, nb, selectRes, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; ch = $f.ch; comms = $f.comms; nb = $f.nb; selectRes = $f.selectRes; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
comms = new sliceType$11([new sliceType$8([ch, val.$get()])]);
|
|
if (nb) {
|
|
comms = $append(comms, new sliceType$8([]));
|
|
}
|
|
_r = selectHelper(new sliceType$3([comms])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
selectRes = _r;
|
|
if (nb && (($parseInt(selectRes[0]) >> 0) === 1)) {
|
|
$s = -1; return false;
|
|
}
|
|
$s = -1; return true;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: chansend }; } $f._r = _r; $f.ch = ch; $f.comms = comms; $f.nb = nb; $f.selectRes = selectRes; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
structField.ptr.prototype.offset = function() {
|
|
var f;
|
|
f = this;
|
|
return f.offsetEmbed >>> 1 >>> 0;
|
|
};
|
|
structField.prototype.offset = function() { return this.$val.offset(); };
|
|
structField.ptr.prototype.embedded = function() {
|
|
var f;
|
|
f = this;
|
|
return !((((f.offsetEmbed & 1) >>> 0) === 0));
|
|
};
|
|
structField.prototype.embedded = function() { return this.$val.embedded(); };
|
|
Kind.prototype.String = function() {
|
|
var k;
|
|
k = this.$val;
|
|
if (((k >> 0)) < kindNames.$length) {
|
|
return ((k < 0 || k >= kindNames.$length) ? ($throwRuntimeError("index out of range"), undefined) : kindNames.$array[kindNames.$offset + k]);
|
|
}
|
|
return "kind" + strconv.Itoa(((k >> 0)));
|
|
};
|
|
$ptrType(Kind).prototype.String = function() { return new Kind(this.$get()).String(); };
|
|
rtype.ptr.prototype.String = function() {
|
|
var s, t;
|
|
t = this;
|
|
s = $clone(t.nameOff(t.str), name).name();
|
|
if (!((((t.tflag & 2) >>> 0) === 0))) {
|
|
return $substring(s, 1);
|
|
}
|
|
return s;
|
|
};
|
|
rtype.prototype.String = function() { return this.$val.String(); };
|
|
rtype.ptr.prototype.Size = function() {
|
|
var t;
|
|
t = this;
|
|
return t.size;
|
|
};
|
|
rtype.prototype.Size = function() { return this.$val.Size(); };
|
|
rtype.ptr.prototype.Bits = function() {
|
|
var k, t;
|
|
t = this;
|
|
if (t === ptrType$1.nil) {
|
|
$panic(new $String("reflect: Bits of nil Type"));
|
|
}
|
|
k = t.Kind();
|
|
if (k < 2 || k > 16) {
|
|
$panic(new $String("reflect: Bits of non-arithmetic Type " + t.String()));
|
|
}
|
|
return $imul(((t.size >> 0)), 8);
|
|
};
|
|
rtype.prototype.Bits = function() { return this.$val.Bits(); };
|
|
rtype.ptr.prototype.Align = function() {
|
|
var t;
|
|
t = this;
|
|
return ((t.align >> 0));
|
|
};
|
|
rtype.prototype.Align = function() { return this.$val.Align(); };
|
|
rtype.ptr.prototype.FieldAlign = function() {
|
|
var t;
|
|
t = this;
|
|
return ((t.fieldAlign >> 0));
|
|
};
|
|
rtype.prototype.FieldAlign = function() { return this.$val.FieldAlign(); };
|
|
rtype.ptr.prototype.Kind = function() {
|
|
var t;
|
|
t = this;
|
|
return ((((t.kind & 31) >>> 0) >>> 0));
|
|
};
|
|
rtype.prototype.Kind = function() { return this.$val.Kind(); };
|
|
rtype.ptr.prototype.common = function() {
|
|
var t;
|
|
t = this;
|
|
return t;
|
|
};
|
|
rtype.prototype.common = function() { return this.$val.common(); };
|
|
rtype.ptr.prototype.exportedMethods = function() {
|
|
var t, ut;
|
|
t = this;
|
|
ut = t.uncommon();
|
|
if (ut === ptrType$5.nil) {
|
|
return sliceType$5.nil;
|
|
}
|
|
return ut.exportedMethods();
|
|
};
|
|
rtype.prototype.exportedMethods = function() { return this.$val.exportedMethods(); };
|
|
rtype.ptr.prototype.NumMethod = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (t.Kind() === 20) {
|
|
tt = (t.kindType);
|
|
return tt.NumMethod();
|
|
}
|
|
return t.exportedMethods().$length;
|
|
};
|
|
rtype.prototype.NumMethod = function() { return this.$val.NumMethod(); };
|
|
rtype.ptr.prototype.MethodByName = function(name$1) {
|
|
var _i, _r, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, i, m, name$1, ok, p, t, tt, ut, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; i = $f.i; m = $f.m; name$1 = $f.name$1; ok = $f.ok; p = $f.p; t = $f.t; tt = $f.tt; ut = $f.ut; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
ok = false;
|
|
t = this;
|
|
if (t.Kind() === 20) {
|
|
tt = (t.kindType);
|
|
_tuple = tt.MethodByName(name$1);
|
|
Method.copy(m, _tuple[0]);
|
|
ok = _tuple[1];
|
|
$s = -1; return [m, ok];
|
|
}
|
|
ut = t.uncommon();
|
|
if (ut === ptrType$5.nil) {
|
|
_tmp = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
_tmp$1 = false;
|
|
Method.copy(m, _tmp);
|
|
ok = _tmp$1;
|
|
$s = -1; return [m, ok];
|
|
}
|
|
_ref = ut.exportedMethods();
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
i = _i;
|
|
p = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), method);
|
|
/* */ if ($clone(t.nameOff(p.name), name).name() === name$1) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if ($clone(t.nameOff(p.name), name).name() === name$1) { */ case 3:
|
|
_r = t.Method(i); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tmp$2 = $clone(_r, Method);
|
|
_tmp$3 = true;
|
|
Method.copy(m, _tmp$2);
|
|
ok = _tmp$3;
|
|
$s = -1; return [m, ok];
|
|
/* } */ case 4:
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
_tmp$4 = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
_tmp$5 = false;
|
|
Method.copy(m, _tmp$4);
|
|
ok = _tmp$5;
|
|
$s = -1; return [m, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.MethodByName }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.i = i; $f.m = m; $f.name$1 = name$1; $f.ok = ok; $f.p = p; $f.t = t; $f.tt = tt; $f.ut = ut; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
|
|
rtype.ptr.prototype.PkgPath = function() {
|
|
var t, ut;
|
|
t = this;
|
|
if (((t.tflag & 4) >>> 0) === 0) {
|
|
return "";
|
|
}
|
|
ut = t.uncommon();
|
|
if (ut === ptrType$5.nil) {
|
|
return "";
|
|
}
|
|
return $clone(t.nameOff(ut.pkgPath), name).name();
|
|
};
|
|
rtype.prototype.PkgPath = function() { return this.$val.PkgPath(); };
|
|
rtype.ptr.prototype.Name = function() {
|
|
var i, s, t;
|
|
t = this;
|
|
if (((t.tflag & 4) >>> 0) === 0) {
|
|
return "";
|
|
}
|
|
s = t.String();
|
|
i = s.length - 1 >> 0;
|
|
while (true) {
|
|
if (!(i >= 0)) { break; }
|
|
if (s.charCodeAt(i) === 46) {
|
|
break;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
return $substring(s, (i + 1 >> 0));
|
|
};
|
|
rtype.prototype.Name = function() { return this.$val.Name(); };
|
|
rtype.ptr.prototype.ChanDir = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 18))) {
|
|
$panic(new $String("reflect: ChanDir of non-chan type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return ((tt.dir >> 0));
|
|
};
|
|
rtype.prototype.ChanDir = function() { return this.$val.ChanDir(); };
|
|
rtype.ptr.prototype.IsVariadic = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 19))) {
|
|
$panic(new $String("reflect: IsVariadic of non-func type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return !((((tt.outCount & 32768) >>> 0) === 0));
|
|
};
|
|
rtype.prototype.IsVariadic = function() { return this.$val.IsVariadic(); };
|
|
rtype.ptr.prototype.Elem = function() {
|
|
var _1, t, tt, tt$1, tt$2, tt$3, tt$4;
|
|
t = this;
|
|
_1 = t.Kind();
|
|
if (_1 === (17)) {
|
|
tt = (t.kindType);
|
|
return toType(tt.elem);
|
|
} else if (_1 === (18)) {
|
|
tt$1 = (t.kindType);
|
|
return toType(tt$1.elem);
|
|
} else if (_1 === (21)) {
|
|
tt$2 = (t.kindType);
|
|
return toType(tt$2.elem);
|
|
} else if (_1 === (22)) {
|
|
tt$3 = (t.kindType);
|
|
return toType(tt$3.elem);
|
|
} else if (_1 === (23)) {
|
|
tt$4 = (t.kindType);
|
|
return toType(tt$4.elem);
|
|
}
|
|
$panic(new $String("reflect: Elem of invalid type"));
|
|
};
|
|
rtype.prototype.Elem = function() { return this.$val.Elem(); };
|
|
rtype.ptr.prototype.Field = function(i) {
|
|
var i, t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 25))) {
|
|
$panic(new $String("reflect: Field of non-struct type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return tt.Field(i);
|
|
};
|
|
rtype.prototype.Field = function(i) { return this.$val.Field(i); };
|
|
rtype.ptr.prototype.FieldByIndex = function(index) {
|
|
var _r, index, t, tt, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; index = $f.index; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if (!((t.Kind() === 25))) {
|
|
$panic(new $String("reflect: FieldByIndex of non-struct type"));
|
|
}
|
|
tt = (t.kindType);
|
|
_r = tt.FieldByIndex(index); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByIndex }; } $f._r = _r; $f.index = index; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
|
|
rtype.ptr.prototype.FieldByName = function(name$1) {
|
|
var _r, name$1, t, tt, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; name$1 = $f.name$1; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if (!((t.Kind() === 25))) {
|
|
$panic(new $String("reflect: FieldByName of non-struct type"));
|
|
}
|
|
tt = (t.kindType);
|
|
_r = tt.FieldByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByName }; } $f._r = _r; $f.name$1 = name$1; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
|
|
rtype.ptr.prototype.FieldByNameFunc = function(match) {
|
|
var _r, match, t, tt, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; match = $f.match; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if (!((t.Kind() === 25))) {
|
|
$panic(new $String("reflect: FieldByNameFunc of non-struct type"));
|
|
}
|
|
tt = (t.kindType);
|
|
_r = tt.FieldByNameFunc(match); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByNameFunc }; } $f._r = _r; $f.match = match; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
|
|
rtype.ptr.prototype.In = function(i) {
|
|
var i, t, tt, x;
|
|
t = this;
|
|
if (!((t.Kind() === 19))) {
|
|
$panic(new $String("reflect: In of non-func type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return toType((x = tt.in$(), ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])));
|
|
};
|
|
rtype.prototype.In = function(i) { return this.$val.In(i); };
|
|
rtype.ptr.prototype.Key = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 21))) {
|
|
$panic(new $String("reflect: Key of non-map type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return toType(tt.key);
|
|
};
|
|
rtype.prototype.Key = function() { return this.$val.Key(); };
|
|
rtype.ptr.prototype.Len = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 17))) {
|
|
$panic(new $String("reflect: Len of non-array type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return ((tt.len >> 0));
|
|
};
|
|
rtype.prototype.Len = function() { return this.$val.Len(); };
|
|
rtype.ptr.prototype.NumField = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 25))) {
|
|
$panic(new $String("reflect: NumField of non-struct type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return tt.fields.$length;
|
|
};
|
|
rtype.prototype.NumField = function() { return this.$val.NumField(); };
|
|
rtype.ptr.prototype.NumIn = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 19))) {
|
|
$panic(new $String("reflect: NumIn of non-func type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return ((tt.inCount >> 0));
|
|
};
|
|
rtype.prototype.NumIn = function() { return this.$val.NumIn(); };
|
|
rtype.ptr.prototype.NumOut = function() {
|
|
var t, tt;
|
|
t = this;
|
|
if (!((t.Kind() === 19))) {
|
|
$panic(new $String("reflect: NumOut of non-func type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return tt.out().$length;
|
|
};
|
|
rtype.prototype.NumOut = function() { return this.$val.NumOut(); };
|
|
rtype.ptr.prototype.Out = function(i) {
|
|
var i, t, tt, x;
|
|
t = this;
|
|
if (!((t.Kind() === 19))) {
|
|
$panic(new $String("reflect: Out of non-func type"));
|
|
}
|
|
tt = (t.kindType);
|
|
return toType((x = tt.out(), ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])));
|
|
};
|
|
rtype.prototype.Out = function(i) { return this.$val.Out(i); };
|
|
ChanDir.prototype.String = function() {
|
|
var _1, d;
|
|
d = this.$val;
|
|
_1 = d;
|
|
if (_1 === (2)) {
|
|
return "chan<-";
|
|
} else if (_1 === (1)) {
|
|
return "<-chan";
|
|
} else if (_1 === (3)) {
|
|
return "chan";
|
|
}
|
|
return "ChanDir" + strconv.Itoa(((d >> 0)));
|
|
};
|
|
$ptrType(ChanDir).prototype.String = function() { return new ChanDir(this.$get()).String(); };
|
|
interfaceType.ptr.prototype.Method = function(i) {
|
|
var i, m, p, pname, t, x;
|
|
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
t = this;
|
|
if (i < 0 || i >= t.methods.$length) {
|
|
return m;
|
|
}
|
|
p = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
pname = $clone(t.rtype.nameOff(p.name), name);
|
|
m.Name = $clone(pname, name).name();
|
|
if (!$clone(pname, name).isExported()) {
|
|
m.PkgPath = $clone(pname, name).pkgPath();
|
|
if (m.PkgPath === "") {
|
|
m.PkgPath = $clone(t.pkgPath, name).name();
|
|
}
|
|
}
|
|
m.Type = toType(t.rtype.typeOff(p.typ));
|
|
m.Index = i;
|
|
return m;
|
|
};
|
|
interfaceType.prototype.Method = function(i) { return this.$val.Method(i); };
|
|
interfaceType.ptr.prototype.NumMethod = function() {
|
|
var t;
|
|
t = this;
|
|
return t.methods.$length;
|
|
};
|
|
interfaceType.prototype.NumMethod = function() { return this.$val.NumMethod(); };
|
|
interfaceType.ptr.prototype.MethodByName = function(name$1) {
|
|
var _i, _ref, _tmp, _tmp$1, i, m, name$1, ok, p, t, x;
|
|
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
|
|
ok = false;
|
|
t = this;
|
|
if (t === ptrType$9.nil) {
|
|
return [m, ok];
|
|
}
|
|
p = ptrType$10.nil;
|
|
_ref = t.methods;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
p = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
if ($clone(t.rtype.nameOff(p.name), name).name() === name$1) {
|
|
_tmp = $clone(t.Method(i), Method);
|
|
_tmp$1 = true;
|
|
Method.copy(m, _tmp);
|
|
ok = _tmp$1;
|
|
return [m, ok];
|
|
}
|
|
_i++;
|
|
}
|
|
return [m, ok];
|
|
};
|
|
interfaceType.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
|
|
StructTag.prototype.Get = function(key) {
|
|
var _tuple, key, tag, v;
|
|
tag = this.$val;
|
|
_tuple = new StructTag(tag).Lookup(key);
|
|
v = _tuple[0];
|
|
return v;
|
|
};
|
|
$ptrType(StructTag).prototype.Get = function(key) { return new StructTag(this.$get()).Get(key); };
|
|
StructTag.prototype.Lookup = function(key) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, err, i, key, name$1, ok, qvalue, tag, value, value$1;
|
|
value = "";
|
|
ok = false;
|
|
tag = this.$val;
|
|
while (true) {
|
|
if (!(!(tag === ""))) { break; }
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < tag.length && (tag.charCodeAt(i) === 32))) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
tag = $substring(tag, i);
|
|
if (tag === "") {
|
|
break;
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < tag.length && tag.charCodeAt(i) > 32 && !((tag.charCodeAt(i) === 58)) && !((tag.charCodeAt(i) === 34)) && !((tag.charCodeAt(i) === 127)))) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
if ((i === 0) || (i + 1 >> 0) >= tag.length || !((tag.charCodeAt(i) === 58)) || !((tag.charCodeAt((i + 1 >> 0)) === 34))) {
|
|
break;
|
|
}
|
|
name$1 = ($substring(tag, 0, i));
|
|
tag = $substring(tag, (i + 1 >> 0));
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < tag.length && !((tag.charCodeAt(i) === 34)))) { break; }
|
|
if (tag.charCodeAt(i) === 92) {
|
|
i = i + (1) >> 0;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (i >= tag.length) {
|
|
break;
|
|
}
|
|
qvalue = ($substring(tag, 0, (i + 1 >> 0)));
|
|
tag = $substring(tag, (i + 1 >> 0));
|
|
if (key === name$1) {
|
|
_tuple = strconv.Unquote(qvalue);
|
|
value$1 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
break;
|
|
}
|
|
_tmp = value$1;
|
|
_tmp$1 = true;
|
|
value = _tmp;
|
|
ok = _tmp$1;
|
|
return [value, ok];
|
|
}
|
|
}
|
|
_tmp$2 = "";
|
|
_tmp$3 = false;
|
|
value = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [value, ok];
|
|
};
|
|
$ptrType(StructTag).prototype.Lookup = function(key) { return new StructTag(this.$get()).Lookup(key); };
|
|
structType.ptr.prototype.Field = function(i) {
|
|
var f, i, p, t, tag, x;
|
|
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
|
|
t = this;
|
|
if (i < 0 || i >= t.fields.$length) {
|
|
$panic(new $String("reflect: Field index out of bounds"));
|
|
}
|
|
p = (x = t.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
f.Type = toType(p.typ);
|
|
f.Name = $clone(p.name, name).name();
|
|
f.Anonymous = p.embedded();
|
|
if (!$clone(p.name, name).isExported()) {
|
|
f.PkgPath = $clone(t.pkgPath, name).name();
|
|
}
|
|
tag = $clone(p.name, name).tag();
|
|
if (!(tag === "")) {
|
|
f.Tag = (tag);
|
|
}
|
|
f.Offset = p.offset();
|
|
f.Index = new sliceType$13([i]);
|
|
return f;
|
|
};
|
|
structType.prototype.Field = function(i) { return this.$val.Field(i); };
|
|
structType.ptr.prototype.FieldByIndex = function(index) {
|
|
var _i, _r, _r$1, _r$2, _r$3, _r$4, _ref, _v, f, ft, i, index, t, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _ref = $f._ref; _v = $f._v; f = $f.f; ft = $f.ft; i = $f.i; index = $f.index; t = $f.t; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
|
|
t = this;
|
|
f.Type = toType(t.rtype);
|
|
_ref = index;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
i = _i;
|
|
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (i > 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (i > 0) { */ case 3:
|
|
ft = f.Type;
|
|
_r = ft.Kind(); /* */ $s = 8; case 8: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
if (!(_r === 22)) { _v = false; $s = 7; continue s; }
|
|
_r$1 = ft.Elem(); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = _r$1.Kind(); /* */ $s = 10; case 10: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v = _r$2 === 25; case 7:
|
|
/* */ if (_v) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_v) { */ case 5:
|
|
_r$3 = ft.Elem(); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
ft = _r$3;
|
|
/* } */ case 6:
|
|
f.Type = ft;
|
|
/* } */ case 4:
|
|
_r$4 = f.Type.Field(x); /* */ $s = 12; case 12: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
StructField.copy(f, _r$4);
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return f;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByIndex }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._ref = _ref; $f._v = _v; $f.f = f; $f.ft = ft; $f.i = i; $f.index = index; $f.t = t; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
structType.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
|
|
structType.ptr.prototype.FieldByNameFunc = function(match) {
|
|
var _entry, _entry$1, _entry$2, _entry$3, _i, _i$1, _key, _key$1, _key$2, _key$3, _r, _r$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, count, current, f, fname, i, index, match, next, nextCount, ntyp, ok, result, scan, styp, t, t$1, visited, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _entry$3 = $f._entry$3; _i = $f._i; _i$1 = $f._i$1; _key = $f._key; _key$1 = $f._key$1; _key$2 = $f._key$2; _key$3 = $f._key$3; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; count = $f.count; current = $f.current; f = $f.f; fname = $f.fname; i = $f.i; index = $f.index; match = $f.match; next = $f.next; nextCount = $f.nextCount; ntyp = $f.ntyp; ok = $f.ok; result = $f.result; scan = $f.scan; styp = $f.styp; t = $f.t; t$1 = $f.t$1; visited = $f.visited; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
|
|
ok = false;
|
|
t = this;
|
|
current = new sliceType$14([]);
|
|
next = new sliceType$14([new fieldScan.ptr(t, sliceType$13.nil)]);
|
|
nextCount = false;
|
|
visited = $makeMap(ptrType$11.keyFor, []);
|
|
/* while (true) { */ case 1:
|
|
/* if (!(next.$length > 0)) { break; } */ if(!(next.$length > 0)) { $s = 2; continue; }
|
|
_tmp = next;
|
|
_tmp$1 = $subslice(current, 0, 0);
|
|
current = _tmp;
|
|
next = _tmp$1;
|
|
count = nextCount;
|
|
nextCount = false;
|
|
_ref = current;
|
|
_i = 0;
|
|
/* while (true) { */ case 3:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 4; continue; }
|
|
scan = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), fieldScan);
|
|
t$1 = scan.typ;
|
|
/* */ if ((_entry = visited[ptrType$11.keyFor(t$1)], _entry !== undefined ? _entry.v : false)) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if ((_entry = visited[ptrType$11.keyFor(t$1)], _entry !== undefined ? _entry.v : false)) { */ case 5:
|
|
_i++;
|
|
/* continue; */ $s = 3; continue;
|
|
/* } */ case 6:
|
|
_key = t$1; (visited || $throwRuntimeError("assignment to entry in nil map"))[ptrType$11.keyFor(_key)] = { k: _key, v: true };
|
|
_ref$1 = t$1.fields;
|
|
_i$1 = 0;
|
|
/* while (true) { */ case 7:
|
|
/* if (!(_i$1 < _ref$1.$length)) { break; } */ if(!(_i$1 < _ref$1.$length)) { $s = 8; continue; }
|
|
i = _i$1;
|
|
f = (x = t$1.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
fname = $clone(f.name, name).name();
|
|
ntyp = ptrType$1.nil;
|
|
/* */ if (f.embedded()) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (f.embedded()) { */ case 9:
|
|
ntyp = f.typ;
|
|
/* */ if (ntyp.Kind() === 22) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (ntyp.Kind() === 22) { */ case 11:
|
|
_r = ntyp.Elem().common(); /* */ $s = 13; case 13: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ntyp = _r;
|
|
/* } */ case 12:
|
|
/* } */ case 10:
|
|
_r$1 = match(fname); /* */ $s = 16; case 16: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 14; continue; }
|
|
/* */ $s = 15; continue;
|
|
/* if (_r$1) { */ case 14:
|
|
if ((_entry$1 = count[ptrType$11.keyFor(t$1)], _entry$1 !== undefined ? _entry$1.v : 0) > 1 || ok) {
|
|
_tmp$2 = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
|
|
_tmp$3 = false;
|
|
StructField.copy(result, _tmp$2);
|
|
ok = _tmp$3;
|
|
$s = -1; return [result, ok];
|
|
}
|
|
StructField.copy(result, t$1.Field(i));
|
|
result.Index = sliceType$13.nil;
|
|
result.Index = $appendSlice(result.Index, scan.index);
|
|
result.Index = $append(result.Index, i);
|
|
ok = true;
|
|
_i$1++;
|
|
/* continue; */ $s = 7; continue;
|
|
/* } */ case 15:
|
|
if (ok || ntyp === ptrType$1.nil || !((ntyp.Kind() === 25))) {
|
|
_i$1++;
|
|
/* continue; */ $s = 7; continue;
|
|
}
|
|
styp = (ntyp.kindType);
|
|
if ((_entry$2 = nextCount[ptrType$11.keyFor(styp)], _entry$2 !== undefined ? _entry$2.v : 0) > 0) {
|
|
_key$1 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$11.keyFor(_key$1)] = { k: _key$1, v: 2 };
|
|
_i$1++;
|
|
/* continue; */ $s = 7; continue;
|
|
}
|
|
if (nextCount === false) {
|
|
nextCount = $makeMap(ptrType$11.keyFor, []);
|
|
}
|
|
_key$2 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$11.keyFor(_key$2)] = { k: _key$2, v: 1 };
|
|
if ((_entry$3 = count[ptrType$11.keyFor(t$1)], _entry$3 !== undefined ? _entry$3.v : 0) > 1) {
|
|
_key$3 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$11.keyFor(_key$3)] = { k: _key$3, v: 2 };
|
|
}
|
|
index = sliceType$13.nil;
|
|
index = $appendSlice(index, scan.index);
|
|
index = $append(index, i);
|
|
next = $append(next, new fieldScan.ptr(styp, index));
|
|
_i$1++;
|
|
/* } */ $s = 7; continue; case 8:
|
|
_i++;
|
|
/* } */ $s = 3; continue; case 4:
|
|
if (ok) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [result, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByNameFunc }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._entry$3 = _entry$3; $f._i = _i; $f._i$1 = _i$1; $f._key = _key; $f._key$1 = _key$1; $f._key$2 = _key$2; $f._key$3 = _key$3; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.count = count; $f.current = current; $f.f = f; $f.fname = fname; $f.i = i; $f.index = index; $f.match = match; $f.next = next; $f.nextCount = nextCount; $f.ntyp = ntyp; $f.ok = ok; $f.result = result; $f.scan = scan; $f.styp = styp; $f.t = t; $f.t$1 = t$1; $f.visited = visited; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
structType.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
|
|
structType.ptr.prototype.FieldByName = function(name$1) {
|
|
var _i, _r, _ref, _tmp, _tmp$1, _tuple, f, hasEmbeds, i, name$1, present, t, tf, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; f = $f.f; hasEmbeds = $f.hasEmbeds; i = $f.i; name$1 = $f.name$1; present = $f.present; t = $f.t; tf = $f.tf; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
name$1 = [name$1];
|
|
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
|
|
present = false;
|
|
t = this;
|
|
hasEmbeds = false;
|
|
if (!(name$1[0] === "")) {
|
|
_ref = t.fields;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
tf = (x = t.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
if ($clone(tf.name, name).name() === name$1[0]) {
|
|
_tmp = $clone(t.Field(i), StructField);
|
|
_tmp$1 = true;
|
|
StructField.copy(f, _tmp);
|
|
present = _tmp$1;
|
|
$s = -1; return [f, present];
|
|
}
|
|
if (tf.embedded()) {
|
|
hasEmbeds = true;
|
|
}
|
|
_i++;
|
|
}
|
|
}
|
|
if (!hasEmbeds) {
|
|
$s = -1; return [f, present];
|
|
}
|
|
_r = t.FieldByNameFunc((function(name$1) { return function(s) {
|
|
var s;
|
|
return s === name$1[0];
|
|
}; })(name$1)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
StructField.copy(f, _tuple[0]);
|
|
present = _tuple[1];
|
|
$s = -1; return [f, present];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByName }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.f = f; $f.hasEmbeds = hasEmbeds; $f.i = i; $f.name$1 = name$1; $f.present = present; $f.t = t; $f.tf = tf; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
structType.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
|
|
PtrTo = function(t) {
|
|
var t;
|
|
return $assertType(t, ptrType$1).ptrTo();
|
|
};
|
|
$pkg.PtrTo = PtrTo;
|
|
rtype.ptr.prototype.Implements = function(u) {
|
|
var _r, t, u, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if ($interfaceIsEqual(u, $ifaceNil)) {
|
|
$panic(new $String("reflect: nil type passed to Type.Implements"));
|
|
}
|
|
_r = u.Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 20))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 20))) { */ case 1:
|
|
$panic(new $String("reflect: non-interface type passed to Type.Implements"));
|
|
/* } */ case 2:
|
|
$s = -1; return implements$1($assertType(u, ptrType$1), t);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Implements }; } $f._r = _r; $f.t = t; $f.u = u; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.Implements = function(u) { return this.$val.Implements(u); };
|
|
rtype.ptr.prototype.AssignableTo = function(u) {
|
|
var _r, t, u, uu, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; uu = $f.uu; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if ($interfaceIsEqual(u, $ifaceNil)) {
|
|
$panic(new $String("reflect: nil type passed to Type.AssignableTo"));
|
|
}
|
|
uu = $assertType(u, ptrType$1);
|
|
_r = directlyAssignable(uu, t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r || implements$1(uu, t);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.AssignableTo }; } $f._r = _r; $f.t = t; $f.u = u; $f.uu = uu; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.AssignableTo = function(u) { return this.$val.AssignableTo(u); };
|
|
rtype.ptr.prototype.ConvertibleTo = function(u) {
|
|
var _r, t, u, uu, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; uu = $f.uu; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if ($interfaceIsEqual(u, $ifaceNil)) {
|
|
$panic(new $String("reflect: nil type passed to Type.ConvertibleTo"));
|
|
}
|
|
uu = $assertType(u, ptrType$1);
|
|
_r = convertOp(uu, t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return !(_r === $throwNilPointerError);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.ConvertibleTo }; } $f._r = _r; $f.t = t; $f.u = u; $f.uu = uu; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rtype.prototype.ConvertibleTo = function(u) { return this.$val.ConvertibleTo(u); };
|
|
implements$1 = function(T, V) {
|
|
var T, V, i, i$1, j, j$1, t, tm, tm$1, tmName, tmName$1, tmPkgPath, tmPkgPath$1, v, v$1, vm, vm$1, vmName, vmName$1, vmPkgPath, vmPkgPath$1, vmethods, x, x$1, x$2;
|
|
if (!((T.Kind() === 20))) {
|
|
return false;
|
|
}
|
|
t = (T.kindType);
|
|
if (t.methods.$length === 0) {
|
|
return true;
|
|
}
|
|
if (V.Kind() === 20) {
|
|
v = (V.kindType);
|
|
i = 0;
|
|
j = 0;
|
|
while (true) {
|
|
if (!(j < v.methods.$length)) { break; }
|
|
tm = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
tmName = $clone(t.rtype.nameOff(tm.name), name);
|
|
vm = (x$1 = v.methods, ((j < 0 || j >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + j]));
|
|
vmName = $clone(V.nameOff(vm.name), name);
|
|
if ($clone(vmName, name).name() === $clone(tmName, name).name() && V.typeOff(vm.typ) === t.rtype.typeOff(tm.typ)) {
|
|
if (!$clone(tmName, name).isExported()) {
|
|
tmPkgPath = $clone(tmName, name).pkgPath();
|
|
if (tmPkgPath === "") {
|
|
tmPkgPath = $clone(t.pkgPath, name).name();
|
|
}
|
|
vmPkgPath = $clone(vmName, name).pkgPath();
|
|
if (vmPkgPath === "") {
|
|
vmPkgPath = $clone(v.pkgPath, name).name();
|
|
}
|
|
if (!(tmPkgPath === vmPkgPath)) {
|
|
j = j + (1) >> 0;
|
|
continue;
|
|
}
|
|
}
|
|
i = i + (1) >> 0;
|
|
if (i >= t.methods.$length) {
|
|
return true;
|
|
}
|
|
}
|
|
j = j + (1) >> 0;
|
|
}
|
|
return false;
|
|
}
|
|
v$1 = V.uncommon();
|
|
if (v$1 === ptrType$5.nil) {
|
|
return false;
|
|
}
|
|
i$1 = 0;
|
|
vmethods = v$1.methods();
|
|
j$1 = 0;
|
|
while (true) {
|
|
if (!(j$1 < ((v$1.mcount >> 0)))) { break; }
|
|
tm$1 = (x$2 = t.methods, ((i$1 < 0 || i$1 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i$1]));
|
|
tmName$1 = $clone(t.rtype.nameOff(tm$1.name), name);
|
|
vm$1 = $clone(((j$1 < 0 || j$1 >= vmethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : vmethods.$array[vmethods.$offset + j$1]), method);
|
|
vmName$1 = $clone(V.nameOff(vm$1.name), name);
|
|
if ($clone(vmName$1, name).name() === $clone(tmName$1, name).name() && V.typeOff(vm$1.mtyp) === t.rtype.typeOff(tm$1.typ)) {
|
|
if (!$clone(tmName$1, name).isExported()) {
|
|
tmPkgPath$1 = $clone(tmName$1, name).pkgPath();
|
|
if (tmPkgPath$1 === "") {
|
|
tmPkgPath$1 = $clone(t.pkgPath, name).name();
|
|
}
|
|
vmPkgPath$1 = $clone(vmName$1, name).pkgPath();
|
|
if (vmPkgPath$1 === "") {
|
|
vmPkgPath$1 = $clone(V.nameOff(v$1.pkgPath), name).name();
|
|
}
|
|
if (!(tmPkgPath$1 === vmPkgPath$1)) {
|
|
j$1 = j$1 + (1) >> 0;
|
|
continue;
|
|
}
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
if (i$1 >= t.methods.$length) {
|
|
return true;
|
|
}
|
|
}
|
|
j$1 = j$1 + (1) >> 0;
|
|
}
|
|
return false;
|
|
};
|
|
directlyAssignable = function(T, V) {
|
|
var T, V, _r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _r = $f._r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (T === V) {
|
|
$s = -1; return true;
|
|
}
|
|
if (!(T.Name() === "") && !(V.Name() === "") || !((T.Kind() === V.Kind()))) {
|
|
$s = -1; return false;
|
|
}
|
|
_r = haveIdenticalUnderlyingType(T, V, true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: directlyAssignable }; } $f.T = T; $f.V = V; $f._r = _r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
haveIdenticalType = function(T, V, cmpTags) {
|
|
var T, V, _arg, _arg$1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _v, cmpTags, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _v = $f._v; cmpTags = $f.cmpTags; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (cmpTags) {
|
|
$s = -1; return $interfaceIsEqual(T, V);
|
|
}
|
|
_r = T.Name(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = V.Name(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
if (!(_r === _r$1)) { _v = true; $s = 3; continue s; }
|
|
_r$2 = T.Kind(); /* */ $s = 6; case 6: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$3 = V.Kind(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_v = !((_r$2 === _r$3)); case 3:
|
|
/* */ if (_v) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_v) { */ case 1:
|
|
$s = -1; return false;
|
|
/* } */ case 2:
|
|
_r$4 = T.common(); /* */ $s = 8; case 8: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_arg = _r$4;
|
|
_r$5 = V.common(); /* */ $s = 9; case 9: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_arg$1 = _r$5;
|
|
_r$6 = haveIdenticalUnderlyingType(_arg, _arg$1, false); /* */ $s = 10; case 10: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$6;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: haveIdenticalType }; } $f.T = T; $f.V = V; $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._v = _v; $f.cmpTags = cmpTags; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
haveIdenticalUnderlyingType = function(T, V, cmpTags) {
|
|
var T, V, _1, _i, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _ref, _v, _v$1, _v$2, _v$3, cmpTags, i, i$1, i$2, kind, t, t$1, t$2, tf, v, v$1, v$2, vf, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _1 = $f._1; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _ref = $f._ref; _v = $f._v; _v$1 = $f._v$1; _v$2 = $f._v$2; _v$3 = $f._v$3; cmpTags = $f.cmpTags; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; kind = $f.kind; t = $f.t; t$1 = $f.t$1; t$2 = $f.t$2; tf = $f.tf; v = $f.v; v$1 = $f.v$1; v$2 = $f.v$2; vf = $f.vf; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (T === V) {
|
|
$s = -1; return true;
|
|
}
|
|
kind = T.Kind();
|
|
if (!((kind === V.Kind()))) {
|
|
$s = -1; return false;
|
|
}
|
|
if (1 <= kind && kind <= 16 || (kind === 24) || (kind === 26)) {
|
|
$s = -1; return true;
|
|
}
|
|
_1 = kind;
|
|
/* */ if (_1 === (17)) { $s = 2; continue; }
|
|
/* */ if (_1 === (18)) { $s = 3; continue; }
|
|
/* */ if (_1 === (19)) { $s = 4; continue; }
|
|
/* */ if (_1 === (20)) { $s = 5; continue; }
|
|
/* */ if (_1 === (21)) { $s = 6; continue; }
|
|
/* */ if ((_1 === (22)) || (_1 === (23))) { $s = 7; continue; }
|
|
/* */ if (_1 === (25)) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (_1 === (17)) { */ case 2:
|
|
if (!(T.Len() === V.Len())) { _v = false; $s = 10; continue s; }
|
|
_r = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 11; case 11: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 10:
|
|
$s = -1; return _v;
|
|
/* } else if (_1 === (18)) { */ case 3:
|
|
if (!(V.ChanDir() === 3)) { _v$1 = false; $s = 14; continue s; }
|
|
_r$1 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 15; case 15: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v$1 = _r$1; case 14:
|
|
/* */ if (_v$1) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (_v$1) { */ case 12:
|
|
$s = -1; return true;
|
|
/* } */ case 13:
|
|
if (!(V.ChanDir() === T.ChanDir())) { _v$2 = false; $s = 16; continue s; }
|
|
_r$2 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 17; case 17: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v$2 = _r$2; case 16:
|
|
$s = -1; return _v$2;
|
|
/* } else if (_1 === (19)) { */ case 4:
|
|
t = (T.kindType);
|
|
v = (V.kindType);
|
|
if (!((t.outCount === v.outCount)) || !((t.inCount === v.inCount))) {
|
|
$s = -1; return false;
|
|
}
|
|
i = 0;
|
|
/* while (true) { */ case 18:
|
|
/* if (!(i < t.rtype.NumIn())) { break; } */ if(!(i < t.rtype.NumIn())) { $s = 19; continue; }
|
|
_r$3 = haveIdenticalType(t.rtype.In(i), v.rtype.In(i), cmpTags); /* */ $s = 22; case 22: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$3) { $s = 20; continue; }
|
|
/* */ $s = 21; continue;
|
|
/* if (!_r$3) { */ case 20:
|
|
$s = -1; return false;
|
|
/* } */ case 21:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 18; continue; case 19:
|
|
i$1 = 0;
|
|
/* while (true) { */ case 23:
|
|
/* if (!(i$1 < t.rtype.NumOut())) { break; } */ if(!(i$1 < t.rtype.NumOut())) { $s = 24; continue; }
|
|
_r$4 = haveIdenticalType(t.rtype.Out(i$1), v.rtype.Out(i$1), cmpTags); /* */ $s = 27; case 27: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$4) { $s = 25; continue; }
|
|
/* */ $s = 26; continue;
|
|
/* if (!_r$4) { */ case 25:
|
|
$s = -1; return false;
|
|
/* } */ case 26:
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 23; continue; case 24:
|
|
$s = -1; return true;
|
|
/* } else if (_1 === (20)) { */ case 5:
|
|
t$1 = (T.kindType);
|
|
v$1 = (V.kindType);
|
|
if ((t$1.methods.$length === 0) && (v$1.methods.$length === 0)) {
|
|
$s = -1; return true;
|
|
}
|
|
$s = -1; return false;
|
|
/* } else if (_1 === (21)) { */ case 6:
|
|
_r$5 = haveIdenticalType(T.Key(), V.Key(), cmpTags); /* */ $s = 29; case 29: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
if (!(_r$5)) { _v$3 = false; $s = 28; continue s; }
|
|
_r$6 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 30; case 30: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_v$3 = _r$6; case 28:
|
|
$s = -1; return _v$3;
|
|
/* } else if ((_1 === (22)) || (_1 === (23))) { */ case 7:
|
|
_r$7 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 31; case 31: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$7;
|
|
/* } else if (_1 === (25)) { */ case 8:
|
|
t$2 = (T.kindType);
|
|
v$2 = (V.kindType);
|
|
if (!((t$2.fields.$length === v$2.fields.$length))) {
|
|
$s = -1; return false;
|
|
}
|
|
if (!($clone(t$2.pkgPath, name).name() === $clone(v$2.pkgPath, name).name())) {
|
|
$s = -1; return false;
|
|
}
|
|
_ref = t$2.fields;
|
|
_i = 0;
|
|
/* while (true) { */ case 32:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 33; continue; }
|
|
i$2 = _i;
|
|
tf = (x = t$2.fields, ((i$2 < 0 || i$2 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i$2]));
|
|
vf = (x$1 = v$2.fields, ((i$2 < 0 || i$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i$2]));
|
|
if (!($clone(tf.name, name).name() === $clone(vf.name, name).name())) {
|
|
$s = -1; return false;
|
|
}
|
|
_r$8 = haveIdenticalType(tf.typ, vf.typ, cmpTags); /* */ $s = 36; case 36: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$8) { $s = 34; continue; }
|
|
/* */ $s = 35; continue;
|
|
/* if (!_r$8) { */ case 34:
|
|
$s = -1; return false;
|
|
/* } */ case 35:
|
|
if (cmpTags && !($clone(tf.name, name).tag() === $clone(vf.name, name).tag())) {
|
|
$s = -1; return false;
|
|
}
|
|
if (!((tf.offsetEmbed === vf.offsetEmbed))) {
|
|
$s = -1; return false;
|
|
}
|
|
_i++;
|
|
/* } */ $s = 32; continue; case 33:
|
|
$s = -1; return true;
|
|
/* } */ case 9:
|
|
case 1:
|
|
$s = -1; return false;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: haveIdenticalUnderlyingType }; } $f.T = T; $f.V = V; $f._1 = _1; $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._ref = _ref; $f._v = _v; $f._v$1 = _v$1; $f._v$2 = _v$2; $f._v$3 = _v$3; $f.cmpTags = cmpTags; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.kind = kind; $f.t = t; $f.t$1 = t$1; $f.t$2 = t$2; $f.tf = tf; $f.v = v; $f.v$1 = v$1; $f.v$2 = v$2; $f.vf = vf; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
toType = function(t) {
|
|
var t;
|
|
if (t === ptrType$1.nil) {
|
|
return $ifaceNil;
|
|
}
|
|
return t;
|
|
};
|
|
ifaceIndir = function(t) {
|
|
var t;
|
|
return ((t.kind & 32) >>> 0) === 0;
|
|
};
|
|
flag.prototype.kind = function() {
|
|
var f;
|
|
f = this.$val;
|
|
return ((((f & 31) >>> 0) >>> 0));
|
|
};
|
|
$ptrType(flag).prototype.kind = function() { return new flag(this.$get()).kind(); };
|
|
flag.prototype.ro = function() {
|
|
var f;
|
|
f = this.$val;
|
|
if (!((((f & 96) >>> 0) === 0))) {
|
|
return 32;
|
|
}
|
|
return 0;
|
|
};
|
|
$ptrType(flag).prototype.ro = function() { return new flag(this.$get()).ro(); };
|
|
Value.ptr.prototype.pointer = function() {
|
|
var v;
|
|
v = this;
|
|
if (!((v.typ.size === 4)) || !v.typ.pointers()) {
|
|
$panic(new $String("can't call pointer on a non-pointer Value"));
|
|
}
|
|
if (!((((v.flag & 128) >>> 0) === 0))) {
|
|
return (v.ptr).$get();
|
|
}
|
|
return v.ptr;
|
|
};
|
|
Value.prototype.pointer = function() { return this.$val.pointer(); };
|
|
ValueError.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
if (e.Kind === 0) {
|
|
return "reflect: call of " + e.Method + " on zero Value";
|
|
}
|
|
return "reflect: call of " + e.Method + " on " + new Kind(e.Kind).String() + " Value";
|
|
};
|
|
ValueError.prototype.Error = function() { return this.$val.Error(); };
|
|
flag.prototype.mustBe = function(expected) {
|
|
var expected, f;
|
|
f = this.$val;
|
|
if (!((new flag(f).kind() === expected))) {
|
|
$panic(new ValueError.ptr(methodName(), new flag(f).kind()));
|
|
}
|
|
};
|
|
$ptrType(flag).prototype.mustBe = function(expected) { return new flag(this.$get()).mustBe(expected); };
|
|
flag.prototype.mustBeExported = function() {
|
|
var f;
|
|
f = this.$val;
|
|
if (f === 0) {
|
|
$panic(new ValueError.ptr(methodName(), 0));
|
|
}
|
|
if (!((((f & 96) >>> 0) === 0))) {
|
|
$panic(new $String("reflect: " + methodName() + " using value obtained using unexported field"));
|
|
}
|
|
};
|
|
$ptrType(flag).prototype.mustBeExported = function() { return new flag(this.$get()).mustBeExported(); };
|
|
flag.prototype.mustBeAssignable = function() {
|
|
var f;
|
|
f = this.$val;
|
|
if (f === 0) {
|
|
$panic(new ValueError.ptr(methodName(), 0));
|
|
}
|
|
if (!((((f & 96) >>> 0) === 0))) {
|
|
$panic(new $String("reflect: " + methodName() + " using value obtained using unexported field"));
|
|
}
|
|
if (((f & 256) >>> 0) === 0) {
|
|
$panic(new $String("reflect: " + methodName() + " using unaddressable value"));
|
|
}
|
|
};
|
|
$ptrType(flag).prototype.mustBeAssignable = function() { return new flag(this.$get()).mustBeAssignable(); };
|
|
Value.ptr.prototype.Addr = function() {
|
|
var v;
|
|
v = this;
|
|
if (((v.flag & 256) >>> 0) === 0) {
|
|
$panic(new $String("reflect.Value.Addr of unaddressable value"));
|
|
}
|
|
return new Value.ptr(v.typ.ptrTo(), v.ptr, (new flag(v.flag).ro() | 22) >>> 0);
|
|
};
|
|
Value.prototype.Addr = function() { return this.$val.Addr(); };
|
|
Value.ptr.prototype.Bool = function() {
|
|
var v;
|
|
v = this;
|
|
new flag(v.flag).mustBe(1);
|
|
return (v.ptr).$get();
|
|
};
|
|
Value.prototype.Bool = function() { return this.$val.Bool(); };
|
|
Value.ptr.prototype.Bytes = function() {
|
|
var _r, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(23);
|
|
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 8))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 8))) { */ case 1:
|
|
$panic(new $String("reflect.Value.Bytes of non-byte slice"));
|
|
/* } */ case 2:
|
|
$s = -1; return (v.ptr).$get();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Bytes }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Bytes = function() { return this.$val.Bytes(); };
|
|
Value.ptr.prototype.runes = function() {
|
|
var _r, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(23);
|
|
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 5))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 5))) { */ case 1:
|
|
$panic(new $String("reflect.Value.Bytes of non-rune slice"));
|
|
/* } */ case 2:
|
|
$s = -1; return (v.ptr).$get();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.runes }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.runes = function() { return this.$val.runes(); };
|
|
Value.ptr.prototype.CanAddr = function() {
|
|
var v;
|
|
v = this;
|
|
return !((((v.flag & 256) >>> 0) === 0));
|
|
};
|
|
Value.prototype.CanAddr = function() { return this.$val.CanAddr(); };
|
|
Value.ptr.prototype.CanSet = function() {
|
|
var v;
|
|
v = this;
|
|
return ((v.flag & 352) >>> 0) === 256;
|
|
};
|
|
Value.prototype.CanSet = function() { return this.$val.CanSet(); };
|
|
Value.ptr.prototype.Call = function(in$1) {
|
|
var _r, in$1, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; in$1 = $f.in$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(19);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).call("Call", in$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Call }; } $f._r = _r; $f.in$1 = in$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Call = function(in$1) { return this.$val.Call(in$1); };
|
|
Value.ptr.prototype.CallSlice = function(in$1) {
|
|
var _r, in$1, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; in$1 = $f.in$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(19);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).call("CallSlice", in$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.CallSlice }; } $f._r = _r; $f.in$1 = in$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.CallSlice = function(in$1) { return this.$val.CallSlice(in$1); };
|
|
Value.ptr.prototype.Complex = function() {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (15)) {
|
|
return ((x = (v.ptr).$get(), new $Complex128(x.$real, x.$imag)));
|
|
} else if (_1 === (16)) {
|
|
return (v.ptr).$get();
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.Complex", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.Complex = function() { return this.$val.Complex(); };
|
|
Value.ptr.prototype.FieldByIndex = function(index) {
|
|
var _i, _r, _r$1, _r$2, _r$3, _ref, _v, i, index, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _ref = $f._ref; _v = $f._v; i = $f.i; index = $f.index; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
/* */ if (index.$length === 1) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (index.$length === 1) { */ case 1:
|
|
_r = $clone(v, Value).Field((0 >= index.$length ? ($throwRuntimeError("index out of range"), undefined) : index.$array[index.$offset + 0])); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
new flag(v.flag).mustBe(25);
|
|
_ref = index;
|
|
_i = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
|
|
i = _i;
|
|
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (i > 0) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (i > 0) { */ case 6:
|
|
if (!($clone(v, Value).Kind() === 22)) { _v = false; $s = 10; continue s; }
|
|
_r$1 = v.typ.Elem().Kind(); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v = _r$1 === 25; case 10:
|
|
/* */ if (_v) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (_v) { */ case 8:
|
|
if ($clone(v, Value).IsNil()) {
|
|
$panic(new $String("reflect: indirection through nil pointer to embedded struct"));
|
|
}
|
|
_r$2 = $clone(v, Value).Elem(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
/* } */ case 9:
|
|
/* } */ case 7:
|
|
_r$3 = $clone(v, Value).Field(x); /* */ $s = 13; case 13: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
v = _r$3;
|
|
_i++;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return v;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByIndex }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._ref = _ref; $f._v = _v; $f.i = i; $f.index = index; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
|
|
Value.ptr.prototype.FieldByName = function(name$1) {
|
|
var _r, _r$1, _tuple, f, name$1, ok, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; f = $f.f; name$1 = $f.name$1; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(25);
|
|
_r = v.typ.FieldByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
f = $clone(_tuple[0], StructField);
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (ok) { */ case 2:
|
|
_r$1 = $clone(v, Value).FieldByIndex(f.Index); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } */ case 3:
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByName }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.f = f; $f.name$1 = name$1; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
|
|
Value.ptr.prototype.FieldByNameFunc = function(match) {
|
|
var _r, _r$1, _tuple, f, match, ok, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; f = $f.f; match = $f.match; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
_r = v.typ.FieldByNameFunc(match); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
f = $clone(_tuple[0], StructField);
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (ok) { */ case 2:
|
|
_r$1 = $clone(v, Value).FieldByIndex(f.Index); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } */ case 3:
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByNameFunc }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.f = f; $f.match = match; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
|
|
Value.ptr.prototype.Float = function() {
|
|
var _1, k, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (13)) {
|
|
return ((v.ptr).$get());
|
|
} else if (_1 === (14)) {
|
|
return (v.ptr).$get();
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.Float", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.Float = function() { return this.$val.Float(); };
|
|
Value.ptr.prototype.Int = function() {
|
|
var _1, k, p, v;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
p = v.ptr;
|
|
_1 = k;
|
|
if (_1 === (2)) {
|
|
return (new $Int64(0, (p).$get()));
|
|
} else if (_1 === (3)) {
|
|
return (new $Int64(0, (p).$get()));
|
|
} else if (_1 === (4)) {
|
|
return (new $Int64(0, (p).$get()));
|
|
} else if (_1 === (5)) {
|
|
return (new $Int64(0, (p).$get()));
|
|
} else if (_1 === (6)) {
|
|
return (p).$get();
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.Int", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.Int = function() { return this.$val.Int(); };
|
|
Value.ptr.prototype.CanInterface = function() {
|
|
var v;
|
|
v = this;
|
|
if (v.flag === 0) {
|
|
$panic(new ValueError.ptr("reflect.Value.CanInterface", 0));
|
|
}
|
|
return ((v.flag & 96) >>> 0) === 0;
|
|
};
|
|
Value.prototype.CanInterface = function() { return this.$val.CanInterface(); };
|
|
Value.ptr.prototype.Interface = function() {
|
|
var _r, i, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = $ifaceNil;
|
|
v = this;
|
|
_r = valueInterface($clone(v, Value), true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
i = _r;
|
|
$s = -1; return i;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Interface }; } $f._r = _r; $f.i = i; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Interface = function() { return this.$val.Interface(); };
|
|
Value.ptr.prototype.IsValid = function() {
|
|
var v;
|
|
v = this;
|
|
return !((v.flag === 0));
|
|
};
|
|
Value.prototype.IsValid = function() { return this.$val.IsValid(); };
|
|
Value.ptr.prototype.Kind = function() {
|
|
var v;
|
|
v = this;
|
|
return new flag(v.flag).kind();
|
|
};
|
|
Value.prototype.Kind = function() { return this.$val.Kind(); };
|
|
Value.ptr.prototype.MapIndex = function(key) {
|
|
var _r, e, fl, k, key, tt, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; fl = $f.fl; k = $f.k; key = $f.key; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(21);
|
|
tt = (v.typ.kindType);
|
|
_r = $clone(key, Value).assignTo("reflect.Value.MapIndex", tt.key, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
key = _r;
|
|
k = 0;
|
|
if (!((((key.flag & 128) >>> 0) === 0))) {
|
|
k = key.ptr;
|
|
} else {
|
|
k = ((key.$ptr_ptr || (key.$ptr_ptr = new ptrType$17(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, key))));
|
|
}
|
|
e = mapaccess(v.typ, $clone(v, Value).pointer(), k);
|
|
if (e === 0) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
typ = tt.elem;
|
|
fl = new flag((((v.flag | key.flag) >>> 0))).ro();
|
|
fl = (fl | (((typ.Kind() >>> 0)))) >>> 0;
|
|
$s = -1; return copyVal(typ, fl, e);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MapIndex }; } $f._r = _r; $f.e = e; $f.fl = fl; $f.k = k; $f.key = key; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.MapIndex = function(key) { return this.$val.MapIndex(key); };
|
|
Value.ptr.prototype.MapKeys = function() {
|
|
var _r, a, fl, i, it, key, keyType, m, mlen, tt, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; fl = $f.fl; i = $f.i; it = $f.it; key = $f.key; keyType = $f.keyType; m = $f.m; mlen = $f.mlen; tt = $f.tt; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(21);
|
|
tt = (v.typ.kindType);
|
|
keyType = tt.key;
|
|
fl = (new flag(v.flag).ro() | ((keyType.Kind() >>> 0))) >>> 0;
|
|
m = $clone(v, Value).pointer();
|
|
mlen = 0;
|
|
if (!(m === 0)) {
|
|
mlen = maplen(m);
|
|
}
|
|
it = mapiterinit(v.typ, m);
|
|
a = $makeSlice(sliceType$9, mlen);
|
|
i = 0;
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < a.$length)) { break; } */ if(!(i < a.$length)) { $s = 2; continue; }
|
|
_r = mapiterkey(it); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
key = _r;
|
|
if (key === 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = copyVal(keyType, fl, key));
|
|
mapiternext(it);
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return $subslice(a, 0, i);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MapKeys }; } $f._r = _r; $f.a = a; $f.fl = fl; $f.i = i; $f.it = it; $f.key = key; $f.keyType = keyType; $f.m = m; $f.mlen = mlen; $f.tt = tt; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.MapKeys = function() { return this.$val.MapKeys(); };
|
|
MapIter.ptr.prototype.Key = function() {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, _r$2, it, ktype, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; it = $f.it; ktype = $f.ktype; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
it = this;
|
|
if (it.it === 0) {
|
|
$panic(new $String("MapIter.Key called before Next"));
|
|
}
|
|
_r = mapiterkey(it.it); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r === 0) { */ case 1:
|
|
$panic(new $String("MapIter.Key called on exhausted iterator"));
|
|
/* } */ case 2:
|
|
t = (it.m.typ.kindType);
|
|
ktype = t.key;
|
|
_arg = ktype;
|
|
_arg$1 = (new flag(it.m.flag).ro() | ((ktype.Kind() >>> 0))) >>> 0;
|
|
_r$1 = mapiterkey(it.it); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$1;
|
|
_r$2 = copyVal(_arg, _arg$1, _arg$2); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: MapIter.ptr.prototype.Key }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.it = it; $f.ktype = ktype; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
MapIter.prototype.Key = function() { return this.$val.Key(); };
|
|
MapIter.ptr.prototype.Value = function() {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, _r$2, it, t, vtype, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; it = $f.it; t = $f.t; vtype = $f.vtype; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
it = this;
|
|
if (it.it === 0) {
|
|
$panic(new $String("MapIter.Value called before Next"));
|
|
}
|
|
_r = mapiterkey(it.it); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r === 0) { */ case 1:
|
|
$panic(new $String("MapIter.Value called on exhausted iterator"));
|
|
/* } */ case 2:
|
|
t = (it.m.typ.kindType);
|
|
vtype = t.elem;
|
|
_arg = vtype;
|
|
_arg$1 = (new flag(it.m.flag).ro() | ((vtype.Kind() >>> 0))) >>> 0;
|
|
_r$1 = mapitervalue(it.it); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$1;
|
|
_r$2 = copyVal(_arg, _arg$1, _arg$2); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: MapIter.ptr.prototype.Value }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.it = it; $f.t = t; $f.vtype = vtype; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
MapIter.prototype.Value = function() { return this.$val.Value(); };
|
|
MapIter.ptr.prototype.Next = function() {
|
|
var _r, _r$1, it, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; it = $f.it; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
it = this;
|
|
/* */ if (it.it === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (it.it === 0) { */ case 1:
|
|
it.it = mapiterinit(it.m.typ, $clone(it.m, Value).pointer());
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
_r = mapiterkey(it.it); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r === 0) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_r === 0) { */ case 4:
|
|
$panic(new $String("MapIter.Next called on exhausted iterator"));
|
|
/* } */ case 5:
|
|
mapiternext(it.it);
|
|
/* } */ case 3:
|
|
_r$1 = mapiterkey(it.it); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return !(_r$1 === 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: MapIter.ptr.prototype.Next }; } $f._r = _r; $f._r$1 = _r$1; $f.it = it; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
MapIter.prototype.Next = function() { return this.$val.Next(); };
|
|
Value.ptr.prototype.MapRange = function() {
|
|
var v;
|
|
v = this;
|
|
new flag(v.flag).mustBe(21);
|
|
return new MapIter.ptr($clone(v, Value), 0);
|
|
};
|
|
Value.prototype.MapRange = function() { return this.$val.MapRange(); };
|
|
copyVal = function(typ, fl, ptr) {
|
|
var c, fl, ptr, typ;
|
|
if (ifaceIndir(typ)) {
|
|
c = unsafe_New(typ);
|
|
typedmemmove(typ, c, ptr);
|
|
return new Value.ptr(typ, c, (fl | 128) >>> 0);
|
|
}
|
|
return new Value.ptr(typ, (ptr).$get(), fl);
|
|
};
|
|
Value.ptr.prototype.Method = function(i) {
|
|
var fl, i, v;
|
|
v = this;
|
|
if (v.typ === ptrType$1.nil) {
|
|
$panic(new ValueError.ptr("reflect.Value.Method", 0));
|
|
}
|
|
if (!((((v.flag & 512) >>> 0) === 0)) || ((i >>> 0)) >= ((v.typ.NumMethod() >>> 0))) {
|
|
$panic(new $String("reflect: Method index out of range"));
|
|
}
|
|
if ((v.typ.Kind() === 20) && $clone(v, Value).IsNil()) {
|
|
$panic(new $String("reflect: Method on nil interface value"));
|
|
}
|
|
fl = (v.flag & 160) >>> 0;
|
|
fl = (fl | (19)) >>> 0;
|
|
fl = (fl | ((((((i >>> 0)) << 10 >>> 0) | 512) >>> 0))) >>> 0;
|
|
return new Value.ptr(v.typ, v.ptr, fl);
|
|
};
|
|
Value.prototype.Method = function(i) { return this.$val.Method(i); };
|
|
Value.ptr.prototype.NumMethod = function() {
|
|
var v;
|
|
v = this;
|
|
if (v.typ === ptrType$1.nil) {
|
|
$panic(new ValueError.ptr("reflect.Value.NumMethod", 0));
|
|
}
|
|
if (!((((v.flag & 512) >>> 0) === 0))) {
|
|
return 0;
|
|
}
|
|
return v.typ.NumMethod();
|
|
};
|
|
Value.prototype.NumMethod = function() { return this.$val.NumMethod(); };
|
|
Value.ptr.prototype.MethodByName = function(name$1) {
|
|
var _r, _tuple, m, name$1, ok, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; m = $f.m; name$1 = $f.name$1; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
if (v.typ === ptrType$1.nil) {
|
|
$panic(new ValueError.ptr("reflect.Value.MethodByName", 0));
|
|
}
|
|
if (!((((v.flag & 512) >>> 0) === 0))) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
_r = v.typ.MethodByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
m = $clone(_tuple[0], Method);
|
|
ok = _tuple[1];
|
|
if (!ok) {
|
|
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
$s = -1; return $clone(v, Value).Method(m.Index);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MethodByName }; } $f._r = _r; $f._tuple = _tuple; $f.m = m; $f.name$1 = name$1; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
|
|
Value.ptr.prototype.NumField = function() {
|
|
var tt, v;
|
|
v = this;
|
|
new flag(v.flag).mustBe(25);
|
|
tt = (v.typ.kindType);
|
|
return tt.fields.$length;
|
|
};
|
|
Value.prototype.NumField = function() { return this.$val.NumField(); };
|
|
Value.ptr.prototype.OverflowComplex = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (15)) {
|
|
return overflowFloat32(x.$real) || overflowFloat32(x.$imag);
|
|
} else if (_1 === (16)) {
|
|
return false;
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.OverflowComplex", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.OverflowComplex = function(x) { return this.$val.OverflowComplex(x); };
|
|
Value.ptr.prototype.OverflowFloat = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (13)) {
|
|
return overflowFloat32(x);
|
|
} else if (_1 === (14)) {
|
|
return false;
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.OverflowFloat", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.OverflowFloat = function(x) { return this.$val.OverflowFloat(x); };
|
|
overflowFloat32 = function(x) {
|
|
var x;
|
|
if (x < 0) {
|
|
x = -x;
|
|
}
|
|
return 3.4028234663852886e+38 < x && x <= 1.7976931348623157e+308;
|
|
};
|
|
Value.ptr.prototype.OverflowInt = function(x) {
|
|
var _1, bitSize, k, trunc, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) {
|
|
bitSize = $imul(v.typ.size, 8) >>> 0;
|
|
trunc = $shiftRightInt64(($shiftLeft64(x, ((64 - bitSize >>> 0)))), ((64 - bitSize >>> 0)));
|
|
return !((x.$high === trunc.$high && x.$low === trunc.$low));
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.OverflowInt", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.OverflowInt = function(x) { return this.$val.OverflowInt(x); };
|
|
Value.ptr.prototype.OverflowUint = function(x) {
|
|
var _1, bitSize, k, trunc, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if ((_1 === (7)) || (_1 === (12)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) {
|
|
bitSize = $imul(v.typ.size, 8) >>> 0;
|
|
trunc = $shiftRightUint64(($shiftLeft64(x, ((64 - bitSize >>> 0)))), ((64 - bitSize >>> 0)));
|
|
return !((x.$high === trunc.$high && x.$low === trunc.$low));
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.OverflowUint", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.OverflowUint = function(x) { return this.$val.OverflowUint(x); };
|
|
Value.ptr.prototype.Recv = function() {
|
|
var _r, _tuple, ok, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
x = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
ok = false;
|
|
v = this;
|
|
new flag(v.flag).mustBe(18);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).recv(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
x = _tuple[0];
|
|
ok = _tuple[1];
|
|
$s = -1; return [x, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Recv }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Recv = function() { return this.$val.Recv(); };
|
|
Value.ptr.prototype.recv = function(nb) {
|
|
var _r, _tuple, nb, ok, p, selected, t, tt, v, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; nb = $f.nb; ok = $f.ok; p = $f.p; selected = $f.selected; t = $f.t; tt = $f.tt; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
val = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
ok = false;
|
|
v = this;
|
|
tt = (v.typ.kindType);
|
|
if ((((tt.dir >> 0)) & 1) === 0) {
|
|
$panic(new $String("reflect: recv on send-only channel"));
|
|
}
|
|
t = tt.elem;
|
|
val = new Value.ptr(t, 0, ((t.Kind() >>> 0)));
|
|
p = 0;
|
|
if (ifaceIndir(t)) {
|
|
p = unsafe_New(t);
|
|
val.ptr = p;
|
|
val.flag = (val.flag | (128)) >>> 0;
|
|
} else {
|
|
p = ((val.$ptr_ptr || (val.$ptr_ptr = new ptrType$17(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, val))));
|
|
}
|
|
_r = chanrecv($clone(v, Value).pointer(), nb, p); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
selected = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!selected) {
|
|
val = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
}
|
|
$s = -1; return [val, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.recv }; } $f._r = _r; $f._tuple = _tuple; $f.nb = nb; $f.ok = ok; $f.p = p; $f.selected = selected; $f.t = t; $f.tt = tt; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.recv = function(nb) { return this.$val.recv(nb); };
|
|
Value.ptr.prototype.Send = function(x) {
|
|
var _r, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(18);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).send($clone(x, Value), false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Send }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Send = function(x) { return this.$val.Send(x); };
|
|
Value.ptr.prototype.send = function(x, nb) {
|
|
var _r, _r$1, nb, p, selected, tt, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; nb = $f.nb; p = $f.p; selected = $f.selected; tt = $f.tt; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
selected = false;
|
|
v = this;
|
|
tt = (v.typ.kindType);
|
|
if ((((tt.dir >> 0)) & 2) === 0) {
|
|
$panic(new $String("reflect: send on recv-only channel"));
|
|
}
|
|
new flag(x.flag).mustBeExported();
|
|
_r = $clone(x, Value).assignTo("reflect.Value.Send", tt.elem, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
x = _r;
|
|
p = 0;
|
|
if (!((((x.flag & 128) >>> 0) === 0))) {
|
|
p = x.ptr;
|
|
} else {
|
|
p = ((x.$ptr_ptr || (x.$ptr_ptr = new ptrType$17(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, x))));
|
|
}
|
|
_r$1 = chansend($clone(v, Value).pointer(), p, nb); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
selected = _r$1;
|
|
$s = -1; return selected;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.send }; } $f._r = _r; $f._r$1 = _r$1; $f.nb = nb; $f.p = p; $f.selected = selected; $f.tt = tt; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.send = function(x, nb) { return this.$val.send(x, nb); };
|
|
Value.ptr.prototype.SetBool = function(x) {
|
|
var v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(1);
|
|
(v.ptr).$set(x);
|
|
};
|
|
Value.prototype.SetBool = function(x) { return this.$val.SetBool(x); };
|
|
Value.ptr.prototype.setRunes = function(x) {
|
|
var _r, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(23);
|
|
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 5))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 5))) { */ case 1:
|
|
$panic(new $String("reflect.Value.setRunes of non-rune slice"));
|
|
/* } */ case 2:
|
|
(v.ptr).$set(x);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.setRunes }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.setRunes = function(x) { return this.$val.setRunes(x); };
|
|
Value.ptr.prototype.SetComplex = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (15)) {
|
|
(v.ptr).$set((new $Complex64(x.$real, x.$imag)));
|
|
} else if (_1 === (16)) {
|
|
(v.ptr).$set(x);
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.SetComplex", new flag(v.flag).kind()));
|
|
}
|
|
};
|
|
Value.prototype.SetComplex = function(x) { return this.$val.SetComplex(x); };
|
|
Value.ptr.prototype.SetFloat = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (13)) {
|
|
(v.ptr).$set(($fround(x)));
|
|
} else if (_1 === (14)) {
|
|
(v.ptr).$set(x);
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.SetFloat", new flag(v.flag).kind()));
|
|
}
|
|
};
|
|
Value.prototype.SetFloat = function(x) { return this.$val.SetFloat(x); };
|
|
Value.ptr.prototype.SetInt = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (2)) {
|
|
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) >> 0)));
|
|
} else if (_1 === (3)) {
|
|
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) << 24 >> 24)));
|
|
} else if (_1 === (4)) {
|
|
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) << 16 >> 16)));
|
|
} else if (_1 === (5)) {
|
|
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) >> 0)));
|
|
} else if (_1 === (6)) {
|
|
(v.ptr).$set(x);
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.SetInt", new flag(v.flag).kind()));
|
|
}
|
|
};
|
|
Value.prototype.SetInt = function(x) { return this.$val.SetInt(x); };
|
|
Value.ptr.prototype.SetMapIndex = function(key, val) {
|
|
var _r, _r$1, e, k, key, tt, v, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; e = $f.e; k = $f.k; key = $f.key; tt = $f.tt; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(21);
|
|
new flag(v.flag).mustBeExported();
|
|
new flag(key.flag).mustBeExported();
|
|
tt = (v.typ.kindType);
|
|
_r = $clone(key, Value).assignTo("reflect.Value.SetMapIndex", tt.key, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
key = _r;
|
|
k = 0;
|
|
if (!((((key.flag & 128) >>> 0) === 0))) {
|
|
k = key.ptr;
|
|
} else {
|
|
k = ((key.$ptr_ptr || (key.$ptr_ptr = new ptrType$17(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, key))));
|
|
}
|
|
if (val.typ === ptrType$1.nil) {
|
|
mapdelete(v.typ, $clone(v, Value).pointer(), k);
|
|
$s = -1; return;
|
|
}
|
|
new flag(val.flag).mustBeExported();
|
|
_r$1 = $clone(val, Value).assignTo("reflect.Value.SetMapIndex", tt.elem, 0); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
e = 0;
|
|
if (!((((val.flag & 128) >>> 0) === 0))) {
|
|
e = val.ptr;
|
|
} else {
|
|
e = ((val.$ptr_ptr || (val.$ptr_ptr = new ptrType$17(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, val))));
|
|
}
|
|
$r = mapassign(v.typ, $clone(v, Value).pointer(), k, e); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.SetMapIndex }; } $f._r = _r; $f._r$1 = _r$1; $f.e = e; $f.k = k; $f.key = key; $f.tt = tt; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.SetMapIndex = function(key, val) { return this.$val.SetMapIndex(key, val); };
|
|
Value.ptr.prototype.SetUint = function(x) {
|
|
var _1, k, v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (7)) {
|
|
(v.ptr).$set(((x.$low >>> 0)));
|
|
} else if (_1 === (8)) {
|
|
(v.ptr).$set(((x.$low << 24 >>> 24)));
|
|
} else if (_1 === (9)) {
|
|
(v.ptr).$set(((x.$low << 16 >>> 16)));
|
|
} else if (_1 === (10)) {
|
|
(v.ptr).$set(((x.$low >>> 0)));
|
|
} else if (_1 === (11)) {
|
|
(v.ptr).$set(x);
|
|
} else if (_1 === (12)) {
|
|
(v.ptr).$set(((x.$low >>> 0)));
|
|
} else {
|
|
$panic(new ValueError.ptr("reflect.Value.SetUint", new flag(v.flag).kind()));
|
|
}
|
|
};
|
|
Value.prototype.SetUint = function(x) { return this.$val.SetUint(x); };
|
|
Value.ptr.prototype.SetPointer = function(x) {
|
|
var v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(26);
|
|
(v.ptr).$set(x);
|
|
};
|
|
Value.prototype.SetPointer = function(x) { return this.$val.SetPointer(x); };
|
|
Value.ptr.prototype.SetString = function(x) {
|
|
var v, x;
|
|
v = this;
|
|
new flag(v.flag).mustBeAssignable();
|
|
new flag(v.flag).mustBe(24);
|
|
(v.ptr).$set(x);
|
|
};
|
|
Value.prototype.SetString = function(x) { return this.$val.SetString(x); };
|
|
Value.ptr.prototype.String = function() {
|
|
var _1, _r, k, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; k = $f.k; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
_1 = k;
|
|
if (_1 === (0)) {
|
|
$s = -1; return "<invalid Value>";
|
|
} else if (_1 === (24)) {
|
|
$s = -1; return (v.ptr).$get();
|
|
}
|
|
_r = $clone(v, Value).Type().String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return "<" + _r + " Value>";
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.String }; } $f._1 = _1; $f._r = _r; $f.k = k; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.String = function() { return this.$val.String(); };
|
|
Value.ptr.prototype.TryRecv = function() {
|
|
var _r, _tuple, ok, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
x = new Value.ptr(ptrType$1.nil, 0, 0);
|
|
ok = false;
|
|
v = this;
|
|
new flag(v.flag).mustBe(18);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).recv(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
x = _tuple[0];
|
|
ok = _tuple[1];
|
|
$s = -1; return [x, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.TryRecv }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.TryRecv = function() { return this.$val.TryRecv(); };
|
|
Value.ptr.prototype.TrySend = function(x) {
|
|
var _r, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
new flag(v.flag).mustBe(18);
|
|
new flag(v.flag).mustBeExported();
|
|
_r = $clone(v, Value).send($clone(x, Value), true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.TrySend }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.TrySend = function(x) { return this.$val.TrySend(x); };
|
|
Value.ptr.prototype.Type = function() {
|
|
var f, i, m, m$1, ms, tt, v, x;
|
|
v = this;
|
|
f = v.flag;
|
|
if (f === 0) {
|
|
$panic(new ValueError.ptr("reflect.Value.Type", 0));
|
|
}
|
|
if (((f & 512) >>> 0) === 0) {
|
|
return v.typ;
|
|
}
|
|
i = ((v.flag >> 0)) >> 10 >> 0;
|
|
if (v.typ.Kind() === 20) {
|
|
tt = (v.typ.kindType);
|
|
if (((i >>> 0)) >= ((tt.methods.$length >>> 0))) {
|
|
$panic(new $String("reflect: internal error: invalid method index"));
|
|
}
|
|
m = (x = tt.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
|
|
return v.typ.typeOff(m.typ);
|
|
}
|
|
ms = v.typ.exportedMethods();
|
|
if (((i >>> 0)) >= ((ms.$length >>> 0))) {
|
|
$panic(new $String("reflect: internal error: invalid method index"));
|
|
}
|
|
m$1 = $clone(((i < 0 || i >= ms.$length) ? ($throwRuntimeError("index out of range"), undefined) : ms.$array[ms.$offset + i]), method);
|
|
return v.typ.typeOff(m$1.mtyp);
|
|
};
|
|
Value.prototype.Type = function() { return this.$val.Type(); };
|
|
Value.ptr.prototype.Uint = function() {
|
|
var _1, k, p, v, x;
|
|
v = this;
|
|
k = new flag(v.flag).kind();
|
|
p = v.ptr;
|
|
_1 = k;
|
|
if (_1 === (7)) {
|
|
return (new $Uint64(0, (p).$get()));
|
|
} else if (_1 === (8)) {
|
|
return (new $Uint64(0, (p).$get()));
|
|
} else if (_1 === (9)) {
|
|
return (new $Uint64(0, (p).$get()));
|
|
} else if (_1 === (10)) {
|
|
return (new $Uint64(0, (p).$get()));
|
|
} else if (_1 === (11)) {
|
|
return (p).$get();
|
|
} else if (_1 === (12)) {
|
|
return ((x = (p).$get(), new $Uint64(0, x.constructor === Number ? x : 1)));
|
|
}
|
|
$panic(new ValueError.ptr("reflect.Value.Uint", new flag(v.flag).kind()));
|
|
};
|
|
Value.prototype.Uint = function() { return this.$val.Uint(); };
|
|
Value.ptr.prototype.UnsafeAddr = function() {
|
|
var v;
|
|
v = this;
|
|
if (v.typ === ptrType$1.nil) {
|
|
$panic(new ValueError.ptr("reflect.Value.UnsafeAddr", 0));
|
|
}
|
|
if (((v.flag & 256) >>> 0) === 0) {
|
|
$panic(new $String("reflect.Value.UnsafeAddr of unaddressable value"));
|
|
}
|
|
return (v.ptr);
|
|
};
|
|
Value.prototype.UnsafeAddr = function() { return this.$val.UnsafeAddr(); };
|
|
Indirect = function(v) {
|
|
var _r, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (!(($clone(v, Value).Kind() === 22))) {
|
|
$s = -1; return v;
|
|
}
|
|
_r = $clone(v, Value).Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Indirect }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Indirect = Indirect;
|
|
New = function(typ) {
|
|
var fl, ptr, t, typ;
|
|
if ($interfaceIsEqual(typ, $ifaceNil)) {
|
|
$panic(new $String("reflect: New(nil)"));
|
|
}
|
|
t = $assertType(typ, ptrType$1);
|
|
ptr = unsafe_New(t);
|
|
fl = 22;
|
|
return new Value.ptr(t.ptrTo(), ptr, fl);
|
|
};
|
|
$pkg.New = New;
|
|
Value.ptr.prototype.Convert = function(t) {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, op, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; op = $f.op; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this;
|
|
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
|
|
_r = makeMethodValue("Convert", $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
/* } */ case 2:
|
|
_r$1 = t.common(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = convertOp(_r$1, v.typ); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
op = _r$2;
|
|
/* */ if (op === $throwNilPointerError) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (op === $throwNilPointerError) { */ case 6:
|
|
_r$3 = t.String(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$panic(new $String("reflect.Value.Convert: value of type " + v.typ.String() + " cannot be converted to type " + _r$3));
|
|
/* } */ case 7:
|
|
_r$4 = op($clone(v, Value), t); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$4;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Convert }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.op = op; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Value.prototype.Convert = function(t) { return this.$val.Convert(t); };
|
|
convertOp = function(dst, src) {
|
|
var _1, _2, _3, _4, _5, _6, _7, _arg, _arg$1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _v, _v$1, _v$2, dst, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _5 = $f._5; _6 = $f._6; _7 = $f._7; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _v = $f._v; _v$1 = $f._v$1; _v$2 = $f._v$2; dst = $f.dst; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_1 = src.Kind();
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 2; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { $s = 3; continue; }
|
|
/* */ if ((_1 === (13)) || (_1 === (14))) { $s = 4; continue; }
|
|
/* */ if ((_1 === (15)) || (_1 === (16))) { $s = 5; continue; }
|
|
/* */ if (_1 === (24)) { $s = 6; continue; }
|
|
/* */ if (_1 === (23)) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 2:
|
|
_2 = dst.Kind();
|
|
if ((_2 === (2)) || (_2 === (3)) || (_2 === (4)) || (_2 === (5)) || (_2 === (6)) || (_2 === (7)) || (_2 === (8)) || (_2 === (9)) || (_2 === (10)) || (_2 === (11)) || (_2 === (12))) {
|
|
$s = -1; return cvtInt;
|
|
} else if ((_2 === (13)) || (_2 === (14))) {
|
|
$s = -1; return cvtIntFloat;
|
|
} else if (_2 === (24)) {
|
|
$s = -1; return cvtIntString;
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { */ case 3:
|
|
_3 = dst.Kind();
|
|
if ((_3 === (2)) || (_3 === (3)) || (_3 === (4)) || (_3 === (5)) || (_3 === (6)) || (_3 === (7)) || (_3 === (8)) || (_3 === (9)) || (_3 === (10)) || (_3 === (11)) || (_3 === (12))) {
|
|
$s = -1; return cvtUint;
|
|
} else if ((_3 === (13)) || (_3 === (14))) {
|
|
$s = -1; return cvtUintFloat;
|
|
} else if (_3 === (24)) {
|
|
$s = -1; return cvtUintString;
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if ((_1 === (13)) || (_1 === (14))) { */ case 4:
|
|
_4 = dst.Kind();
|
|
if ((_4 === (2)) || (_4 === (3)) || (_4 === (4)) || (_4 === (5)) || (_4 === (6))) {
|
|
$s = -1; return cvtFloatInt;
|
|
} else if ((_4 === (7)) || (_4 === (8)) || (_4 === (9)) || (_4 === (10)) || (_4 === (11)) || (_4 === (12))) {
|
|
$s = -1; return cvtFloatUint;
|
|
} else if ((_4 === (13)) || (_4 === (14))) {
|
|
$s = -1; return cvtFloat;
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if ((_1 === (15)) || (_1 === (16))) { */ case 5:
|
|
_5 = dst.Kind();
|
|
if ((_5 === (15)) || (_5 === (16))) {
|
|
$s = -1; return cvtComplex;
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (24)) { */ case 6:
|
|
if (!(dst.Kind() === 23)) { _v = false; $s = 11; continue s; }
|
|
_r = dst.Elem().PkgPath(); /* */ $s = 12; case 12: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r === ""; case 11:
|
|
/* */ if (_v) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_v) { */ case 9:
|
|
_r$1 = dst.Elem().Kind(); /* */ $s = 14; case 14: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_6 = _r$1;
|
|
if (_6 === (8)) {
|
|
$s = -1; return cvtStringBytes;
|
|
} else if (_6 === (5)) {
|
|
$s = -1; return cvtStringRunes;
|
|
}
|
|
case 13:
|
|
/* } */ case 10:
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (23)) { */ case 7:
|
|
if (!(dst.Kind() === 24)) { _v$1 = false; $s = 17; continue s; }
|
|
_r$2 = src.Elem().PkgPath(); /* */ $s = 18; case 18: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v$1 = _r$2 === ""; case 17:
|
|
/* */ if (_v$1) { $s = 15; continue; }
|
|
/* */ $s = 16; continue;
|
|
/* if (_v$1) { */ case 15:
|
|
_r$3 = src.Elem().Kind(); /* */ $s = 20; case 20: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_7 = _r$3;
|
|
if (_7 === (8)) {
|
|
$s = -1; return cvtBytesString;
|
|
} else if (_7 === (5)) {
|
|
$s = -1; return cvtRunesString;
|
|
}
|
|
case 19:
|
|
/* } */ case 16:
|
|
/* } */ case 8:
|
|
case 1:
|
|
_r$4 = haveIdenticalUnderlyingType(dst, src, false); /* */ $s = 23; case 23: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
/* */ if (_r$4) { $s = 21; continue; }
|
|
/* */ $s = 22; continue;
|
|
/* if (_r$4) { */ case 21:
|
|
$s = -1; return cvtDirect;
|
|
/* } */ case 22:
|
|
if (!((dst.Kind() === 22) && dst.Name() === "" && (src.Kind() === 22) && src.Name() === "")) { _v$2 = false; $s = 26; continue s; }
|
|
_r$5 = dst.Elem().common(); /* */ $s = 27; case 27: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_arg = _r$5;
|
|
_r$6 = src.Elem().common(); /* */ $s = 28; case 28: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_arg$1 = _r$6;
|
|
_r$7 = haveIdenticalUnderlyingType(_arg, _arg$1, false); /* */ $s = 29; case 29: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_v$2 = _r$7; case 26:
|
|
/* */ if (_v$2) { $s = 24; continue; }
|
|
/* */ $s = 25; continue;
|
|
/* if (_v$2) { */ case 24:
|
|
$s = -1; return cvtDirect;
|
|
/* } */ case 25:
|
|
if (implements$1(dst, src)) {
|
|
if (src.Kind() === 20) {
|
|
$s = -1; return cvtI2I;
|
|
}
|
|
$s = -1; return cvtT2I;
|
|
}
|
|
$s = -1; return $throwNilPointerError;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: convertOp }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._5 = _5; $f._6 = _6; $f._7 = _7; $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._v = _v; $f._v$1 = _v$1; $f._v$2 = _v$2; $f.dst = dst; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
makeFloat = function(f, v, t) {
|
|
var _1, _r, f, ptr, t, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
typ = _r;
|
|
ptr = unsafe_New(typ);
|
|
_1 = typ.size;
|
|
if (_1 === (4)) {
|
|
(ptr).$set(($fround(v)));
|
|
} else if (_1 === (8)) {
|
|
(ptr).$set(v);
|
|
}
|
|
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeFloat }; } $f._1 = _1; $f._r = _r; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
makeComplex = function(f, v, t) {
|
|
var _1, _r, f, ptr, t, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
typ = _r;
|
|
ptr = unsafe_New(typ);
|
|
_1 = typ.size;
|
|
if (_1 === (8)) {
|
|
(ptr).$set((new $Complex64(v.$real, v.$imag)));
|
|
} else if (_1 === (16)) {
|
|
(ptr).$set(v);
|
|
}
|
|
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeComplex }; } $f._1 = _1; $f._r = _r; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
makeString = function(f, v, t) {
|
|
var _r, f, ret, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $clone(New(t), Value).Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ret = _r;
|
|
$clone(ret, Value).SetString(v);
|
|
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
|
|
$s = -1; return ret;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeString }; } $f._r = _r; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
makeBytes = function(f, v, t) {
|
|
var _r, f, ret, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $clone(New(t), Value).Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ret = _r;
|
|
$r = $clone(ret, Value).SetBytes(v); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
|
|
$s = -1; return ret;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeBytes }; } $f._r = _r; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
makeRunes = function(f, v, t) {
|
|
var _r, f, ret, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $clone(New(t), Value).Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ret = _r;
|
|
$r = $clone(ret, Value).setRunes(v); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
|
|
$s = -1; return ret;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeRunes }; } $f._r = _r; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtInt = function(v, t) {
|
|
var _r, t, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeInt(new flag(v.flag).ro(), ((x = $clone(v, Value).Int(), new $Uint64(x.$high, x.$low))), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtInt }; } $f._r = _r; $f.t = t; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtUint = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeInt(new flag(v.flag).ro(), $clone(v, Value).Uint(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUint }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtFloatInt = function(v, t) {
|
|
var _r, t, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeInt(new flag(v.flag).ro(), ((x = (new $Int64(0, $clone(v, Value).Float())), new $Uint64(x.$high, x.$low))), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloatInt }; } $f._r = _r; $f.t = t; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtFloatUint = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeInt(new flag(v.flag).ro(), (new $Uint64(0, $clone(v, Value).Float())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloatUint }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtIntFloat = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeFloat(new flag(v.flag).ro(), ($flatten64($clone(v, Value).Int())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtIntFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtUintFloat = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeFloat(new flag(v.flag).ro(), ($flatten64($clone(v, Value).Uint())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUintFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtFloat = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeFloat(new flag(v.flag).ro(), $clone(v, Value).Float(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtComplex = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeComplex(new flag(v.flag).ro(), $clone(v, Value).Complex(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtComplex }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtIntString = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeString(new flag(v.flag).ro(), ($encodeRune($clone(v, Value).Int().$low)), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtIntString }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtUintString = function(v, t) {
|
|
var _r, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = makeString(new flag(v.flag).ro(), ($encodeRune($clone(v, Value).Uint().$low)), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUintString }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtBytesString = function(v, t) {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = new flag(v.flag).ro();
|
|
_r = $clone(v, Value).Bytes(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = ($bytesToString(_r));
|
|
_arg$2 = t;
|
|
_r$1 = makeString(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtBytesString }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtStringBytes = function(v, t) {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = new flag(v.flag).ro();
|
|
_r = $clone(v, Value).String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = (new sliceType$15($stringToBytes(_r)));
|
|
_arg$2 = t;
|
|
_r$1 = makeBytes(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtStringBytes }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtRunesString = function(v, t) {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = new flag(v.flag).ro();
|
|
_r = $clone(v, Value).runes(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = ($runesToString(_r));
|
|
_arg$2 = t;
|
|
_r$1 = makeString(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtRunesString }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtStringRunes = function(v, t) {
|
|
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = new flag(v.flag).ro();
|
|
_r = $clone(v, Value).String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = (new sliceType$18($stringToRunes(_r)));
|
|
_arg$2 = t;
|
|
_r$1 = makeRunes(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtStringRunes }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtT2I = function(v, typ) {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, target, typ, v, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; target = $f.target; typ = $f.typ; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = typ.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = unsafe_New(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
target = _r$1;
|
|
_r$2 = valueInterface($clone(v, Value), false); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
x = _r$2;
|
|
_r$3 = typ.NumMethod(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (_r$3 === 0) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_r$3 === 0) { */ case 4:
|
|
(target).$set(x);
|
|
$s = 6; continue;
|
|
/* } else { */ case 5:
|
|
ifaceE2I($assertType(typ, ptrType$1), x, target);
|
|
/* } */ case 6:
|
|
_r$4 = typ.common(); /* */ $s = 8; case 8: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$s = -1; return new Value.ptr(_r$4, target, (((new flag(v.flag).ro() | 128) >>> 0) | 20) >>> 0);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtT2I }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.target = target; $f.typ = typ; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
cvtI2I = function(v, typ) {
|
|
var _r, _r$1, _r$2, ret, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; ret = $f.ret; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if ($clone(v, Value).IsNil()) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ($clone(v, Value).IsNil()) { */ case 1:
|
|
_r = Zero(typ); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ret = _r;
|
|
ret.flag = (ret.flag | (new flag(v.flag).ro())) >>> 0;
|
|
$s = -1; return ret;
|
|
/* } */ case 2:
|
|
_r$1 = $clone(v, Value).Elem(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = cvtT2I($clone(_r$1, Value), typ); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtI2I }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.ret = ret; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ptrType$5.methods = [{prop: "methods", name: "methods", pkg: "reflect", typ: $funcType([], [sliceType$5], false)}, {prop: "exportedMethods", name: "exportedMethods", pkg: "reflect", typ: $funcType([], [sliceType$5], false)}];
|
|
ptrType$8.methods = [{prop: "in$", name: "in", pkg: "reflect", typ: $funcType([], [sliceType$2], false)}, {prop: "out", name: "out", pkg: "reflect", typ: $funcType([], [sliceType$2], false)}];
|
|
name.methods = [{prop: "name", name: "name", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "tag", name: "tag", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "pkgPath", name: "pkgPath", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "isExported", name: "isExported", pkg: "reflect", typ: $funcType([], [$Bool], false)}, {prop: "data", name: "data", pkg: "reflect", typ: $funcType([$Int, $String], [ptrType$4], false)}, {prop: "nameLen", name: "nameLen", pkg: "reflect", typ: $funcType([], [$Int], false)}, {prop: "tagLen", name: "tagLen", pkg: "reflect", typ: $funcType([], [$Int], false)}];
|
|
ptrType$7.methods = [{prop: "skipUntilValidKey", name: "skipUntilValidKey", pkg: "reflect", typ: $funcType([], [], false)}];
|
|
Kind.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$1.methods = [{prop: "uncommon", name: "uncommon", pkg: "reflect", typ: $funcType([], [ptrType$5], false)}, {prop: "nameOff", name: "nameOff", pkg: "reflect", typ: $funcType([nameOff], [name], false)}, {prop: "typeOff", name: "typeOff", pkg: "reflect", typ: $funcType([typeOff], [ptrType$1], false)}, {prop: "ptrTo", name: "ptrTo", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "pointers", name: "pointers", pkg: "reflect", typ: $funcType([], [$Bool], false)}, {prop: "Comparable", name: "Comparable", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "textOff", name: "textOff", pkg: "reflect", typ: $funcType([textOff], [$UnsafePointer], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Bits", name: "Bits", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Align", name: "Align", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "FieldAlign", name: "FieldAlign", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "common", name: "common", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "exportedMethods", name: "exportedMethods", pkg: "reflect", typ: $funcType([], [sliceType$5], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}, {prop: "PkgPath", name: "PkgPath", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "ChanDir", name: "ChanDir", pkg: "", typ: $funcType([], [ChanDir], false)}, {prop: "IsVariadic", name: "IsVariadic", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "Key", name: "Key", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumIn", name: "NumIn", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumOut", name: "NumOut", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Out", name: "Out", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "Implements", name: "Implements", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "AssignableTo", name: "AssignableTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "ConvertibleTo", name: "ConvertibleTo", pkg: "", typ: $funcType([Type], [$Bool], false)}];
|
|
ChanDir.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$9.methods = [{prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}];
|
|
ptrType$18.methods = [{prop: "offset", name: "offset", pkg: "reflect", typ: $funcType([], [$Uintptr], false)}, {prop: "embedded", name: "embedded", pkg: "reflect", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$11.methods = [{prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}];
|
|
StructTag.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "Lookup", name: "Lookup", pkg: "", typ: $funcType([$String], [$String, $Bool], false)}];
|
|
Value.methods = [{prop: "object", name: "object", pkg: "reflect", typ: $funcType([], [ptrType$2], false)}, {prop: "assignTo", name: "assignTo", pkg: "reflect", typ: $funcType([$String, ptrType$1, $UnsafePointer], [Value], false)}, {prop: "call", name: "call", pkg: "reflect", typ: $funcType([$String, sliceType$9], [sliceType$9], false)}, {prop: "Cap", name: "Cap", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "Index", name: "Index", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "InterfaceData", name: "InterfaceData", pkg: "", typ: $funcType([], [arrayType$8], false)}, {prop: "IsNil", name: "IsNil", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Pointer", name: "Pointer", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Set", name: "Set", pkg: "", typ: $funcType([Value], [], false)}, {prop: "SetBytes", name: "SetBytes", pkg: "", typ: $funcType([sliceType$15], [], false)}, {prop: "SetCap", name: "SetCap", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "SetLen", name: "SetLen", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "Slice", name: "Slice", pkg: "", typ: $funcType([$Int, $Int], [Value], false)}, {prop: "Slice3", name: "Slice3", pkg: "", typ: $funcType([$Int, $Int, $Int], [Value], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [], false)}, {prop: "pointer", name: "pointer", pkg: "reflect", typ: $funcType([], [$UnsafePointer], false)}, {prop: "Addr", name: "Addr", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Bool", name: "Bool", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Bytes", name: "Bytes", pkg: "", typ: $funcType([], [sliceType$15], false)}, {prop: "runes", name: "runes", pkg: "reflect", typ: $funcType([], [sliceType$18], false)}, {prop: "CanAddr", name: "CanAddr", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "CanSet", name: "CanSet", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Call", name: "Call", pkg: "", typ: $funcType([sliceType$9], [sliceType$9], false)}, {prop: "CallSlice", name: "CallSlice", pkg: "", typ: $funcType([sliceType$9], [sliceType$9], false)}, {prop: "Complex", name: "Complex", pkg: "", typ: $funcType([], [$Complex128], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [Value], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [Value], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [Value], false)}, {prop: "Float", name: "Float", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "CanInterface", name: "CanInterface", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Interface", name: "Interface", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "IsValid", name: "IsValid", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "MapIndex", name: "MapIndex", pkg: "", typ: $funcType([Value], [Value], false)}, {prop: "MapKeys", name: "MapKeys", pkg: "", typ: $funcType([], [sliceType$9], false)}, {prop: "MapRange", name: "MapRange", pkg: "", typ: $funcType([], [ptrType$19], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Value], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "OverflowComplex", name: "OverflowComplex", pkg: "", typ: $funcType([$Complex128], [$Bool], false)}, {prop: "OverflowFloat", name: "OverflowFloat", pkg: "", typ: $funcType([$Float64], [$Bool], false)}, {prop: "OverflowInt", name: "OverflowInt", pkg: "", typ: $funcType([$Int64], [$Bool], false)}, {prop: "OverflowUint", name: "OverflowUint", pkg: "", typ: $funcType([$Uint64], [$Bool], false)}, {prop: "Recv", name: "Recv", pkg: "", typ: $funcType([], [Value, $Bool], false)}, {prop: "recv", name: "recv", pkg: "reflect", typ: $funcType([$Bool], [Value, $Bool], false)}, {prop: "Send", name: "Send", pkg: "", typ: $funcType([Value], [], false)}, {prop: "send", name: "send", pkg: "reflect", typ: $funcType([Value, $Bool], [$Bool], false)}, {prop: "SetBool", name: "SetBool", pkg: "", typ: $funcType([$Bool], [], false)}, {prop: "setRunes", name: "setRunes", pkg: "reflect", typ: $funcType([sliceType$18], [], false)}, {prop: "SetComplex", name: "SetComplex", pkg: "", typ: $funcType([$Complex128], [], false)}, {prop: "SetFloat", name: "SetFloat", pkg: "", typ: $funcType([$Float64], [], false)}, {prop: "SetInt", name: "SetInt", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "SetMapIndex", name: "SetMapIndex", pkg: "", typ: $funcType([Value, Value], [], false)}, {prop: "SetUint", name: "SetUint", pkg: "", typ: $funcType([$Uint64], [], false)}, {prop: "SetPointer", name: "SetPointer", pkg: "", typ: $funcType([$UnsafePointer], [], false)}, {prop: "SetString", name: "SetString", pkg: "", typ: $funcType([$String], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "TryRecv", name: "TryRecv", pkg: "", typ: $funcType([], [Value, $Bool], false)}, {prop: "TrySend", name: "TrySend", pkg: "", typ: $funcType([Value], [$Bool], false)}, {prop: "Type", name: "Type", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Uint", name: "Uint", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "UnsafeAddr", name: "UnsafeAddr", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Convert", name: "Convert", pkg: "", typ: $funcType([Type], [Value], false)}];
|
|
flag.methods = [{prop: "kind", name: "kind", pkg: "reflect", typ: $funcType([], [Kind], false)}, {prop: "ro", name: "ro", pkg: "reflect", typ: $funcType([], [flag], false)}, {prop: "mustBe", name: "mustBe", pkg: "reflect", typ: $funcType([Kind], [], false)}, {prop: "mustBeExported", name: "mustBeExported", pkg: "reflect", typ: $funcType([], [], false)}, {prop: "mustBeAssignable", name: "mustBeAssignable", pkg: "reflect", typ: $funcType([], [], false)}];
|
|
ptrType$20.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$19.methods = [{prop: "Key", name: "Key", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Value", name: "Value", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Next", name: "Next", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
uncommonType.init("reflect", [{prop: "pkgPath", name: "pkgPath", embedded: false, exported: false, typ: nameOff, tag: ""}, {prop: "mcount", name: "mcount", embedded: false, exported: false, typ: $Uint16, tag: ""}, {prop: "xcount", name: "xcount", embedded: false, exported: false, typ: $Uint16, tag: ""}, {prop: "moff", name: "moff", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "_methods", name: "_methods", embedded: false, exported: false, typ: sliceType$5, tag: ""}]);
|
|
funcType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: "reflect:\"func\""}, {prop: "inCount", name: "inCount", embedded: false, exported: false, typ: $Uint16, tag: ""}, {prop: "outCount", name: "outCount", embedded: false, exported: false, typ: $Uint16, tag: ""}, {prop: "_in", name: "_in", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "_out", name: "_out", embedded: false, exported: false, typ: sliceType$2, tag: ""}]);
|
|
name.init("reflect", [{prop: "bytes", name: "bytes", embedded: false, exported: false, typ: ptrType$4, tag: ""}]);
|
|
nameData.init("reflect", [{prop: "name", name: "name", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "tag", name: "tag", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "exported", name: "exported", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
mapIter.init("reflect", [{prop: "t", name: "t", embedded: false, exported: false, typ: Type, tag: ""}, {prop: "m", name: "m", embedded: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "keys", name: "keys", embedded: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "i", name: "i", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "last", name: "last", embedded: false, exported: false, typ: ptrType$2, tag: ""}]);
|
|
Type.init([{prop: "Align", name: "Align", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "AssignableTo", name: "AssignableTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "Bits", name: "Bits", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "ChanDir", name: "ChanDir", pkg: "", typ: $funcType([], [ChanDir], false)}, {prop: "Comparable", name: "Comparable", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "ConvertibleTo", name: "ConvertibleTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldAlign", name: "FieldAlign", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "Implements", name: "Implements", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "IsVariadic", name: "IsVariadic", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Key", name: "Key", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumIn", name: "NumIn", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumOut", name: "NumOut", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Out", name: "Out", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "PkgPath", name: "PkgPath", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "common", name: "common", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "uncommon", name: "uncommon", pkg: "reflect", typ: $funcType([], [ptrType$5], false)}]);
|
|
rtype.init("reflect", [{prop: "size", name: "size", embedded: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "ptrdata", name: "ptrdata", embedded: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "hash", name: "hash", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "tflag", name: "tflag", embedded: false, exported: false, typ: tflag, tag: ""}, {prop: "align", name: "align", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "fieldAlign", name: "fieldAlign", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "kind", name: "kind", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "alg", name: "alg", embedded: false, exported: false, typ: ptrType$3, tag: ""}, {prop: "gcdata", name: "gcdata", embedded: false, exported: false, typ: ptrType$4, tag: ""}, {prop: "str", name: "str", embedded: false, exported: false, typ: nameOff, tag: ""}, {prop: "ptrToThis", name: "ptrToThis", embedded: false, exported: false, typ: typeOff, tag: ""}]);
|
|
typeAlg.init("reflect", [{prop: "hash", name: "hash", embedded: false, exported: false, typ: funcType$4, tag: ""}, {prop: "equal", name: "equal", embedded: false, exported: false, typ: funcType$5, tag: ""}]);
|
|
method.init("reflect", [{prop: "name", name: "name", embedded: false, exported: false, typ: nameOff, tag: ""}, {prop: "mtyp", name: "mtyp", embedded: false, exported: false, typ: typeOff, tag: ""}, {prop: "ifn", name: "ifn", embedded: false, exported: false, typ: textOff, tag: ""}, {prop: "tfn", name: "tfn", embedded: false, exported: false, typ: textOff, tag: ""}]);
|
|
arrayType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "elem", name: "elem", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "slice", name: "slice", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "len", name: "len", embedded: false, exported: false, typ: $Uintptr, tag: ""}]);
|
|
chanType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "elem", name: "elem", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "dir", name: "dir", embedded: false, exported: false, typ: $Uintptr, tag: ""}]);
|
|
imethod.init("reflect", [{prop: "name", name: "name", embedded: false, exported: false, typ: nameOff, tag: ""}, {prop: "typ", name: "typ", embedded: false, exported: false, typ: typeOff, tag: ""}]);
|
|
interfaceType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "pkgPath", name: "pkgPath", embedded: false, exported: false, typ: name, tag: ""}, {prop: "methods", name: "methods", embedded: false, exported: false, typ: sliceType$6, tag: ""}]);
|
|
mapType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "key", name: "key", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "elem", name: "elem", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "bucket", name: "bucket", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "keysize", name: "keysize", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "valuesize", name: "valuesize", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "bucketsize", name: "bucketsize", embedded: false, exported: false, typ: $Uint16, tag: ""}, {prop: "flags", name: "flags", embedded: false, exported: false, typ: $Uint32, tag: ""}]);
|
|
ptrType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "elem", name: "elem", embedded: false, exported: false, typ: ptrType$1, tag: ""}]);
|
|
sliceType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "elem", name: "elem", embedded: false, exported: false, typ: ptrType$1, tag: ""}]);
|
|
structField.init("reflect", [{prop: "name", name: "name", embedded: false, exported: false, typ: name, tag: ""}, {prop: "typ", name: "typ", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "offsetEmbed", name: "offsetEmbed", embedded: false, exported: false, typ: $Uintptr, tag: ""}]);
|
|
structType.init("reflect", [{prop: "rtype", name: "rtype", embedded: true, exported: false, typ: rtype, tag: ""}, {prop: "pkgPath", name: "pkgPath", embedded: false, exported: false, typ: name, tag: ""}, {prop: "fields", name: "fields", embedded: false, exported: false, typ: sliceType$7, tag: ""}]);
|
|
Method.init("", [{prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "PkgPath", name: "PkgPath", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: Type, tag: ""}, {prop: "Func", name: "Func", embedded: false, exported: true, typ: Value, tag: ""}, {prop: "Index", name: "Index", embedded: false, exported: true, typ: $Int, tag: ""}]);
|
|
StructField.init("", [{prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "PkgPath", name: "PkgPath", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: Type, tag: ""}, {prop: "Tag", name: "Tag", embedded: false, exported: true, typ: StructTag, tag: ""}, {prop: "Offset", name: "Offset", embedded: false, exported: true, typ: $Uintptr, tag: ""}, {prop: "Index", name: "Index", embedded: false, exported: true, typ: sliceType$13, tag: ""}, {prop: "Anonymous", name: "Anonymous", embedded: false, exported: true, typ: $Bool, tag: ""}]);
|
|
fieldScan.init("reflect", [{prop: "typ", name: "typ", embedded: false, exported: false, typ: ptrType$11, tag: ""}, {prop: "index", name: "index", embedded: false, exported: false, typ: sliceType$13, tag: ""}]);
|
|
Value.init("reflect", [{prop: "typ", name: "typ", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "ptr", name: "ptr", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "flag", name: "flag", embedded: true, exported: false, typ: flag, tag: ""}]);
|
|
ValueError.init("", [{prop: "Method", name: "Method", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Kind", name: "Kind", embedded: false, exported: true, typ: Kind, tag: ""}]);
|
|
MapIter.init("reflect", [{prop: "m", name: "m", embedded: false, exported: false, typ: Value, tag: ""}, {prop: "it", name: "it", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unicode.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
nameOffList = sliceType$1.nil;
|
|
typeOffList = sliceType$2.nil;
|
|
initialized = false;
|
|
uncommonTypeMap = {};
|
|
nameMap = {};
|
|
callHelper = $assertType($internalize($call, $emptyInterface), funcType$1);
|
|
selectHelper = $assertType($internalize($select, $emptyInterface), funcType$1);
|
|
jsObjectPtr = reflectType($jsObjectPtr);
|
|
kindNames = new sliceType$4(["invalid", "bool", "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64", "complex64", "complex128", "array", "chan", "func", "interface", "map", "ptr", "slice", "string", "struct", "unsafe.Pointer"]);
|
|
uint8Type = $assertType(TypeOf(new $Uint8(0)), ptrType$1);
|
|
$r = init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["sort"] = (function() {
|
|
var $pkg = {}, $init, reflect, Interface, reverse, StringSlice, sliceType$2, Search, SearchStrings, insertionSort, siftDown, heapSort, medianOfThree, swapRange, doPivot, quickSort, Sort, maxDepth, Reverse, Strings, Stable, stable, symMerge, rotate;
|
|
reflect = $packages["reflect"];
|
|
Interface = $pkg.Interface = $newType(8, $kindInterface, "sort.Interface", true, "sort", true, null);
|
|
reverse = $pkg.reverse = $newType(0, $kindStruct, "sort.reverse", true, "sort", false, function(Interface_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Interface = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Interface = Interface_;
|
|
});
|
|
StringSlice = $pkg.StringSlice = $newType(12, $kindSlice, "sort.StringSlice", true, "sort", true, null);
|
|
sliceType$2 = $sliceType($String);
|
|
Search = function(n, f) {
|
|
var _r, _tmp, _tmp$1, f, h, i, j, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; f = $f.f; h = $f.h; i = $f.i; j = $f.j; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tmp = 0;
|
|
_tmp$1 = n;
|
|
i = _tmp;
|
|
j = _tmp$1;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < j)) { break; } */ if(!(i < j)) { $s = 2; continue; }
|
|
h = ((((((i + j >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
_r = f(h); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!_r) { */ case 3:
|
|
i = h + 1 >> 0;
|
|
$s = 5; continue;
|
|
/* } else { */ case 4:
|
|
j = h;
|
|
/* } */ case 5:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return i;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Search }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.f = f; $f.h = h; $f.i = i; $f.j = j; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Search = Search;
|
|
SearchStrings = function(a, x) {
|
|
var _r, a, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
a = [a];
|
|
x = [x];
|
|
_r = Search(a[0].$length, (function(a, x) { return function(i) {
|
|
var i;
|
|
return ((i < 0 || i >= a[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : a[0].$array[a[0].$offset + i]) >= x[0];
|
|
}; })(a, x)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: SearchStrings }; } $f._r = _r; $f.a = a; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.SearchStrings = SearchStrings;
|
|
StringSlice.prototype.Search = function(x) {
|
|
var _r, p, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_r = SearchStrings($subslice(new sliceType$2(p.$array), p.$offset, p.$offset + p.$length), x); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: StringSlice.prototype.Search }; } $f._r = _r; $f.p = p; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(StringSlice).prototype.Search = function(x) { return this.$get().Search(x); };
|
|
insertionSort = function(data, a, b) {
|
|
var _r, _v, a, b, data, i, j, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _v = $f._v; a = $f.a; b = $f.b; data = $f.data; i = $f.i; j = $f.j; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = a + 1 >> 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < b)) { break; } */ if(!(i < b)) { $s = 2; continue; }
|
|
j = i;
|
|
/* while (true) { */ case 3:
|
|
if (!(j > a)) { _v = false; $s = 5; continue s; }
|
|
_r = data.Less(j, j - 1 >> 0); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 5:
|
|
/* if (!(_v)) { break; } */ if(!(_v)) { $s = 4; continue; }
|
|
$r = data.Swap(j, j - 1 >> 0); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
j = j - (1) >> 0;
|
|
/* } */ $s = 3; continue; case 4:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: insertionSort }; } $f._r = _r; $f._v = _v; $f.a = a; $f.b = b; $f.data = data; $f.i = i; $f.j = j; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
siftDown = function(data, lo, hi, first) {
|
|
var _r, _r$1, _v, child, data, first, hi, lo, root, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _v = $f._v; child = $f.child; data = $f.data; first = $f.first; hi = $f.hi; lo = $f.lo; root = $f.root; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
root = lo;
|
|
/* while (true) { */ case 1:
|
|
child = ($imul(2, root)) + 1 >> 0;
|
|
if (child >= hi) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
if (!((child + 1 >> 0) < hi)) { _v = false; $s = 5; continue s; }
|
|
_r = data.Less(first + child >> 0, (first + child >> 0) + 1 >> 0); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 5:
|
|
/* */ if (_v) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (_v) { */ case 3:
|
|
child = child + (1) >> 0;
|
|
/* } */ case 4:
|
|
_r$1 = data.Less(first + root >> 0, first + child >> 0); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!_r$1) { */ case 7:
|
|
$s = -1; return;
|
|
/* } */ case 8:
|
|
$r = data.Swap(first + root >> 0, first + child >> 0); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
root = child;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: siftDown }; } $f._r = _r; $f._r$1 = _r$1; $f._v = _v; $f.child = child; $f.data = data; $f.first = first; $f.hi = hi; $f.lo = lo; $f.root = root; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
heapSort = function(data, a, b) {
|
|
var _q, a, b, data, first, hi, i, i$1, lo, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; a = $f.a; b = $f.b; data = $f.data; first = $f.first; hi = $f.hi; i = $f.i; i$1 = $f.i$1; lo = $f.lo; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
first = a;
|
|
lo = 0;
|
|
hi = b - a >> 0;
|
|
i = (_q = ((hi - 1 >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i >= 0)) { break; } */ if(!(i >= 0)) { $s = 2; continue; }
|
|
$r = siftDown(data, i, hi, first); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i - (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
i$1 = hi - 1 >> 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(i$1 >= 0)) { break; } */ if(!(i$1 >= 0)) { $s = 5; continue; }
|
|
$r = data.Swap(first, first + i$1 >> 0); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = siftDown(data, lo, i$1, first); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$1 = i$1 - (1) >> 0;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: heapSort }; } $f._q = _q; $f.a = a; $f.b = b; $f.data = data; $f.first = first; $f.hi = hi; $f.i = i; $f.i$1 = i$1; $f.lo = lo; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
medianOfThree = function(data, m1, m0, m2) {
|
|
var _r, _r$1, _r$2, data, m0, m1, m2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; data = $f.data; m0 = $f.m0; m1 = $f.m1; m2 = $f.m2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = data.Less(m1, m0); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r) { */ case 1:
|
|
$r = data.Swap(m1, m0); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
_r$1 = data.Less(m2, m1); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_r$1) { */ case 5:
|
|
$r = data.Swap(m2, m1); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r$2 = data.Less(m1, m0); /* */ $s = 11; case 11: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
/* */ if (_r$2) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_r$2) { */ case 9:
|
|
$r = data.Swap(m1, m0); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 10:
|
|
/* } */ case 6:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: medianOfThree }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.data = data; $f.m0 = m0; $f.m1 = m1; $f.m2 = m2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
swapRange = function(data, a, b, n) {
|
|
var a, b, data, i, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; a = $f.a; b = $f.b; data = $f.data; i = $f.i; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 2; continue; }
|
|
$r = data.Swap(a + i >> 0, b + i >> 0); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: swapRange }; } $f.a = a; $f.b = b; $f.data = data; $f.i = i; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
doPivot = function(data, lo, hi) {
|
|
var _q, _q$1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _tmp, _tmp$1, _tmp$2, _tmp$3, _v, _v$1, _v$2, _v$3, _v$4, a, b, c, data, dups, hi, lo, m, midhi, midlo, pivot, protect, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _q$1 = $f._q$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _v = $f._v; _v$1 = $f._v$1; _v$2 = $f._v$2; _v$3 = $f._v$3; _v$4 = $f._v$4; a = $f.a; b = $f.b; c = $f.c; data = $f.data; dups = $f.dups; hi = $f.hi; lo = $f.lo; m = $f.m; midhi = $f.midhi; midlo = $f.midlo; pivot = $f.pivot; protect = $f.protect; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
midlo = 0;
|
|
midhi = 0;
|
|
m = ((((((lo + hi >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
/* */ if ((hi - lo >> 0) > 40) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((hi - lo >> 0) > 40) { */ case 1:
|
|
s = (_q = ((hi - lo >> 0)) / 8, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
$r = medianOfThree(data, lo, lo + s >> 0, lo + ($imul(2, s)) >> 0); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = medianOfThree(data, m, m - s >> 0, m + s >> 0); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = medianOfThree(data, hi - 1 >> 0, (hi - 1 >> 0) - s >> 0, (hi - 1 >> 0) - ($imul(2, s)) >> 0); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
$r = medianOfThree(data, lo, m, hi - 1 >> 0); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
pivot = lo;
|
|
_tmp = lo + 1 >> 0;
|
|
_tmp$1 = hi - 1 >> 0;
|
|
a = _tmp;
|
|
c = _tmp$1;
|
|
/* while (true) { */ case 7:
|
|
if (!(a < c)) { _v = false; $s = 9; continue s; }
|
|
_r = data.Less(a, pivot); /* */ $s = 10; case 10: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 9:
|
|
/* if (!(_v)) { break; } */ if(!(_v)) { $s = 8; continue; }
|
|
a = a + (1) >> 0;
|
|
/* } */ $s = 7; continue; case 8:
|
|
b = a;
|
|
/* while (true) { */ case 11:
|
|
/* while (true) { */ case 13:
|
|
if (!(b < c)) { _v$1 = false; $s = 15; continue s; }
|
|
_r$1 = data.Less(pivot, b); /* */ $s = 16; case 16: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v$1 = !_r$1; case 15:
|
|
/* if (!(_v$1)) { break; } */ if(!(_v$1)) { $s = 14; continue; }
|
|
b = b + (1) >> 0;
|
|
/* } */ $s = 13; continue; case 14:
|
|
/* while (true) { */ case 17:
|
|
if (!(b < c)) { _v$2 = false; $s = 19; continue s; }
|
|
_r$2 = data.Less(pivot, c - 1 >> 0); /* */ $s = 20; case 20: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v$2 = _r$2; case 19:
|
|
/* if (!(_v$2)) { break; } */ if(!(_v$2)) { $s = 18; continue; }
|
|
c = c - (1) >> 0;
|
|
/* } */ $s = 17; continue; case 18:
|
|
if (b >= c) {
|
|
/* break; */ $s = 12; continue;
|
|
}
|
|
$r = data.Swap(b, c - 1 >> 0); /* */ $s = 21; case 21: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
b = b + (1) >> 0;
|
|
c = c - (1) >> 0;
|
|
/* } */ $s = 11; continue; case 12:
|
|
protect = (hi - c >> 0) < 5;
|
|
/* */ if (!protect && (hi - c >> 0) < (_q$1 = ((hi - lo >> 0)) / 4, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"))) { $s = 22; continue; }
|
|
/* */ $s = 23; continue;
|
|
/* if (!protect && (hi - c >> 0) < (_q$1 = ((hi - lo >> 0)) / 4, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"))) { */ case 22:
|
|
dups = 0;
|
|
_r$3 = data.Less(pivot, hi - 1 >> 0); /* */ $s = 26; case 26: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$3) { $s = 24; continue; }
|
|
/* */ $s = 25; continue;
|
|
/* if (!_r$3) { */ case 24:
|
|
$r = data.Swap(c, hi - 1 >> 0); /* */ $s = 27; case 27: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
c = c + (1) >> 0;
|
|
dups = dups + (1) >> 0;
|
|
/* } */ case 25:
|
|
_r$4 = data.Less(b - 1 >> 0, pivot); /* */ $s = 30; case 30: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$4) { $s = 28; continue; }
|
|
/* */ $s = 29; continue;
|
|
/* if (!_r$4) { */ case 28:
|
|
b = b - (1) >> 0;
|
|
dups = dups + (1) >> 0;
|
|
/* } */ case 29:
|
|
_r$5 = data.Less(m, pivot); /* */ $s = 33; case 33: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$5) { $s = 31; continue; }
|
|
/* */ $s = 32; continue;
|
|
/* if (!_r$5) { */ case 31:
|
|
$r = data.Swap(m, b - 1 >> 0); /* */ $s = 34; case 34: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
b = b - (1) >> 0;
|
|
dups = dups + (1) >> 0;
|
|
/* } */ case 32:
|
|
protect = dups > 1;
|
|
/* } */ case 23:
|
|
/* */ if (protect) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if (protect) { */ case 35:
|
|
/* while (true) { */ case 37:
|
|
/* while (true) { */ case 39:
|
|
if (!(a < b)) { _v$3 = false; $s = 41; continue s; }
|
|
_r$6 = data.Less(b - 1 >> 0, pivot); /* */ $s = 42; case 42: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_v$3 = !_r$6; case 41:
|
|
/* if (!(_v$3)) { break; } */ if(!(_v$3)) { $s = 40; continue; }
|
|
b = b - (1) >> 0;
|
|
/* } */ $s = 39; continue; case 40:
|
|
/* while (true) { */ case 43:
|
|
if (!(a < b)) { _v$4 = false; $s = 45; continue s; }
|
|
_r$7 = data.Less(a, pivot); /* */ $s = 46; case 46: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_v$4 = _r$7; case 45:
|
|
/* if (!(_v$4)) { break; } */ if(!(_v$4)) { $s = 44; continue; }
|
|
a = a + (1) >> 0;
|
|
/* } */ $s = 43; continue; case 44:
|
|
if (a >= b) {
|
|
/* break; */ $s = 38; continue;
|
|
}
|
|
$r = data.Swap(a, b - 1 >> 0); /* */ $s = 47; case 47: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
a = a + (1) >> 0;
|
|
b = b - (1) >> 0;
|
|
/* } */ $s = 37; continue; case 38:
|
|
/* } */ case 36:
|
|
$r = data.Swap(pivot, b - 1 >> 0); /* */ $s = 48; case 48: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_tmp$2 = b - 1 >> 0;
|
|
_tmp$3 = c;
|
|
midlo = _tmp$2;
|
|
midhi = _tmp$3;
|
|
$s = -1; return [midlo, midhi];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: doPivot }; } $f._q = _q; $f._q$1 = _q$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._v = _v; $f._v$1 = _v$1; $f._v$2 = _v$2; $f._v$3 = _v$3; $f._v$4 = _v$4; $f.a = a; $f.b = b; $f.c = c; $f.data = data; $f.dups = dups; $f.hi = hi; $f.lo = lo; $f.m = m; $f.midhi = midhi; $f.midlo = midlo; $f.pivot = pivot; $f.protect = protect; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
quickSort = function(data, a, b, maxDepth$1) {
|
|
var _r, _r$1, _tuple, a, b, data, i, maxDepth$1, mhi, mlo, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; a = $f.a; b = $f.b; data = $f.data; i = $f.i; maxDepth$1 = $f.maxDepth$1; mhi = $f.mhi; mlo = $f.mlo; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* while (true) { */ case 1:
|
|
/* if (!((b - a >> 0) > 12)) { break; } */ if(!((b - a >> 0) > 12)) { $s = 2; continue; }
|
|
/* */ if (maxDepth$1 === 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (maxDepth$1 === 0) { */ case 3:
|
|
$r = heapSort(data, a, b); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 4:
|
|
maxDepth$1 = maxDepth$1 - (1) >> 0;
|
|
_r = doPivot(data, a, b); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
mlo = _tuple[0];
|
|
mhi = _tuple[1];
|
|
/* */ if ((mlo - a >> 0) < (b - mhi >> 0)) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if ((mlo - a >> 0) < (b - mhi >> 0)) { */ case 7:
|
|
$r = quickSort(data, a, mlo, maxDepth$1); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
a = mhi;
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
$r = quickSort(data, mhi, b, maxDepth$1); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
b = mlo;
|
|
/* } */ case 9:
|
|
/* } */ $s = 1; continue; case 2:
|
|
/* */ if ((b - a >> 0) > 1) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if ((b - a >> 0) > 1) { */ case 12:
|
|
i = a + 6 >> 0;
|
|
/* while (true) { */ case 14:
|
|
/* if (!(i < b)) { break; } */ if(!(i < b)) { $s = 15; continue; }
|
|
_r$1 = data.Less(i, i - 6 >> 0); /* */ $s = 18; case 18: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if (_r$1) { */ case 16:
|
|
$r = data.Swap(i, i - 6 >> 0); /* */ $s = 19; case 19: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 17:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 14; continue; case 15:
|
|
$r = insertionSort(data, a, b); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 13:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: quickSort }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.a = a; $f.b = b; $f.data = data; $f.i = i; $f.maxDepth$1 = maxDepth$1; $f.mhi = mhi; $f.mlo = mlo; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Sort = function(data) {
|
|
var _r, data, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; data = $f.data; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = data.Len(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r;
|
|
$r = quickSort(data, 0, n, maxDepth(n)); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sort }; } $f._r = _r; $f.data = data; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sort = Sort;
|
|
maxDepth = function(n) {
|
|
var depth, i, n;
|
|
depth = 0;
|
|
i = n;
|
|
while (true) {
|
|
if (!(i > 0)) { break; }
|
|
depth = depth + (1) >> 0;
|
|
i = (i >> $min((1), 31)) >> 0;
|
|
}
|
|
return $imul(depth, 2);
|
|
};
|
|
reverse.ptr.prototype.Less = function(i, j) {
|
|
var _r, i, j, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; j = $f.j; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.Interface.Less(j, i); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: reverse.ptr.prototype.Less }; } $f._r = _r; $f.i = i; $f.j = j; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
reverse.prototype.Less = function(i, j) { return this.$val.Less(i, j); };
|
|
Reverse = function(data) {
|
|
var data;
|
|
return new reverse.ptr(data);
|
|
};
|
|
$pkg.Reverse = Reverse;
|
|
StringSlice.prototype.Len = function() {
|
|
var p;
|
|
p = this;
|
|
return p.$length;
|
|
};
|
|
$ptrType(StringSlice).prototype.Len = function() { return this.$get().Len(); };
|
|
StringSlice.prototype.Less = function(i, j) {
|
|
var i, j, p;
|
|
p = this;
|
|
return ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]) < ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]);
|
|
};
|
|
$ptrType(StringSlice).prototype.Less = function(i, j) { return this.$get().Less(i, j); };
|
|
StringSlice.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, i, j, p;
|
|
p = this;
|
|
_tmp = ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]);
|
|
_tmp$1 = ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]);
|
|
((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i] = _tmp);
|
|
((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j] = _tmp$1);
|
|
};
|
|
$ptrType(StringSlice).prototype.Swap = function(i, j) { return this.$get().Swap(i, j); };
|
|
StringSlice.prototype.Sort = function() {
|
|
var p, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
$r = Sort(p); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: StringSlice.prototype.Sort }; } $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(StringSlice).prototype.Sort = function() { return this.$get().Sort(); };
|
|
Strings = function(a) {
|
|
var a, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; a = $f.a; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = Sort(($subslice(new StringSlice(a.$array), a.$offset, a.$offset + a.$length))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Strings }; } $f.a = a; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Strings = Strings;
|
|
Stable = function(data) {
|
|
var _arg, _arg$1, _r, data, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; data = $f.data; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = data;
|
|
_r = data.Len(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = _r;
|
|
$r = stable(_arg, _arg$1); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stable }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f.data = data; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Stable = Stable;
|
|
stable = function(data, n) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, a, b, blockSize, data, m, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; a = $f.a; b = $f.b; blockSize = $f.blockSize; data = $f.data; m = $f.m; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
blockSize = 20;
|
|
_tmp = 0;
|
|
_tmp$1 = blockSize;
|
|
a = _tmp;
|
|
b = _tmp$1;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(b <= n)) { break; } */ if(!(b <= n)) { $s = 2; continue; }
|
|
$r = insertionSort(data, a, b); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
a = b;
|
|
b = b + (blockSize) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$r = insertionSort(data, a, n); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* while (true) { */ case 5:
|
|
/* if (!(blockSize < n)) { break; } */ if(!(blockSize < n)) { $s = 6; continue; }
|
|
_tmp$2 = 0;
|
|
_tmp$3 = $imul(2, blockSize);
|
|
a = _tmp$2;
|
|
b = _tmp$3;
|
|
/* while (true) { */ case 7:
|
|
/* if (!(b <= n)) { break; } */ if(!(b <= n)) { $s = 8; continue; }
|
|
$r = symMerge(data, a, a + blockSize >> 0, b); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
a = b;
|
|
b = b + (($imul(2, blockSize))) >> 0;
|
|
/* } */ $s = 7; continue; case 8:
|
|
m = a + blockSize >> 0;
|
|
/* */ if (m < n) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (m < n) { */ case 10:
|
|
$r = symMerge(data, a, m, n); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 11:
|
|
blockSize = $imul(blockSize, (2));
|
|
/* } */ $s = 5; continue; case 6:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: stable }; } $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.a = a; $f.b = b; $f.blockSize = blockSize; $f.data = data; $f.m = m; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
symMerge = function(data, a, m, b) {
|
|
var _r, _r$1, _r$2, _tmp, _tmp$1, a, b, c, data, end, h, h$1, i, i$1, j, j$1, k, k$1, m, mid, n, p, r, start, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; a = $f.a; b = $f.b; c = $f.c; data = $f.data; end = $f.end; h = $f.h; h$1 = $f.h$1; i = $f.i; i$1 = $f.i$1; j = $f.j; j$1 = $f.j$1; k = $f.k; k$1 = $f.k$1; m = $f.m; mid = $f.mid; n = $f.n; p = $f.p; r = $f.r; start = $f.start; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if ((m - a >> 0) === 1) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((m - a >> 0) === 1) { */ case 1:
|
|
i = m;
|
|
j = b;
|
|
/* while (true) { */ case 3:
|
|
/* if (!(i < j)) { break; } */ if(!(i < j)) { $s = 4; continue; }
|
|
h = ((((((i + j >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
_r = data.Less(h, a); /* */ $s = 8; case 8: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_r) { */ case 5:
|
|
i = h + 1 >> 0;
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
j = h;
|
|
/* } */ case 7:
|
|
/* } */ $s = 3; continue; case 4:
|
|
k = a;
|
|
/* while (true) { */ case 9:
|
|
/* if (!(k < (i - 1 >> 0))) { break; } */ if(!(k < (i - 1 >> 0))) { $s = 10; continue; }
|
|
$r = data.Swap(k, k + 1 >> 0); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
k = k + (1) >> 0;
|
|
/* } */ $s = 9; continue; case 10:
|
|
$s = -1; return;
|
|
/* } */ case 2:
|
|
/* */ if ((b - m >> 0) === 1) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if ((b - m >> 0) === 1) { */ case 12:
|
|
i$1 = a;
|
|
j$1 = m;
|
|
/* while (true) { */ case 14:
|
|
/* if (!(i$1 < j$1)) { break; } */ if(!(i$1 < j$1)) { $s = 15; continue; }
|
|
h$1 = ((((((i$1 + j$1 >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
_r$1 = data.Less(m, h$1); /* */ $s = 19; case 19: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if (!_r$1) { */ case 16:
|
|
i$1 = h$1 + 1 >> 0;
|
|
$s = 18; continue;
|
|
/* } else { */ case 17:
|
|
j$1 = h$1;
|
|
/* } */ case 18:
|
|
/* } */ $s = 14; continue; case 15:
|
|
k$1 = m;
|
|
/* while (true) { */ case 20:
|
|
/* if (!(k$1 > i$1)) { break; } */ if(!(k$1 > i$1)) { $s = 21; continue; }
|
|
$r = data.Swap(k$1, k$1 - 1 >> 0); /* */ $s = 22; case 22: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
k$1 = k$1 - (1) >> 0;
|
|
/* } */ $s = 20; continue; case 21:
|
|
$s = -1; return;
|
|
/* } */ case 13:
|
|
mid = ((((((a + b >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
n = mid + m >> 0;
|
|
_tmp = 0;
|
|
_tmp$1 = 0;
|
|
start = _tmp;
|
|
r = _tmp$1;
|
|
if (m > mid) {
|
|
start = n - b >> 0;
|
|
r = mid;
|
|
} else {
|
|
start = a;
|
|
r = m;
|
|
}
|
|
p = n - 1 >> 0;
|
|
/* while (true) { */ case 23:
|
|
/* if (!(start < r)) { break; } */ if(!(start < r)) { $s = 24; continue; }
|
|
c = ((((((start + r >> 0) >>> 0)) >>> 1 >>> 0) >> 0));
|
|
_r$2 = data.Less(p - c >> 0, c); /* */ $s = 28; case 28: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$2) { $s = 25; continue; }
|
|
/* */ $s = 26; continue;
|
|
/* if (!_r$2) { */ case 25:
|
|
start = c + 1 >> 0;
|
|
$s = 27; continue;
|
|
/* } else { */ case 26:
|
|
r = c;
|
|
/* } */ case 27:
|
|
/* } */ $s = 23; continue; case 24:
|
|
end = n - start >> 0;
|
|
/* */ if (start < m && m < end) { $s = 29; continue; }
|
|
/* */ $s = 30; continue;
|
|
/* if (start < m && m < end) { */ case 29:
|
|
$r = rotate(data, start, m, end); /* */ $s = 31; case 31: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 30:
|
|
/* */ if (a < start && start < mid) { $s = 32; continue; }
|
|
/* */ $s = 33; continue;
|
|
/* if (a < start && start < mid) { */ case 32:
|
|
$r = symMerge(data, a, start, mid); /* */ $s = 34; case 34: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 33:
|
|
/* */ if (mid < end && end < b) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if (mid < end && end < b) { */ case 35:
|
|
$r = symMerge(data, mid, end, b); /* */ $s = 37; case 37: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 36:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: symMerge }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.a = a; $f.b = b; $f.c = c; $f.data = data; $f.end = end; $f.h = h; $f.h$1 = h$1; $f.i = i; $f.i$1 = i$1; $f.j = j; $f.j$1 = j$1; $f.k = k; $f.k$1 = k$1; $f.m = m; $f.mid = mid; $f.n = n; $f.p = p; $f.r = r; $f.start = start; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rotate = function(data, a, m, b) {
|
|
var a, b, data, i, j, m, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; a = $f.a; b = $f.b; data = $f.data; i = $f.i; j = $f.j; m = $f.m; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = m - a >> 0;
|
|
j = b - m >> 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(!((i === j)))) { break; } */ if(!(!((i === j)))) { $s = 2; continue; }
|
|
/* */ if (i > j) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (i > j) { */ case 3:
|
|
$r = swapRange(data, m - i >> 0, m, j); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i - (j) >> 0;
|
|
$s = 5; continue;
|
|
/* } else { */ case 4:
|
|
$r = swapRange(data, m - i >> 0, (m + j >> 0) - i >> 0, i); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
j = j - (i) >> 0;
|
|
/* } */ case 5:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$r = swapRange(data, m - i >> 0, m, i); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rotate }; } $f.a = a; $f.b = b; $f.data = data; $f.i = i; $f.j = j; $f.m = m; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
reverse.methods = [{prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}];
|
|
StringSlice.methods = [{prop: "Search", name: "Search", pkg: "", typ: $funcType([$String], [$Int], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}, {prop: "Sort", name: "Sort", pkg: "", typ: $funcType([], [], false)}];
|
|
Interface.init([{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}]);
|
|
reverse.init("", [{prop: "Interface", name: "Interface", embedded: true, exported: true, typ: Interface, tag: ""}]);
|
|
StringSlice.init($String);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = reflect.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/fmtsort"] = (function() {
|
|
var $pkg = {}, $init, reflect, sort, SortedMap, ptrType, sliceType, Sort, compare, nilCompare, floatCompare, isNaN;
|
|
reflect = $packages["reflect"];
|
|
sort = $packages["sort"];
|
|
SortedMap = $pkg.SortedMap = $newType(0, $kindStruct, "fmtsort.SortedMap", true, "internal/fmtsort", true, function(Key_, Value_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Key = sliceType.nil;
|
|
this.Value = sliceType.nil;
|
|
return;
|
|
}
|
|
this.Key = Key_;
|
|
this.Value = Value_;
|
|
});
|
|
ptrType = $ptrType(SortedMap);
|
|
sliceType = $sliceType(reflect.Value);
|
|
SortedMap.ptr.prototype.Len = function() {
|
|
var o;
|
|
o = this;
|
|
return o.Key.$length;
|
|
};
|
|
SortedMap.prototype.Len = function() { return this.$val.Len(); };
|
|
SortedMap.ptr.prototype.Less = function(i, j) {
|
|
var _r, i, j, o, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; j = $f.j; o = $f.o; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
o = this;
|
|
_r = compare($clone((x = o.Key, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])), reflect.Value), $clone((x$1 = o.Key, ((j < 0 || j >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + j])), reflect.Value)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r < 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: SortedMap.ptr.prototype.Less }; } $f._r = _r; $f.i = i; $f.j = j; $f.o = o; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
SortedMap.prototype.Less = function(i, j) { return this.$val.Less(i, j); };
|
|
SortedMap.ptr.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, i, j, o, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7;
|
|
o = this;
|
|
_tmp = (x = o.Key, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j]));
|
|
_tmp$1 = (x$1 = o.Key, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i]));
|
|
(x$2 = o.Key, ((i < 0 || i >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i] = _tmp));
|
|
(x$3 = o.Key, ((j < 0 || j >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + j] = _tmp$1));
|
|
_tmp$2 = (x$4 = o.Value, ((j < 0 || j >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + j]));
|
|
_tmp$3 = (x$5 = o.Value, ((i < 0 || i >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + i]));
|
|
(x$6 = o.Value, ((i < 0 || i >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + i] = _tmp$2));
|
|
(x$7 = o.Value, ((j < 0 || j >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + j] = _tmp$3));
|
|
};
|
|
SortedMap.prototype.Swap = function(i, j) { return this.$val.Swap(i, j); };
|
|
Sort = function(mapValue) {
|
|
var _r, _r$1, _r$2, _r$3, i, iter, key, mapValue, sorted, value, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; i = $f.i; iter = $f.iter; key = $f.key; mapValue = $f.mapValue; sorted = $f.sorted; value = $f.value; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $clone(mapValue, reflect.Value).Type().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!((_r === 21))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((_r === 21))) { */ case 1:
|
|
$s = -1; return ptrType.nil;
|
|
/* } */ case 2:
|
|
key = $makeSlice(sliceType, $clone(mapValue, reflect.Value).Len());
|
|
value = $makeSlice(sliceType, key.$length);
|
|
iter = $clone(mapValue, reflect.Value).MapRange();
|
|
i = 0;
|
|
/* while (true) { */ case 4:
|
|
_r$1 = iter.Next(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* if (!(_r$1)) { break; } */ if(!(_r$1)) { $s = 5; continue; }
|
|
_r$2 = iter.Key(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
((i < 0 || i >= key.$length) ? ($throwRuntimeError("index out of range"), undefined) : key.$array[key.$offset + i] = _r$2);
|
|
_r$3 = iter.Value(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
((i < 0 || i >= value.$length) ? ($throwRuntimeError("index out of range"), undefined) : value.$array[value.$offset + i] = _r$3);
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 4; continue; case 5:
|
|
sorted = new SortedMap.ptr(key, value);
|
|
$r = sort.Stable(sorted); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return sorted;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sort }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f.i = i; $f.iter = iter; $f.key = key; $f.mapValue = mapValue; $f.sorted = sorted; $f.value = value; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sort = Sort;
|
|
compare = function(aVal, bVal) {
|
|
var _1, _arg, _arg$1, _arg$2, _arg$3, _arg$4, _arg$5, _arg$6, _arg$7, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$16, _r$17, _r$18, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, a, a$1, a$2, a$3, a$4, a$5, aType, aVal, ap, b, b$1, b$2, b$3, b$4, b$5, bType, bVal, bp, c, c$1, c$2, c$3, c$4, c$5, i, i$1, ok, ok$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _arg$3 = $f._arg$3; _arg$4 = $f._arg$4; _arg$5 = $f._arg$5; _arg$6 = $f._arg$6; _arg$7 = $f._arg$7; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$16 = $f._r$16; _r$17 = $f._r$17; _r$18 = $f._r$18; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; a = $f.a; a$1 = $f.a$1; a$2 = $f.a$2; a$3 = $f.a$3; a$4 = $f.a$4; a$5 = $f.a$5; aType = $f.aType; aVal = $f.aVal; ap = $f.ap; b = $f.b; b$1 = $f.b$1; b$2 = $f.b$2; b$3 = $f.b$3; b$4 = $f.b$4; b$5 = $f.b$5; bType = $f.bType; bVal = $f.bVal; bp = $f.bp; c = $f.c; c$1 = $f.c$1; c$2 = $f.c$2; c$3 = $f.c$3; c$4 = $f.c$4; c$5 = $f.c$5; i = $f.i; i$1 = $f.i$1; ok = $f.ok; ok$1 = $f.ok$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tmp = $clone(aVal, reflect.Value).Type();
|
|
_tmp$1 = $clone(bVal, reflect.Value).Type();
|
|
aType = _tmp;
|
|
bType = _tmp$1;
|
|
if (!($interfaceIsEqual(aType, bType))) {
|
|
$s = -1; return -1;
|
|
}
|
|
_1 = $clone(aVal, reflect.Value).Kind();
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 2; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { $s = 3; continue; }
|
|
/* */ if (_1 === (24)) { $s = 4; continue; }
|
|
/* */ if ((_1 === (13)) || (_1 === (14))) { $s = 5; continue; }
|
|
/* */ if ((_1 === (15)) || (_1 === (16))) { $s = 6; continue; }
|
|
/* */ if (_1 === (1)) { $s = 7; continue; }
|
|
/* */ if (_1 === (22)) { $s = 8; continue; }
|
|
/* */ if (_1 === (18)) { $s = 9; continue; }
|
|
/* */ if (_1 === (25)) { $s = 10; continue; }
|
|
/* */ if (_1 === (17)) { $s = 11; continue; }
|
|
/* */ if (_1 === (20)) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 2:
|
|
_tmp$2 = $clone(aVal, reflect.Value).Int();
|
|
_tmp$3 = $clone(bVal, reflect.Value).Int();
|
|
a = _tmp$2;
|
|
b = _tmp$3;
|
|
if ((a.$high < b.$high || (a.$high === b.$high && a.$low < b.$low))) {
|
|
$s = -1; return -1;
|
|
} else if ((a.$high > b.$high || (a.$high === b.$high && a.$low > b.$low))) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { */ case 3:
|
|
_tmp$4 = $clone(aVal, reflect.Value).Uint();
|
|
_tmp$5 = $clone(bVal, reflect.Value).Uint();
|
|
a$1 = _tmp$4;
|
|
b$1 = _tmp$5;
|
|
if ((a$1.$high < b$1.$high || (a$1.$high === b$1.$high && a$1.$low < b$1.$low))) {
|
|
$s = -1; return -1;
|
|
} else if ((a$1.$high > b$1.$high || (a$1.$high === b$1.$high && a$1.$low > b$1.$low))) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if (_1 === (24)) { */ case 4:
|
|
_r = $clone(aVal, reflect.Value).String(); /* */ $s = 15; case 15: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tmp$6 = _r;
|
|
_r$1 = $clone(bVal, reflect.Value).String(); /* */ $s = 16; case 16: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tmp$7 = _r$1;
|
|
a$2 = _tmp$6;
|
|
b$2 = _tmp$7;
|
|
if (a$2 < b$2) {
|
|
$s = -1; return -1;
|
|
} else if (a$2 > b$2) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if ((_1 === (13)) || (_1 === (14))) { */ case 5:
|
|
$s = -1; return floatCompare($clone(aVal, reflect.Value).Float(), $clone(bVal, reflect.Value).Float());
|
|
/* } else if ((_1 === (15)) || (_1 === (16))) { */ case 6:
|
|
_tmp$8 = $clone(aVal, reflect.Value).Complex();
|
|
_tmp$9 = $clone(bVal, reflect.Value).Complex();
|
|
a$3 = _tmp$8;
|
|
b$3 = _tmp$9;
|
|
c = floatCompare(a$3.$real, b$3.$real);
|
|
if (!((c === 0))) {
|
|
$s = -1; return c;
|
|
}
|
|
$s = -1; return floatCompare(a$3.$imag, b$3.$imag);
|
|
/* } else if (_1 === (1)) { */ case 7:
|
|
_tmp$10 = $clone(aVal, reflect.Value).Bool();
|
|
_tmp$11 = $clone(bVal, reflect.Value).Bool();
|
|
a$4 = _tmp$10;
|
|
b$4 = _tmp$11;
|
|
if (a$4 === b$4) {
|
|
$s = -1; return 0;
|
|
} else if (a$4) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return -1;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if (_1 === (22)) { */ case 8:
|
|
_tmp$12 = $clone(aVal, reflect.Value).Pointer();
|
|
_tmp$13 = $clone(bVal, reflect.Value).Pointer();
|
|
a$5 = _tmp$12;
|
|
b$5 = _tmp$13;
|
|
if (a$5 < b$5) {
|
|
$s = -1; return -1;
|
|
} else if (a$5 > b$5) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if (_1 === (18)) { */ case 9:
|
|
_tuple = nilCompare($clone(aVal, reflect.Value), $clone(bVal, reflect.Value));
|
|
c$1 = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
$s = -1; return c$1;
|
|
}
|
|
_tmp$14 = $clone(aVal, reflect.Value).Pointer();
|
|
_tmp$15 = $clone(bVal, reflect.Value).Pointer();
|
|
ap = _tmp$14;
|
|
bp = _tmp$15;
|
|
if (ap < bp) {
|
|
$s = -1; return -1;
|
|
} else if (ap > bp) {
|
|
$s = -1; return 1;
|
|
} else {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = 14; continue;
|
|
/* } else if (_1 === (25)) { */ case 10:
|
|
i = 0;
|
|
/* while (true) { */ case 17:
|
|
/* if (!(i < $clone(aVal, reflect.Value).NumField())) { break; } */ if(!(i < $clone(aVal, reflect.Value).NumField())) { $s = 18; continue; }
|
|
_r$2 = $clone(aVal, reflect.Value).Field(i); /* */ $s = 19; case 19: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_arg = $clone(_r$2, reflect.Value);
|
|
_r$3 = $clone(bVal, reflect.Value).Field(i); /* */ $s = 20; case 20: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_arg$1 = $clone(_r$3, reflect.Value);
|
|
_r$4 = compare(_arg, _arg$1); /* */ $s = 21; case 21: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
c$2 = _r$4;
|
|
if (!((c$2 === 0))) {
|
|
$s = -1; return c$2;
|
|
}
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 17; continue; case 18:
|
|
$s = -1; return 0;
|
|
/* } else if (_1 === (17)) { */ case 11:
|
|
i$1 = 0;
|
|
/* while (true) { */ case 22:
|
|
/* if (!(i$1 < $clone(aVal, reflect.Value).Len())) { break; } */ if(!(i$1 < $clone(aVal, reflect.Value).Len())) { $s = 23; continue; }
|
|
_r$5 = $clone(aVal, reflect.Value).Index(i$1); /* */ $s = 24; case 24: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_arg$2 = $clone(_r$5, reflect.Value);
|
|
_r$6 = $clone(bVal, reflect.Value).Index(i$1); /* */ $s = 25; case 25: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_arg$3 = $clone(_r$6, reflect.Value);
|
|
_r$7 = compare(_arg$2, _arg$3); /* */ $s = 26; case 26: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
c$3 = _r$7;
|
|
if (!((c$3 === 0))) {
|
|
$s = -1; return c$3;
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 22; continue; case 23:
|
|
$s = -1; return 0;
|
|
/* } else if (_1 === (20)) { */ case 12:
|
|
_tuple$1 = nilCompare($clone(aVal, reflect.Value), $clone(bVal, reflect.Value));
|
|
c$4 = _tuple$1[0];
|
|
ok$1 = _tuple$1[1];
|
|
if (ok$1) {
|
|
$s = -1; return c$4;
|
|
}
|
|
_r$8 = $clone(aVal, reflect.Value).Elem(); /* */ $s = 27; case 27: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
_r$9 = $clone(_r$8, reflect.Value).Type(); /* */ $s = 28; case 28: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_r$10 = reflect.ValueOf(_r$9); /* */ $s = 29; case 29: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_arg$4 = $clone(_r$10, reflect.Value);
|
|
_r$11 = $clone(bVal, reflect.Value).Elem(); /* */ $s = 30; case 30: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
_r$12 = $clone(_r$11, reflect.Value).Type(); /* */ $s = 31; case 31: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_r$13 = reflect.ValueOf(_r$12); /* */ $s = 32; case 32: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
_arg$5 = $clone(_r$13, reflect.Value);
|
|
_r$14 = compare(_arg$4, _arg$5); /* */ $s = 33; case 33: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
c$5 = _r$14;
|
|
if (!((c$5 === 0))) {
|
|
$s = -1; return c$5;
|
|
}
|
|
_r$15 = $clone(aVal, reflect.Value).Elem(); /* */ $s = 34; case 34: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
_arg$6 = $clone(_r$15, reflect.Value);
|
|
_r$16 = $clone(bVal, reflect.Value).Elem(); /* */ $s = 35; case 35: if($c) { $c = false; _r$16 = _r$16.$blk(); } if (_r$16 && _r$16.$blk !== undefined) { break s; }
|
|
_arg$7 = $clone(_r$16, reflect.Value);
|
|
_r$17 = compare(_arg$6, _arg$7); /* */ $s = 36; case 36: if($c) { $c = false; _r$17 = _r$17.$blk(); } if (_r$17 && _r$17.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$17;
|
|
/* } else { */ case 13:
|
|
_r$18 = aType.String(); /* */ $s = 37; case 37: if($c) { $c = false; _r$18 = _r$18.$blk(); } if (_r$18 && _r$18.$blk !== undefined) { break s; }
|
|
$panic(new $String("bad type in compare: " + _r$18));
|
|
/* } */ case 14:
|
|
case 1:
|
|
$s = -1; return 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: compare }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._arg$3 = _arg$3; $f._arg$4 = _arg$4; $f._arg$5 = _arg$5; $f._arg$6 = _arg$6; $f._arg$7 = _arg$7; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$16 = _r$16; $f._r$17 = _r$17; $f._r$18 = _r$18; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.a = a; $f.a$1 = a$1; $f.a$2 = a$2; $f.a$3 = a$3; $f.a$4 = a$4; $f.a$5 = a$5; $f.aType = aType; $f.aVal = aVal; $f.ap = ap; $f.b = b; $f.b$1 = b$1; $f.b$2 = b$2; $f.b$3 = b$3; $f.b$4 = b$4; $f.b$5 = b$5; $f.bType = bType; $f.bVal = bVal; $f.bp = bp; $f.c = c; $f.c$1 = c$1; $f.c$2 = c$2; $f.c$3 = c$3; $f.c$4 = c$4; $f.c$5 = c$5; $f.i = i; $f.i$1 = i$1; $f.ok = ok; $f.ok$1 = ok$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
nilCompare = function(aVal, bVal) {
|
|
var aVal, bVal;
|
|
if ($clone(aVal, reflect.Value).IsNil()) {
|
|
if ($clone(bVal, reflect.Value).IsNil()) {
|
|
return [0, true];
|
|
}
|
|
return [-1, true];
|
|
}
|
|
if ($clone(bVal, reflect.Value).IsNil()) {
|
|
return [1, true];
|
|
}
|
|
return [0, false];
|
|
};
|
|
floatCompare = function(a, b) {
|
|
var a, b;
|
|
if (isNaN(a)) {
|
|
return -1;
|
|
} else if (isNaN(b)) {
|
|
return 1;
|
|
} else if (a < b) {
|
|
return -1;
|
|
} else if (a > b) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
};
|
|
isNaN = function(a) {
|
|
var a;
|
|
return !((a === a));
|
|
};
|
|
ptrType.methods = [{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}];
|
|
SortedMap.init("", [{prop: "Key", name: "Key", embedded: false, exported: true, typ: sliceType, tag: ""}, {prop: "Value", name: "Value", embedded: false, exported: true, typ: sliceType, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = reflect.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sort.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["io"] = (function() {
|
|
var $pkg = {}, $init, errors, sync, atomic, Reader, Writer, ReadWriteCloser, ReaderFrom, WriterTo, RuneReader, RuneScanner, LimitedReader, sliceType, ptrType$1, errWhence, errOffset, ReadAtLeast, ReadFull, Copy, copyBuffer;
|
|
errors = $packages["errors"];
|
|
sync = $packages["sync"];
|
|
atomic = $packages["sync/atomic"];
|
|
Reader = $pkg.Reader = $newType(8, $kindInterface, "io.Reader", true, "io", true, null);
|
|
Writer = $pkg.Writer = $newType(8, $kindInterface, "io.Writer", true, "io", true, null);
|
|
ReadWriteCloser = $pkg.ReadWriteCloser = $newType(8, $kindInterface, "io.ReadWriteCloser", true, "io", true, null);
|
|
ReaderFrom = $pkg.ReaderFrom = $newType(8, $kindInterface, "io.ReaderFrom", true, "io", true, null);
|
|
WriterTo = $pkg.WriterTo = $newType(8, $kindInterface, "io.WriterTo", true, "io", true, null);
|
|
RuneReader = $pkg.RuneReader = $newType(8, $kindInterface, "io.RuneReader", true, "io", true, null);
|
|
RuneScanner = $pkg.RuneScanner = $newType(8, $kindInterface, "io.RuneScanner", true, "io", true, null);
|
|
LimitedReader = $pkg.LimitedReader = $newType(0, $kindStruct, "io.LimitedReader", true, "io", true, function(R_, N_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.R = $ifaceNil;
|
|
this.N = new $Int64(0, 0);
|
|
return;
|
|
}
|
|
this.R = R_;
|
|
this.N = N_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
ptrType$1 = $ptrType(LimitedReader);
|
|
ReadAtLeast = function(r, buf, min) {
|
|
var _r, _tmp, _tmp$1, _tuple, buf, err, min, n, nn, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; buf = $f.buf; err = $f.err; min = $f.min; n = $f.n; nn = $f.nn; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
if (buf.$length < min) {
|
|
_tmp = 0;
|
|
_tmp$1 = $pkg.ErrShortBuffer;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* while (true) { */ case 1:
|
|
/* if (!(n < min && $interfaceIsEqual(err, $ifaceNil))) { break; } */ if(!(n < min && $interfaceIsEqual(err, $ifaceNil))) { $s = 2; continue; }
|
|
nn = 0;
|
|
_r = r.Read($subslice(buf, n)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
nn = _tuple[0];
|
|
err = _tuple[1];
|
|
n = n + (nn) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (n >= min) {
|
|
err = $ifaceNil;
|
|
} else if (n > 0 && $interfaceIsEqual(err, $pkg.EOF)) {
|
|
err = $pkg.ErrUnexpectedEOF;
|
|
}
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ReadAtLeast }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.min = min; $f.n = n; $f.nn = nn; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.ReadAtLeast = ReadAtLeast;
|
|
ReadFull = function(r, buf) {
|
|
var _r, _tuple, buf, err, n, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; buf = $f.buf; err = $f.err; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_r = ReadAtLeast(r, buf, buf.$length); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ReadFull }; } $f._r = _r; $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.ReadFull = ReadFull;
|
|
Copy = function(dst, src) {
|
|
var _r, _tuple, dst, err, src, written, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; dst = $f.dst; err = $f.err; src = $f.src; written = $f.written; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
written = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
_r = copyBuffer(dst, src, sliceType.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
written = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [written, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Copy }; } $f._r = _r; $f._tuple = _tuple; $f.dst = dst; $f.err = err; $f.src = src; $f.written = written; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Copy = Copy;
|
|
copyBuffer = function(dst, src, buf) {
|
|
var _r, _r$1, _r$2, _r$3, _tmp, _tmp$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, buf, dst, er, err, ew, l, nr, nw, ok, ok$1, ok$2, rt, size, src, written, wt, x, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; buf = $f.buf; dst = $f.dst; er = $f.er; err = $f.err; ew = $f.ew; l = $f.l; nr = $f.nr; nw = $f.nw; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; rt = $f.rt; size = $f.size; src = $f.src; written = $f.written; wt = $f.wt; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
written = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
_tuple = $assertType(src, WriterTo, true);
|
|
wt = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = wt.WriteTo(dst); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
written = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
$s = -1; return [written, err];
|
|
/* } */ case 2:
|
|
_tuple$2 = $assertType(dst, ReaderFrom, true);
|
|
rt = _tuple$2[0];
|
|
ok$1 = _tuple$2[1];
|
|
/* */ if (ok$1) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (ok$1) { */ case 4:
|
|
_r$1 = rt.ReadFrom(src); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$1;
|
|
written = _tuple$3[0];
|
|
err = _tuple$3[1];
|
|
$s = -1; return [written, err];
|
|
/* } */ case 5:
|
|
if (buf === sliceType.nil) {
|
|
size = 32768;
|
|
_tuple$4 = $assertType(src, ptrType$1, true);
|
|
l = _tuple$4[0];
|
|
ok$2 = _tuple$4[1];
|
|
if (ok$2 && (x = (new $Int64(0, size)), x$1 = l.N, (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low > x$1.$low)))) {
|
|
if ((x$2 = l.N, (x$2.$high < 0 || (x$2.$high === 0 && x$2.$low < 1)))) {
|
|
size = 1;
|
|
} else {
|
|
size = (((x$3 = l.N, x$3.$low + ((x$3.$high >> 31) * 4294967296)) >> 0));
|
|
}
|
|
}
|
|
buf = $makeSlice(sliceType, size);
|
|
}
|
|
/* while (true) { */ case 7:
|
|
_r$2 = src.Read(buf); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$5 = _r$2;
|
|
nr = _tuple$5[0];
|
|
er = _tuple$5[1];
|
|
/* */ if (nr > 0) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (nr > 0) { */ case 10:
|
|
_r$3 = dst.Write($subslice(buf, 0, nr)); /* */ $s = 12; case 12: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_tuple$6 = _r$3;
|
|
nw = _tuple$6[0];
|
|
ew = _tuple$6[1];
|
|
if (nw > 0) {
|
|
written = (x$4 = (new $Int64(0, nw)), new $Int64(written.$high + x$4.$high, written.$low + x$4.$low));
|
|
}
|
|
if (!($interfaceIsEqual(ew, $ifaceNil))) {
|
|
err = ew;
|
|
/* break; */ $s = 8; continue;
|
|
}
|
|
if (!((nr === nw))) {
|
|
err = $pkg.ErrShortWrite;
|
|
/* break; */ $s = 8; continue;
|
|
}
|
|
/* } */ case 11:
|
|
if (!($interfaceIsEqual(er, $ifaceNil))) {
|
|
if (!($interfaceIsEqual(er, $pkg.EOF))) {
|
|
err = er;
|
|
}
|
|
/* break; */ $s = 8; continue;
|
|
}
|
|
/* } */ $s = 7; continue; case 8:
|
|
_tmp = written;
|
|
_tmp$1 = err;
|
|
written = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [written, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: copyBuffer }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f.buf = buf; $f.dst = dst; $f.er = er; $f.err = err; $f.ew = ew; $f.l = l; $f.nr = nr; $f.nw = nw; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.rt = rt; $f.size = size; $f.src = src; $f.written = written; $f.wt = wt; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
LimitedReader.ptr.prototype.Read = function(p) {
|
|
var _r, _tmp, _tmp$1, _tuple, err, l, n, p, x, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; err = $f.err; l = $f.l; n = $f.n; p = $f.p; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
l = this;
|
|
if ((x = l.N, (x.$high < 0 || (x.$high === 0 && x.$low <= 0)))) {
|
|
_tmp = 0;
|
|
_tmp$1 = $pkg.EOF;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
if ((x$1 = (new $Int64(0, p.$length)), x$2 = l.N, (x$1.$high > x$2.$high || (x$1.$high === x$2.$high && x$1.$low > x$2.$low)))) {
|
|
p = $subslice(p, 0, $flatten64(l.N));
|
|
}
|
|
_r = l.R.Read(p); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
l.N = (x$3 = l.N, x$4 = (new $Int64(0, n)), new $Int64(x$3.$high - x$4.$high, x$3.$low - x$4.$low));
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: LimitedReader.ptr.prototype.Read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.err = err; $f.l = l; $f.n = n; $f.p = p; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
LimitedReader.prototype.Read = function(p) { return this.$val.Read(p); };
|
|
ptrType$1.methods = [{prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}];
|
|
Reader.init([{prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}]);
|
|
Writer.init([{prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}]);
|
|
ReadWriteCloser.init([{prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}]);
|
|
ReaderFrom.init([{prop: "ReadFrom", name: "ReadFrom", pkg: "", typ: $funcType([Reader], [$Int64, $error], false)}]);
|
|
WriterTo.init([{prop: "WriteTo", name: "WriteTo", pkg: "", typ: $funcType([Writer], [$Int64, $error], false)}]);
|
|
RuneReader.init([{prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}]);
|
|
RuneScanner.init([{prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}, {prop: "UnreadRune", name: "UnreadRune", pkg: "", typ: $funcType([], [$error], false)}]);
|
|
LimitedReader.init("", [{prop: "R", name: "R", embedded: false, exported: true, typ: Reader, tag: ""}, {prop: "N", name: "N", embedded: false, exported: true, typ: $Int64, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.ErrShortWrite = errors.New("short write");
|
|
$pkg.ErrShortBuffer = errors.New("short buffer");
|
|
$pkg.EOF = errors.New("EOF");
|
|
$pkg.ErrUnexpectedEOF = errors.New("unexpected EOF");
|
|
$pkg.ErrNoProgress = errors.New("multiple Read calls return no data or error");
|
|
errWhence = errors.New("Seek: invalid whence");
|
|
errOffset = errors.New("Seek: invalid offset");
|
|
$pkg.ErrClosedPipe = errors.New("io: read/write on closed pipe");
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["syscall"] = (function() {
|
|
var $pkg = {}, $init, js, race, runtime, sync, RawConn, NetlinkRouteRequest, NetlinkMessage, NetlinkRouteAttr, SockaddrLinklayer, SockaddrNetlink, mmapper, Errno, Sockaddr, SockaddrInet4, SockaddrInet6, SockaddrUnix, Timespec, Stat_t, RawSockaddrInet4, RawSockaddrInet6, RawSockaddrUnix, RawSockaddrLinklayer, RawSockaddrNetlink, RawSockaddr, RawSockaddrAny, _Socklen, Linger, Iovec, IPMreq, IPMreqn, IPv6Mreq, Msghdr, NlMsghdr, RtGenmsg, RtAttr, IfInfomsg, IfAddrmsg, sliceType, sliceType$1, ptrType$2, ptrType$4, arrayType$1, ptrType$9, arrayType$2, ptrType$12, sliceType$6, ptrType$13, sliceType$7, ptrType$14, arrayType$4, arrayType$5, arrayType$8, arrayType$9, arrayType$10, arrayType$11, ptrType$19, ptrType$20, structType, ptrType$23, funcType, funcType$1, ptrType$24, ptrType$25, ptrType$26, mapType, funcType$2, funcType$3, ptrType$27, ptrType$28, ptrType$29, ptrType$30, ptrType$32, warningPrinted, lineBuffer, syscallModule, alreadyTriedToLoad, minusOne, envs, mapper, errEAGAIN, errEINVAL, errENOENT, ioSync, ioSync$24ptr, errors, init, printWarning, printToConsole, Exit, indexByte, runtime_envs, syscallByName, Syscall, Syscall6, RawSyscall, BytePtrFromString, readInt, readIntBE, readIntLE, ParseDirent, CloseOnExec, SetNonblock, msanRead, msanWrite, nlmAlignOf, rtaAlignOf, newNetlinkRouteRequest, NetlinkRIB, ParseNetlinkMessage, netlinkMessageHeaderAndData, ParseNetlinkRouteAttr, netlinkRouteAttrAndValue, itoa, uitoa, Getpagesize, Chmod, Fchmodat, Open, anyToSockaddr, Accept, Accept4, Getsockname, SetsockoptIPMreqn, Recvmsg, SendmsgN, ReadDirent, direntIno, direntReclen, direntNamlen, Stat, Lstat, errnoErr, Read, Write, Bind, GetsockoptInt, Recvfrom, Sendto, SetsockoptByte, SetsockoptInt, SetsockoptInet4Addr, SetsockoptIPMreq, SetsockoptIPv6Mreq, SetsockoptLinger, Socket, fchmodat, openat, Close, Dup, Fchdir, Fchmod, fcntl, Fsync, Getdents, read, write, munmap, Fchown, Fstat, Ftruncate, Pread, Pwrite, Seek, Shutdown, accept, accept4, bind, fstatat, getsockopt, setsockopt, socket, getsockname, recvfrom, sendto, recvmsg, sendmsg, mmap;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
race = $packages["internal/race"];
|
|
runtime = $packages["runtime"];
|
|
sync = $packages["sync"];
|
|
RawConn = $pkg.RawConn = $newType(8, $kindInterface, "syscall.RawConn", true, "syscall", true, null);
|
|
NetlinkRouteRequest = $pkg.NetlinkRouteRequest = $newType(0, $kindStruct, "syscall.NetlinkRouteRequest", true, "syscall", true, function(Header_, Data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Header = new NlMsghdr.ptr(0, 0, 0, 0, 0);
|
|
this.Data = new RtGenmsg.ptr(0);
|
|
return;
|
|
}
|
|
this.Header = Header_;
|
|
this.Data = Data_;
|
|
});
|
|
NetlinkMessage = $pkg.NetlinkMessage = $newType(0, $kindStruct, "syscall.NetlinkMessage", true, "syscall", true, function(Header_, Data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Header = new NlMsghdr.ptr(0, 0, 0, 0, 0);
|
|
this.Data = sliceType.nil;
|
|
return;
|
|
}
|
|
this.Header = Header_;
|
|
this.Data = Data_;
|
|
});
|
|
NetlinkRouteAttr = $pkg.NetlinkRouteAttr = $newType(0, $kindStruct, "syscall.NetlinkRouteAttr", true, "syscall", true, function(Attr_, Value_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Attr = new RtAttr.ptr(0, 0);
|
|
this.Value = sliceType.nil;
|
|
return;
|
|
}
|
|
this.Attr = Attr_;
|
|
this.Value = Value_;
|
|
});
|
|
SockaddrLinklayer = $pkg.SockaddrLinklayer = $newType(0, $kindStruct, "syscall.SockaddrLinklayer", true, "syscall", true, function(Protocol_, Ifindex_, Hatype_, Pkttype_, Halen_, Addr_, raw_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Protocol = 0;
|
|
this.Ifindex = 0;
|
|
this.Hatype = 0;
|
|
this.Pkttype = 0;
|
|
this.Halen = 0;
|
|
this.Addr = arrayType$1.zero();
|
|
this.raw = new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero());
|
|
return;
|
|
}
|
|
this.Protocol = Protocol_;
|
|
this.Ifindex = Ifindex_;
|
|
this.Hatype = Hatype_;
|
|
this.Pkttype = Pkttype_;
|
|
this.Halen = Halen_;
|
|
this.Addr = Addr_;
|
|
this.raw = raw_;
|
|
});
|
|
SockaddrNetlink = $pkg.SockaddrNetlink = $newType(0, $kindStruct, "syscall.SockaddrNetlink", true, "syscall", true, function(Family_, Pad_, Pid_, Groups_, raw_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Pad = 0;
|
|
this.Pid = 0;
|
|
this.Groups = 0;
|
|
this.raw = new RawSockaddrNetlink.ptr(0, 0, 0, 0);
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Pad = Pad_;
|
|
this.Pid = Pid_;
|
|
this.Groups = Groups_;
|
|
this.raw = raw_;
|
|
});
|
|
mmapper = $pkg.mmapper = $newType(0, $kindStruct, "syscall.mmapper", true, "syscall", false, function(Mutex_, active_, mmap_, munmap_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Mutex = new sync.Mutex.ptr(0, 0);
|
|
this.active = false;
|
|
this.mmap = $throwNilPointerError;
|
|
this.munmap = $throwNilPointerError;
|
|
return;
|
|
}
|
|
this.Mutex = Mutex_;
|
|
this.active = active_;
|
|
this.mmap = mmap_;
|
|
this.munmap = munmap_;
|
|
});
|
|
Errno = $pkg.Errno = $newType(4, $kindUintptr, "syscall.Errno", true, "syscall", true, null);
|
|
Sockaddr = $pkg.Sockaddr = $newType(8, $kindInterface, "syscall.Sockaddr", true, "syscall", true, null);
|
|
SockaddrInet4 = $pkg.SockaddrInet4 = $newType(0, $kindStruct, "syscall.SockaddrInet4", true, "syscall", true, function(Port_, Addr_, raw_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Port = 0;
|
|
this.Addr = arrayType$9.zero();
|
|
this.raw = new RawSockaddrInet4.ptr(0, 0, arrayType$9.zero(), arrayType$1.zero());
|
|
return;
|
|
}
|
|
this.Port = Port_;
|
|
this.Addr = Addr_;
|
|
this.raw = raw_;
|
|
});
|
|
SockaddrInet6 = $pkg.SockaddrInet6 = $newType(0, $kindStruct, "syscall.SockaddrInet6", true, "syscall", true, function(Port_, ZoneId_, Addr_, raw_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Port = 0;
|
|
this.ZoneId = 0;
|
|
this.Addr = arrayType$2.zero();
|
|
this.raw = new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0);
|
|
return;
|
|
}
|
|
this.Port = Port_;
|
|
this.ZoneId = ZoneId_;
|
|
this.Addr = Addr_;
|
|
this.raw = raw_;
|
|
});
|
|
SockaddrUnix = $pkg.SockaddrUnix = $newType(0, $kindStruct, "syscall.SockaddrUnix", true, "syscall", true, function(Name_, raw_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Name = "";
|
|
this.raw = new RawSockaddrUnix.ptr(0, arrayType$8.zero());
|
|
return;
|
|
}
|
|
this.Name = Name_;
|
|
this.raw = raw_;
|
|
});
|
|
Timespec = $pkg.Timespec = $newType(0, $kindStruct, "syscall.Timespec", true, "syscall", true, function(Sec_, Nsec_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Sec = new $Int64(0, 0);
|
|
this.Nsec = new $Int64(0, 0);
|
|
return;
|
|
}
|
|
this.Sec = Sec_;
|
|
this.Nsec = Nsec_;
|
|
});
|
|
Stat_t = $pkg.Stat_t = $newType(0, $kindStruct, "syscall.Stat_t", true, "syscall", true, function(Dev_, Ino_, Nlink_, Mode_, Uid_, Gid_, X__pad0_, Rdev_, Size_, Blksize_, Blocks_, Atim_, Mtim_, Ctim_, X__unused_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Dev = new $Uint64(0, 0);
|
|
this.Ino = new $Uint64(0, 0);
|
|
this.Nlink = new $Uint64(0, 0);
|
|
this.Mode = 0;
|
|
this.Uid = 0;
|
|
this.Gid = 0;
|
|
this.X__pad0 = 0;
|
|
this.Rdev = new $Uint64(0, 0);
|
|
this.Size = new $Int64(0, 0);
|
|
this.Blksize = new $Int64(0, 0);
|
|
this.Blocks = new $Int64(0, 0);
|
|
this.Atim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
|
|
this.Mtim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
|
|
this.Ctim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
|
|
this.X__unused = arrayType$5.zero();
|
|
return;
|
|
}
|
|
this.Dev = Dev_;
|
|
this.Ino = Ino_;
|
|
this.Nlink = Nlink_;
|
|
this.Mode = Mode_;
|
|
this.Uid = Uid_;
|
|
this.Gid = Gid_;
|
|
this.X__pad0 = X__pad0_;
|
|
this.Rdev = Rdev_;
|
|
this.Size = Size_;
|
|
this.Blksize = Blksize_;
|
|
this.Blocks = Blocks_;
|
|
this.Atim = Atim_;
|
|
this.Mtim = Mtim_;
|
|
this.Ctim = Ctim_;
|
|
this.X__unused = X__unused_;
|
|
});
|
|
RawSockaddrInet4 = $pkg.RawSockaddrInet4 = $newType(0, $kindStruct, "syscall.RawSockaddrInet4", true, "syscall", true, function(Family_, Port_, Addr_, Zero_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Port = 0;
|
|
this.Addr = arrayType$9.zero();
|
|
this.Zero = arrayType$1.zero();
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Port = Port_;
|
|
this.Addr = Addr_;
|
|
this.Zero = Zero_;
|
|
});
|
|
RawSockaddrInet6 = $pkg.RawSockaddrInet6 = $newType(0, $kindStruct, "syscall.RawSockaddrInet6", true, "syscall", true, function(Family_, Port_, Flowinfo_, Addr_, Scope_id_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Port = 0;
|
|
this.Flowinfo = 0;
|
|
this.Addr = arrayType$2.zero();
|
|
this.Scope_id = 0;
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Port = Port_;
|
|
this.Flowinfo = Flowinfo_;
|
|
this.Addr = Addr_;
|
|
this.Scope_id = Scope_id_;
|
|
});
|
|
RawSockaddrUnix = $pkg.RawSockaddrUnix = $newType(0, $kindStruct, "syscall.RawSockaddrUnix", true, "syscall", true, function(Family_, Path_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Path = arrayType$8.zero();
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Path = Path_;
|
|
});
|
|
RawSockaddrLinklayer = $pkg.RawSockaddrLinklayer = $newType(0, $kindStruct, "syscall.RawSockaddrLinklayer", true, "syscall", true, function(Family_, Protocol_, Ifindex_, Hatype_, Pkttype_, Halen_, Addr_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Protocol = 0;
|
|
this.Ifindex = 0;
|
|
this.Hatype = 0;
|
|
this.Pkttype = 0;
|
|
this.Halen = 0;
|
|
this.Addr = arrayType$1.zero();
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Protocol = Protocol_;
|
|
this.Ifindex = Ifindex_;
|
|
this.Hatype = Hatype_;
|
|
this.Pkttype = Pkttype_;
|
|
this.Halen = Halen_;
|
|
this.Addr = Addr_;
|
|
});
|
|
RawSockaddrNetlink = $pkg.RawSockaddrNetlink = $newType(0, $kindStruct, "syscall.RawSockaddrNetlink", true, "syscall", true, function(Family_, Pad_, Pid_, Groups_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Pad = 0;
|
|
this.Pid = 0;
|
|
this.Groups = 0;
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Pad = Pad_;
|
|
this.Pid = Pid_;
|
|
this.Groups = Groups_;
|
|
});
|
|
RawSockaddr = $pkg.RawSockaddr = $newType(0, $kindStruct, "syscall.RawSockaddr", true, "syscall", true, function(Family_, Data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Data = arrayType$10.zero();
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Data = Data_;
|
|
});
|
|
RawSockaddrAny = $pkg.RawSockaddrAny = $newType(0, $kindStruct, "syscall.RawSockaddrAny", true, "syscall", true, function(Addr_, Pad_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Addr = new RawSockaddr.ptr(0, arrayType$10.zero());
|
|
this.Pad = arrayType$11.zero();
|
|
return;
|
|
}
|
|
this.Addr = Addr_;
|
|
this.Pad = Pad_;
|
|
});
|
|
_Socklen = $pkg._Socklen = $newType(4, $kindUint32, "syscall._Socklen", true, "syscall", false, null);
|
|
Linger = $pkg.Linger = $newType(0, $kindStruct, "syscall.Linger", true, "syscall", true, function(Onoff_, Linger_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Onoff = 0;
|
|
this.Linger = 0;
|
|
return;
|
|
}
|
|
this.Onoff = Onoff_;
|
|
this.Linger = Linger_;
|
|
});
|
|
Iovec = $pkg.Iovec = $newType(0, $kindStruct, "syscall.Iovec", true, "syscall", true, function(Base_, Len_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Base = ptrType$2.nil;
|
|
this.Len = new $Uint64(0, 0);
|
|
return;
|
|
}
|
|
this.Base = Base_;
|
|
this.Len = Len_;
|
|
});
|
|
IPMreq = $pkg.IPMreq = $newType(0, $kindStruct, "syscall.IPMreq", true, "syscall", true, function(Multiaddr_, Interface_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Multiaddr = arrayType$9.zero();
|
|
this.Interface = arrayType$9.zero();
|
|
return;
|
|
}
|
|
this.Multiaddr = Multiaddr_;
|
|
this.Interface = Interface_;
|
|
});
|
|
IPMreqn = $pkg.IPMreqn = $newType(0, $kindStruct, "syscall.IPMreqn", true, "syscall", true, function(Multiaddr_, Address_, Ifindex_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Multiaddr = arrayType$9.zero();
|
|
this.Address = arrayType$9.zero();
|
|
this.Ifindex = 0;
|
|
return;
|
|
}
|
|
this.Multiaddr = Multiaddr_;
|
|
this.Address = Address_;
|
|
this.Ifindex = Ifindex_;
|
|
});
|
|
IPv6Mreq = $pkg.IPv6Mreq = $newType(0, $kindStruct, "syscall.IPv6Mreq", true, "syscall", true, function(Multiaddr_, Interface_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Multiaddr = arrayType$2.zero();
|
|
this.Interface = 0;
|
|
return;
|
|
}
|
|
this.Multiaddr = Multiaddr_;
|
|
this.Interface = Interface_;
|
|
});
|
|
Msghdr = $pkg.Msghdr = $newType(0, $kindStruct, "syscall.Msghdr", true, "syscall", true, function(Name_, Namelen_, Pad_cgo_0_, Iov_, Iovlen_, Control_, Controllen_, Flags_, Pad_cgo_1_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Name = ptrType$2.nil;
|
|
this.Namelen = 0;
|
|
this.Pad_cgo_0 = arrayType$9.zero();
|
|
this.Iov = ptrType$20.nil;
|
|
this.Iovlen = new $Uint64(0, 0);
|
|
this.Control = ptrType$2.nil;
|
|
this.Controllen = new $Uint64(0, 0);
|
|
this.Flags = 0;
|
|
this.Pad_cgo_1 = arrayType$9.zero();
|
|
return;
|
|
}
|
|
this.Name = Name_;
|
|
this.Namelen = Namelen_;
|
|
this.Pad_cgo_0 = Pad_cgo_0_;
|
|
this.Iov = Iov_;
|
|
this.Iovlen = Iovlen_;
|
|
this.Control = Control_;
|
|
this.Controllen = Controllen_;
|
|
this.Flags = Flags_;
|
|
this.Pad_cgo_1 = Pad_cgo_1_;
|
|
});
|
|
NlMsghdr = $pkg.NlMsghdr = $newType(0, $kindStruct, "syscall.NlMsghdr", true, "syscall", true, function(Len_, Type_, Flags_, Seq_, Pid_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Len = 0;
|
|
this.Type = 0;
|
|
this.Flags = 0;
|
|
this.Seq = 0;
|
|
this.Pid = 0;
|
|
return;
|
|
}
|
|
this.Len = Len_;
|
|
this.Type = Type_;
|
|
this.Flags = Flags_;
|
|
this.Seq = Seq_;
|
|
this.Pid = Pid_;
|
|
});
|
|
RtGenmsg = $pkg.RtGenmsg = $newType(0, $kindStruct, "syscall.RtGenmsg", true, "syscall", true, function(Family_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
});
|
|
RtAttr = $pkg.RtAttr = $newType(0, $kindStruct, "syscall.RtAttr", true, "syscall", true, function(Len_, Type_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Len = 0;
|
|
this.Type = 0;
|
|
return;
|
|
}
|
|
this.Len = Len_;
|
|
this.Type = Type_;
|
|
});
|
|
IfInfomsg = $pkg.IfInfomsg = $newType(0, $kindStruct, "syscall.IfInfomsg", true, "syscall", true, function(Family_, X__ifi_pad_, Type_, Index_, Flags_, Change_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.X__ifi_pad = 0;
|
|
this.Type = 0;
|
|
this.Index = 0;
|
|
this.Flags = 0;
|
|
this.Change = 0;
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.X__ifi_pad = X__ifi_pad_;
|
|
this.Type = Type_;
|
|
this.Index = Index_;
|
|
this.Flags = Flags_;
|
|
this.Change = Change_;
|
|
});
|
|
IfAddrmsg = $pkg.IfAddrmsg = $newType(0, $kindStruct, "syscall.IfAddrmsg", true, "syscall", true, function(Family_, Prefixlen_, Flags_, Scope_, Index_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Family = 0;
|
|
this.Prefixlen = 0;
|
|
this.Flags = 0;
|
|
this.Scope = 0;
|
|
this.Index = 0;
|
|
return;
|
|
}
|
|
this.Family = Family_;
|
|
this.Prefixlen = Prefixlen_;
|
|
this.Flags = Flags_;
|
|
this.Scope = Scope_;
|
|
this.Index = Index_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
sliceType$1 = $sliceType($String);
|
|
ptrType$2 = $ptrType($Uint8);
|
|
ptrType$4 = $ptrType($Int32);
|
|
arrayType$1 = $arrayType($Uint8, 8);
|
|
ptrType$9 = $ptrType($Uint16);
|
|
arrayType$2 = $arrayType($Uint8, 16);
|
|
ptrType$12 = $ptrType(SockaddrNetlink);
|
|
sliceType$6 = $sliceType(NetlinkMessage);
|
|
ptrType$13 = $ptrType(NlMsghdr);
|
|
sliceType$7 = $sliceType(NetlinkRouteAttr);
|
|
ptrType$14 = $ptrType(RtAttr);
|
|
arrayType$4 = $arrayType($Uint8, 32);
|
|
arrayType$5 = $arrayType($Int64, 3);
|
|
arrayType$8 = $arrayType($Int8, 108);
|
|
arrayType$9 = $arrayType($Uint8, 4);
|
|
arrayType$10 = $arrayType($Int8, 14);
|
|
arrayType$11 = $arrayType($Int8, 96);
|
|
ptrType$19 = $ptrType(_Socklen);
|
|
ptrType$20 = $ptrType(Iovec);
|
|
structType = $structType("syscall", [{prop: "addr", name: "addr", embedded: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "len", name: "len", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "cap", name: "cap", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
ptrType$23 = $ptrType($Int64);
|
|
funcType = $funcType([$Uintptr], [], false);
|
|
funcType$1 = $funcType([$Uintptr], [$Bool], false);
|
|
ptrType$24 = $ptrType(NetlinkRouteRequest);
|
|
ptrType$25 = $ptrType(SockaddrLinklayer);
|
|
ptrType$26 = $ptrType(mmapper);
|
|
mapType = $mapType(ptrType$2, sliceType);
|
|
funcType$2 = $funcType([$Uintptr, $Uintptr, $Int, $Int, $Int, $Int64], [$Uintptr, $error], false);
|
|
funcType$3 = $funcType([$Uintptr, $Uintptr], [$error], false);
|
|
ptrType$27 = $ptrType(SockaddrInet4);
|
|
ptrType$28 = $ptrType(SockaddrInet6);
|
|
ptrType$29 = $ptrType(SockaddrUnix);
|
|
ptrType$30 = $ptrType(Timespec);
|
|
ptrType$32 = $ptrType(Msghdr);
|
|
init = function() {
|
|
$flushConsole = (function() {
|
|
if (!((lineBuffer.$length === 0))) {
|
|
$global.console.log($externalize(($bytesToString(lineBuffer)), $String));
|
|
lineBuffer = sliceType.nil;
|
|
}
|
|
});
|
|
};
|
|
printWarning = function() {
|
|
if (!warningPrinted) {
|
|
$global.console.error($externalize("warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md", $String));
|
|
}
|
|
warningPrinted = true;
|
|
};
|
|
printToConsole = function(b) {
|
|
var b, goPrintToConsole, i;
|
|
goPrintToConsole = $global.goPrintToConsole;
|
|
if (!(goPrintToConsole === undefined)) {
|
|
goPrintToConsole(b);
|
|
return;
|
|
}
|
|
lineBuffer = $appendSlice(lineBuffer, b);
|
|
while (true) {
|
|
i = indexByte(lineBuffer, 10);
|
|
if (i === -1) {
|
|
break;
|
|
}
|
|
$global.console.log($externalize(($bytesToString($subslice(lineBuffer, 0, i))), $String));
|
|
lineBuffer = $subslice(lineBuffer, (i + 1 >> 0));
|
|
}
|
|
};
|
|
Exit = function(code) {
|
|
var code;
|
|
Syscall(231, ((code >>> 0)), 0, 0);
|
|
};
|
|
$pkg.Exit = Exit;
|
|
indexByte = function(s, c) {
|
|
var _i, _ref, b, c, i, s;
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (b === c) {
|
|
return i;
|
|
}
|
|
_i++;
|
|
}
|
|
return -1;
|
|
};
|
|
runtime_envs = function() {
|
|
var envkeys, envs$1, i, jsEnv, key, process;
|
|
process = $global.process;
|
|
if (process === undefined) {
|
|
return sliceType$1.nil;
|
|
}
|
|
jsEnv = process.env;
|
|
envkeys = $global.Object.keys(jsEnv);
|
|
envs$1 = $makeSlice(sliceType$1, $parseInt(envkeys.length));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < $parseInt(envkeys.length))) { break; }
|
|
key = $internalize(envkeys[i], $String);
|
|
((i < 0 || i >= envs$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : envs$1.$array[envs$1.$offset + i] = key + "=" + $internalize(jsEnv[$externalize(key, $String)], $String));
|
|
i = i + (1) >> 0;
|
|
}
|
|
return envs$1;
|
|
};
|
|
syscallByName = function(name) {
|
|
var name, require, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
$deferred.push([(function() {
|
|
$recover();
|
|
}), []]);
|
|
if (syscallModule === null) {
|
|
if (alreadyTriedToLoad) {
|
|
return null;
|
|
}
|
|
alreadyTriedToLoad = true;
|
|
require = $global.require;
|
|
if (require === undefined) {
|
|
$panic(new $String(""));
|
|
}
|
|
syscallModule = require($externalize("syscall", $String));
|
|
}
|
|
return syscallModule[$externalize(name, $String)];
|
|
/* */ } catch(err) { $err = err; return null; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Syscall = function(trap, a1, a2, a3) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, a1, a2, a3, array, err, f, r, r1, r2, slice, trap;
|
|
r1 = 0;
|
|
r2 = 0;
|
|
err = 0;
|
|
f = syscallByName("Syscall");
|
|
if (!(f === null)) {
|
|
r = f(trap, a1, a2, a3);
|
|
_tmp = ((($parseInt(r[0]) >> 0) >>> 0));
|
|
_tmp$1 = ((($parseInt(r[1]) >> 0) >>> 0));
|
|
_tmp$2 = ((($parseInt(r[2]) >> 0) >>> 0));
|
|
r1 = _tmp;
|
|
r2 = _tmp$1;
|
|
err = _tmp$2;
|
|
return [r1, r2, err];
|
|
}
|
|
if ((trap === 1) && ((a1 === 1) || (a1 === 2))) {
|
|
array = a2;
|
|
slice = $makeSlice(sliceType, $parseInt(array.length));
|
|
slice.$array = array;
|
|
printToConsole(slice);
|
|
_tmp$3 = (($parseInt(array.length) >>> 0));
|
|
_tmp$4 = 0;
|
|
_tmp$5 = 0;
|
|
r1 = _tmp$3;
|
|
r2 = _tmp$4;
|
|
err = _tmp$5;
|
|
return [r1, r2, err];
|
|
}
|
|
if (trap === 231) {
|
|
runtime.Goexit();
|
|
}
|
|
printWarning();
|
|
_tmp$6 = ((minusOne >>> 0));
|
|
_tmp$7 = 0;
|
|
_tmp$8 = 13;
|
|
r1 = _tmp$6;
|
|
r2 = _tmp$7;
|
|
err = _tmp$8;
|
|
return [r1, r2, err];
|
|
};
|
|
$pkg.Syscall = Syscall;
|
|
Syscall6 = function(trap, a1, a2, a3, a4, a5, a6) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, a1, a2, a3, a4, a5, a6, err, f, r, r1, r2, trap;
|
|
r1 = 0;
|
|
r2 = 0;
|
|
err = 0;
|
|
f = syscallByName("Syscall6");
|
|
if (!(f === null)) {
|
|
r = f(trap, a1, a2, a3, a4, a5, a6);
|
|
_tmp = ((($parseInt(r[0]) >> 0) >>> 0));
|
|
_tmp$1 = ((($parseInt(r[1]) >> 0) >>> 0));
|
|
_tmp$2 = ((($parseInt(r[2]) >> 0) >>> 0));
|
|
r1 = _tmp;
|
|
r2 = _tmp$1;
|
|
err = _tmp$2;
|
|
return [r1, r2, err];
|
|
}
|
|
if (!((trap === 202))) {
|
|
printWarning();
|
|
}
|
|
_tmp$3 = ((minusOne >>> 0));
|
|
_tmp$4 = 0;
|
|
_tmp$5 = 13;
|
|
r1 = _tmp$3;
|
|
r2 = _tmp$4;
|
|
err = _tmp$5;
|
|
return [r1, r2, err];
|
|
};
|
|
$pkg.Syscall6 = Syscall6;
|
|
RawSyscall = function(trap, a1, a2, a3) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, a1, a2, a3, err, f, r, r1, r2, trap;
|
|
r1 = 0;
|
|
r2 = 0;
|
|
err = 0;
|
|
f = syscallByName("Syscall");
|
|
if (!(f === null)) {
|
|
r = f(trap, a1, a2, a3);
|
|
_tmp = ((($parseInt(r[0]) >> 0) >>> 0));
|
|
_tmp$1 = ((($parseInt(r[1]) >> 0) >>> 0));
|
|
_tmp$2 = ((($parseInt(r[2]) >> 0) >>> 0));
|
|
r1 = _tmp;
|
|
r2 = _tmp$1;
|
|
err = _tmp$2;
|
|
return [r1, r2, err];
|
|
}
|
|
printWarning();
|
|
_tmp$3 = ((minusOne >>> 0));
|
|
_tmp$4 = 0;
|
|
_tmp$5 = 13;
|
|
r1 = _tmp$3;
|
|
r2 = _tmp$4;
|
|
err = _tmp$5;
|
|
return [r1, r2, err];
|
|
};
|
|
$pkg.RawSyscall = RawSyscall;
|
|
BytePtrFromString = function(s) {
|
|
var _i, _ref, array, b, i, s;
|
|
array = new ($global.Uint8Array)(s.length + 1 >> 0);
|
|
_ref = (new sliceType($stringToBytes(s)));
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (b === 0) {
|
|
return [ptrType$2.nil, new Errno(22)];
|
|
}
|
|
array[i] = b;
|
|
_i++;
|
|
}
|
|
array[s.length] = 0;
|
|
return [((array)), $ifaceNil];
|
|
};
|
|
$pkg.BytePtrFromString = BytePtrFromString;
|
|
readInt = function(b, off, size) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, b, off, ok, size, u;
|
|
u = new $Uint64(0, 0);
|
|
ok = false;
|
|
if (b.$length < (((off + size >>> 0) >> 0))) {
|
|
_tmp = new $Uint64(0, 0);
|
|
_tmp$1 = false;
|
|
u = _tmp;
|
|
ok = _tmp$1;
|
|
return [u, ok];
|
|
}
|
|
if (false) {
|
|
_tmp$2 = readIntBE($subslice(b, off), size);
|
|
_tmp$3 = true;
|
|
u = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [u, ok];
|
|
}
|
|
_tmp$4 = readIntLE($subslice(b, off), size);
|
|
_tmp$5 = true;
|
|
u = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [u, ok];
|
|
};
|
|
readIntBE = function(b, size) {
|
|
var _1, b, size, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
_1 = size;
|
|
if (_1 === (1)) {
|
|
return (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0])));
|
|
} else if (_1 === (2)) {
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
return (x = (new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), x$1 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 8), new $Uint64(x.$high | x$1.$high, (x.$low | x$1.$low) >>> 0));
|
|
} else if (_1 === (4)) {
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
return (x$2 = (x$3 = (x$4 = (new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), x$5 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 8), new $Uint64(x$4.$high | x$5.$high, (x$4.$low | x$5.$low) >>> 0)), x$6 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 16), new $Uint64(x$3.$high | x$6.$high, (x$3.$low | x$6.$low) >>> 0)), x$7 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 24), new $Uint64(x$2.$high | x$7.$high, (x$2.$low | x$7.$low) >>> 0));
|
|
} else if (_1 === (8)) {
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
return (x$8 = (x$9 = (x$10 = (x$11 = (x$12 = (x$13 = (x$14 = (new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), x$15 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 8), new $Uint64(x$14.$high | x$15.$high, (x$14.$low | x$15.$low) >>> 0)), x$16 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 16), new $Uint64(x$13.$high | x$16.$high, (x$13.$low | x$16.$low) >>> 0)), x$17 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 24), new $Uint64(x$12.$high | x$17.$high, (x$12.$low | x$17.$low) >>> 0)), x$18 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 32), new $Uint64(x$11.$high | x$18.$high, (x$11.$low | x$18.$low) >>> 0)), x$19 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 40), new $Uint64(x$10.$high | x$19.$high, (x$10.$low | x$19.$low) >>> 0)), x$20 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 48), new $Uint64(x$9.$high | x$20.$high, (x$9.$low | x$20.$low) >>> 0)), x$21 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 56), new $Uint64(x$8.$high | x$21.$high, (x$8.$low | x$21.$low) >>> 0));
|
|
} else {
|
|
$panic(new $String("syscall: readInt with unsupported size"));
|
|
}
|
|
};
|
|
readIntLE = function(b, size) {
|
|
var _1, b, size, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
_1 = size;
|
|
if (_1 === (1)) {
|
|
return (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0])));
|
|
} else if (_1 === (2)) {
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
return (x = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$1 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x.$high | x$1.$high, (x.$low | x$1.$low) >>> 0));
|
|
} else if (_1 === (4)) {
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
return (x$2 = (x$3 = (x$4 = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$5 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x$4.$high | x$5.$high, (x$4.$low | x$5.$low) >>> 0)), x$6 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 16), new $Uint64(x$3.$high | x$6.$high, (x$3.$low | x$6.$low) >>> 0)), x$7 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 24), new $Uint64(x$2.$high | x$7.$high, (x$2.$low | x$7.$low) >>> 0));
|
|
} else if (_1 === (8)) {
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
return (x$8 = (x$9 = (x$10 = (x$11 = (x$12 = (x$13 = (x$14 = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$15 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x$14.$high | x$15.$high, (x$14.$low | x$15.$low) >>> 0)), x$16 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 16), new $Uint64(x$13.$high | x$16.$high, (x$13.$low | x$16.$low) >>> 0)), x$17 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 24), new $Uint64(x$12.$high | x$17.$high, (x$12.$low | x$17.$low) >>> 0)), x$18 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 32), new $Uint64(x$11.$high | x$18.$high, (x$11.$low | x$18.$low) >>> 0)), x$19 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 40), new $Uint64(x$10.$high | x$19.$high, (x$10.$low | x$19.$low) >>> 0)), x$20 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 48), new $Uint64(x$9.$high | x$20.$high, (x$9.$low | x$20.$low) >>> 0)), x$21 = $shiftLeft64((new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), 56), new $Uint64(x$8.$high | x$21.$high, (x$8.$low | x$21.$low) >>> 0));
|
|
} else {
|
|
$panic(new $String("syscall: readInt with unsupported size"));
|
|
}
|
|
};
|
|
ParseDirent = function(buf, max, names) {
|
|
var _i, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, _tuple$2, buf, c, consumed, count, i, ino, max, name, names, namlen, newnames, ok, origlen, rec, reclen, x, x$1, x$2;
|
|
consumed = 0;
|
|
count = 0;
|
|
newnames = sliceType$1.nil;
|
|
origlen = buf.$length;
|
|
count = 0;
|
|
while (true) {
|
|
if (!(!((max === 0)) && buf.$length > 0)) { break; }
|
|
_tuple = direntReclen(buf);
|
|
reclen = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!ok || (x = (new $Uint64(0, buf.$length)), (reclen.$high > x.$high || (reclen.$high === x.$high && reclen.$low > x.$low)))) {
|
|
_tmp = origlen;
|
|
_tmp$1 = count;
|
|
_tmp$2 = names;
|
|
consumed = _tmp;
|
|
count = _tmp$1;
|
|
newnames = _tmp$2;
|
|
return [consumed, count, newnames];
|
|
}
|
|
rec = $subslice(buf, 0, $flatten64(reclen));
|
|
buf = $subslice(buf, $flatten64(reclen));
|
|
_tuple$1 = direntIno(rec);
|
|
ino = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
if (!ok) {
|
|
break;
|
|
}
|
|
if ((ino.$high === 0 && ino.$low === 0)) {
|
|
continue;
|
|
}
|
|
_tuple$2 = direntNamlen(rec);
|
|
namlen = _tuple$2[0];
|
|
ok = _tuple$2[1];
|
|
if (!ok || (x$1 = new $Uint64(0 + namlen.$high, 19 + namlen.$low), x$2 = (new $Uint64(0, rec.$length)), (x$1.$high > x$2.$high || (x$1.$high === x$2.$high && x$1.$low > x$2.$low)))) {
|
|
break;
|
|
}
|
|
name = $subslice(rec, 19, $flatten64(new $Uint64(0 + namlen.$high, 19 + namlen.$low)));
|
|
_ref = name;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (c === 0) {
|
|
name = $subslice(name, 0, i);
|
|
break;
|
|
}
|
|
_i++;
|
|
}
|
|
if (($bytesToString(name)) === "." || ($bytesToString(name)) === "..") {
|
|
continue;
|
|
}
|
|
max = max - (1) >> 0;
|
|
count = count + (1) >> 0;
|
|
names = $append(names, ($bytesToString(name)));
|
|
}
|
|
_tmp$3 = origlen - buf.$length >> 0;
|
|
_tmp$4 = count;
|
|
_tmp$5 = names;
|
|
consumed = _tmp$3;
|
|
count = _tmp$4;
|
|
newnames = _tmp$5;
|
|
return [consumed, count, newnames];
|
|
};
|
|
$pkg.ParseDirent = ParseDirent;
|
|
CloseOnExec = function(fd) {
|
|
var fd;
|
|
fcntl(fd, 2, 1);
|
|
};
|
|
$pkg.CloseOnExec = CloseOnExec;
|
|
SetNonblock = function(fd, nonblocking) {
|
|
var _tuple, _tuple$1, err, fd, flag, nonblocking;
|
|
err = $ifaceNil;
|
|
_tuple = fcntl(fd, 3, 0);
|
|
flag = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
err = err;
|
|
return err;
|
|
}
|
|
if (nonblocking) {
|
|
flag = flag | (2048);
|
|
} else {
|
|
flag = (flag & ~(2048)) >> 0;
|
|
}
|
|
_tuple$1 = fcntl(fd, 4, flag);
|
|
err = _tuple$1[1];
|
|
err = err;
|
|
return err;
|
|
};
|
|
$pkg.SetNonblock = SetNonblock;
|
|
msanRead = function(addr, len) {
|
|
var addr, len;
|
|
};
|
|
msanWrite = function(addr, len) {
|
|
var addr, len;
|
|
};
|
|
nlmAlignOf = function(msglen) {
|
|
var msglen;
|
|
return (((msglen + 4 >> 0) - 1 >> 0)) & -4;
|
|
};
|
|
rtaAlignOf = function(attrlen) {
|
|
var attrlen;
|
|
return (((attrlen + 4 >> 0) - 1 >> 0)) & -4;
|
|
};
|
|
NetlinkRouteRequest.ptr.prototype.toWireFormat = function() {
|
|
var b, rr;
|
|
rr = this;
|
|
b = $makeSlice(sliceType, rr.Header.Len);
|
|
(($sliceToArray($subslice(b, 0, 4)))).$set(rr.Header.Len);
|
|
(($sliceToArray($subslice(b, 4, 6)))).$set(rr.Header.Type);
|
|
(($sliceToArray($subslice(b, 6, 8)))).$set(rr.Header.Flags);
|
|
(($sliceToArray($subslice(b, 8, 12)))).$set(rr.Header.Seq);
|
|
(($sliceToArray($subslice(b, 12, 16)))).$set(rr.Header.Pid);
|
|
(16 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 16] = (rr.Data.Family));
|
|
return b;
|
|
};
|
|
NetlinkRouteRequest.prototype.toWireFormat = function() { return this.$val.toWireFormat(); };
|
|
newNetlinkRouteRequest = function(proto, seq, family) {
|
|
var family, proto, rr, seq;
|
|
rr = new NetlinkRouteRequest.ptr(new NlMsghdr.ptr(0, 0, 0, 0, 0), new RtGenmsg.ptr(0));
|
|
rr.Header.Len = 17;
|
|
rr.Header.Type = ((proto << 16 >>> 16));
|
|
rr.Header.Flags = 769;
|
|
rr.Header.Seq = ((seq >>> 0));
|
|
rr.Data.Family = ((family << 24 >>> 24));
|
|
return rr.toWireFormat();
|
|
};
|
|
NetlinkRIB = function(proto, family) {
|
|
var _i, _r, _r$1, _ref, _ref$1, _tuple, _tuple$1, _tuple$2, _tuple$3, err, err$1, err$2, err$3, err$4, family, lsa, lsa$1, m, msgs, nr, proto, rb, rbNew, s, tab, v, v$1, wb, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; err$3 = $f.err$3; err$4 = $f.err$4; family = $f.family; lsa = $f.lsa; lsa$1 = $f.lsa$1; m = $f.m; msgs = $f.msgs; nr = $f.nr; proto = $f.proto; rb = $f.rb; rbNew = $f.rbNew; s = $f.s; tab = $f.tab; v = $f.v; v$1 = $f.v$1; wb = $f.wb; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
_tuple = Socket(16, 3, 0);
|
|
s = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err];
|
|
}
|
|
$deferred.push([Close, [s]]);
|
|
lsa = new SockaddrNetlink.ptr(16, 0, 0, 0, new RawSockaddrNetlink.ptr(0, 0, 0, 0));
|
|
_r = Bind(s, lsa); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err$1];
|
|
}
|
|
wb = newNetlinkRouteRequest(proto, 1, family);
|
|
_r$1 = Sendto(s, wb, 0, lsa); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err$2 = _r$1;
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err$2];
|
|
}
|
|
tab = sliceType.nil;
|
|
rbNew = $makeSlice(sliceType, Getpagesize());
|
|
done:
|
|
while (true) {
|
|
rb = rbNew;
|
|
_tuple$1 = Recvfrom(s, rb, 0);
|
|
nr = _tuple$1[0];
|
|
err$3 = _tuple$1[2];
|
|
if (!($interfaceIsEqual(err$3, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err$3];
|
|
}
|
|
if (nr < 16) {
|
|
$s = -1; return [sliceType.nil, new Errno(22)];
|
|
}
|
|
rb = $subslice(rb, 0, nr);
|
|
tab = $appendSlice(tab, rb);
|
|
_tuple$2 = ParseNetlinkMessage(rb);
|
|
msgs = _tuple$2[0];
|
|
err$3 = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err$3, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err$3];
|
|
}
|
|
_ref = msgs;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
m = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), NetlinkMessage);
|
|
_tuple$3 = Getsockname(s);
|
|
lsa$1 = _tuple$3[0];
|
|
err$4 = _tuple$3[1];
|
|
if (!($interfaceIsEqual(err$4, $ifaceNil))) {
|
|
$s = -1; return [sliceType.nil, err$4];
|
|
}
|
|
_ref$1 = lsa$1;
|
|
if ($assertType(_ref$1, ptrType$12, true)[1]) {
|
|
v = _ref$1.$val;
|
|
if (!((m.Header.Seq === 1)) || !((m.Header.Pid === v.Pid))) {
|
|
$s = -1; return [sliceType.nil, new Errno(22)];
|
|
}
|
|
} else {
|
|
v$1 = _ref$1;
|
|
$s = -1; return [sliceType.nil, new Errno(22)];
|
|
}
|
|
if (m.Header.Type === 3) {
|
|
break done;
|
|
}
|
|
if (m.Header.Type === 2) {
|
|
$s = -1; return [sliceType.nil, new Errno(22)];
|
|
}
|
|
_i++;
|
|
}
|
|
}
|
|
$s = -1; return [tab, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [sliceType.nil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: NetlinkRIB }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.err$3 = err$3; $f.err$4 = err$4; $f.family = family; $f.lsa = lsa; $f.lsa$1 = lsa$1; $f.m = m; $f.msgs = msgs; $f.nr = nr; $f.proto = proto; $f.rb = rb; $f.rbNew = rbNew; $f.s = s; $f.tab = tab; $f.v = v; $f.v$1 = v$1; $f.wb = wb; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
$pkg.NetlinkRIB = NetlinkRIB;
|
|
ParseNetlinkMessage = function(b) {
|
|
var _tuple, b, dbuf, dlen, err, h, m, msgs;
|
|
msgs = sliceType$6.nil;
|
|
while (true) {
|
|
if (!(b.$length >= 16)) { break; }
|
|
_tuple = netlinkMessageHeaderAndData(b);
|
|
h = _tuple[0];
|
|
dbuf = _tuple[1];
|
|
dlen = _tuple[2];
|
|
err = _tuple[3];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [sliceType$6.nil, err];
|
|
}
|
|
m = new NetlinkMessage.ptr($clone(h, NlMsghdr), $subslice(dbuf, 0, (((h.Len >> 0)) - 16 >> 0)));
|
|
msgs = $append(msgs, m);
|
|
b = $subslice(b, dlen);
|
|
}
|
|
return [msgs, $ifaceNil];
|
|
};
|
|
$pkg.ParseNetlinkMessage = ParseNetlinkMessage;
|
|
netlinkMessageHeaderAndData = function(b) {
|
|
var _array, _struct, _view, b, h, l;
|
|
h = ((_array = ($sliceToArray(b)), _struct = new NlMsghdr.ptr(0, 0, 0, 0, 0), _view = new DataView(_array.buffer, _array.byteOffset), _struct.Len = _view.getUint32(0, true), _struct.Type = _view.getUint16(4, true), _struct.Flags = _view.getUint16(6, true), _struct.Seq = _view.getUint32(8, true), _struct.Pid = _view.getUint32(12, true), _struct));
|
|
l = nlmAlignOf(((h.Len >> 0)));
|
|
if (((h.Len >> 0)) < 16 || l > b.$length) {
|
|
return [ptrType$13.nil, sliceType.nil, 0, new Errno(22)];
|
|
}
|
|
return [h, $subslice(b, 16), l, $ifaceNil];
|
|
};
|
|
ParseNetlinkRouteAttr = function(m) {
|
|
var _1, _tuple, a, alen, attrs, b, err, m, ra, vbuf;
|
|
b = sliceType.nil;
|
|
_1 = m.Header.Type;
|
|
if ((_1 === (16)) || (_1 === (17))) {
|
|
b = $subslice(m.Data, 16);
|
|
} else if ((_1 === (20)) || (_1 === (21))) {
|
|
b = $subslice(m.Data, 8);
|
|
} else if ((_1 === (24)) || (_1 === (25))) {
|
|
b = $subslice(m.Data, 12);
|
|
} else {
|
|
return [sliceType$7.nil, new Errno(22)];
|
|
}
|
|
attrs = sliceType$7.nil;
|
|
while (true) {
|
|
if (!(b.$length >= 4)) { break; }
|
|
_tuple = netlinkRouteAttrAndValue(b);
|
|
a = _tuple[0];
|
|
vbuf = _tuple[1];
|
|
alen = _tuple[2];
|
|
err = _tuple[3];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [sliceType$7.nil, err];
|
|
}
|
|
ra = new NetlinkRouteAttr.ptr($clone(a, RtAttr), $subslice(vbuf, 0, (((a.Len >> 0)) - 4 >> 0)));
|
|
attrs = $append(attrs, ra);
|
|
b = $subslice(b, alen);
|
|
}
|
|
return [attrs, $ifaceNil];
|
|
};
|
|
$pkg.ParseNetlinkRouteAttr = ParseNetlinkRouteAttr;
|
|
netlinkRouteAttrAndValue = function(b) {
|
|
var _array, _struct, _view, a, b;
|
|
a = ((_array = ($sliceToArray(b)), _struct = new RtAttr.ptr(0, 0), _view = new DataView(_array.buffer, _array.byteOffset), _struct.Len = _view.getUint16(0, true), _struct.Type = _view.getUint16(2, true), _struct));
|
|
if (((a.Len >> 0)) < 4 || ((a.Len >> 0)) > b.$length) {
|
|
return [ptrType$14.nil, sliceType.nil, 0, new Errno(22)];
|
|
}
|
|
return [a, $subslice(b, 4), rtaAlignOf(((a.Len >> 0))), $ifaceNil];
|
|
};
|
|
itoa = function(val) {
|
|
var val;
|
|
if (val < 0) {
|
|
return "-" + uitoa(((-val >>> 0)));
|
|
}
|
|
return uitoa(((val >>> 0)));
|
|
};
|
|
uitoa = function(val) {
|
|
var _q, _r, buf, i, val;
|
|
buf = arrayType$4.zero();
|
|
i = 31;
|
|
while (true) {
|
|
if (!(val >= 10)) { break; }
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = ((((_r = val % 10, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) + 48 >>> 0) << 24 >>> 24)));
|
|
i = i - (1) >> 0;
|
|
val = (_q = val / (10), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
}
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = (((val + 48 >>> 0) << 24 >>> 24)));
|
|
return ($bytesToString($subslice(new sliceType(buf), i)));
|
|
};
|
|
Timespec.ptr.prototype.Unix = function() {
|
|
var _tmp, _tmp$1, nsec, sec, ts;
|
|
sec = new $Int64(0, 0);
|
|
nsec = new $Int64(0, 0);
|
|
ts = this;
|
|
_tmp = (ts.Sec);
|
|
_tmp$1 = (ts.Nsec);
|
|
sec = _tmp;
|
|
nsec = _tmp$1;
|
|
return [sec, nsec];
|
|
};
|
|
Timespec.prototype.Unix = function() { return this.$val.Unix(); };
|
|
Timespec.ptr.prototype.Nano = function() {
|
|
var ts, x, x$1;
|
|
ts = this;
|
|
return (x = $mul64((ts.Sec), new $Int64(0, 1000000000)), x$1 = (ts.Nsec), new $Int64(x.$high + x$1.$high, x.$low + x$1.$low));
|
|
};
|
|
Timespec.prototype.Nano = function() { return this.$val.Nano(); };
|
|
Getpagesize = function() {
|
|
$throwRuntimeError("native function not implemented: syscall.Getpagesize");
|
|
};
|
|
$pkg.Getpagesize = Getpagesize;
|
|
Chmod = function(path, mode) {
|
|
var err, mode, path;
|
|
err = $ifaceNil;
|
|
err = Fchmodat(-100, path, mode, 0);
|
|
return err;
|
|
};
|
|
$pkg.Chmod = Chmod;
|
|
Fchmodat = function(dirfd, path, mode, flags) {
|
|
var dirfd, err, flags, mode, path;
|
|
err = $ifaceNil;
|
|
if (!((((flags & ~256) >> 0) === 0))) {
|
|
err = new Errno(22);
|
|
return err;
|
|
} else if (!(((flags & 256) === 0))) {
|
|
err = new Errno(95);
|
|
return err;
|
|
}
|
|
err = fchmodat(dirfd, path, mode);
|
|
return err;
|
|
};
|
|
$pkg.Fchmodat = Fchmodat;
|
|
Open = function(path, mode, perm) {
|
|
var _tuple, err, fd, mode, path, perm;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_tuple = openat(-100, path, mode | 0, perm);
|
|
fd = _tuple[0];
|
|
err = _tuple[1];
|
|
return [fd, err];
|
|
};
|
|
$pkg.Open = Open;
|
|
SockaddrInet4.ptr.prototype.sockaddr = function() {
|
|
var _array, _struct, _view, i, p, sa, x, x$1, x$2;
|
|
sa = this;
|
|
if (sa.Port < 0 || sa.Port > 65535) {
|
|
return [0, 0, new Errno(22)];
|
|
}
|
|
sa.raw.Family = 2;
|
|
p = (((x = sa.raw, (x.$ptr_Port || (x.$ptr_Port = new ptrType$9(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, x))))));
|
|
p.nilCheck, p[0] = (((sa.Port >> 8 >> 0) << 24 >>> 24));
|
|
p.nilCheck, p[1] = ((sa.Port << 24 >>> 24));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 4)) { break; }
|
|
(x$2 = sa.raw.Addr, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i] = (x$1 = sa.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i]))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
_array = new Uint8Array(16);
|
|
return [(_array), 16, $ifaceNil];
|
|
};
|
|
SockaddrInet4.prototype.sockaddr = function() { return this.$val.sockaddr(); };
|
|
SockaddrInet6.ptr.prototype.sockaddr = function() {
|
|
var _array, _struct, _view, i, p, sa, x, x$1, x$2;
|
|
sa = this;
|
|
if (sa.Port < 0 || sa.Port > 65535) {
|
|
return [0, 0, new Errno(22)];
|
|
}
|
|
sa.raw.Family = 10;
|
|
p = (((x = sa.raw, (x.$ptr_Port || (x.$ptr_Port = new ptrType$9(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, x))))));
|
|
p.nilCheck, p[0] = (((sa.Port >> 8 >> 0) << 24 >>> 24));
|
|
p.nilCheck, p[1] = ((sa.Port << 24 >>> 24));
|
|
sa.raw.Scope_id = sa.ZoneId;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 16)) { break; }
|
|
(x$2 = sa.raw.Addr, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i] = (x$1 = sa.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i]))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
_array = new Uint8Array(28);
|
|
return [(_array), 28, $ifaceNil];
|
|
};
|
|
SockaddrInet6.prototype.sockaddr = function() { return this.$val.sockaddr(); };
|
|
SockaddrUnix.ptr.prototype.sockaddr = function() {
|
|
var _array, _struct, _view, i, n, name, sa, sl, x;
|
|
sa = this;
|
|
name = sa.Name;
|
|
n = name.length;
|
|
if (n > 108) {
|
|
return [0, 0, new Errno(22)];
|
|
}
|
|
if ((n === 108) && !((name.charCodeAt(0) === 64))) {
|
|
return [0, 0, new Errno(22)];
|
|
}
|
|
sa.raw.Family = 1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < n)) { break; }
|
|
(x = sa.raw.Path, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i] = ((name.charCodeAt(i) << 24 >> 24))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
sl = 2;
|
|
if (n > 0) {
|
|
sl = sl + ((((n >>> 0)) + 1 >>> 0)) >>> 0;
|
|
}
|
|
if (sa.raw.Path[0] === 64) {
|
|
sa.raw.Path[0] = 0;
|
|
sl = sl - (1) >>> 0;
|
|
}
|
|
_array = new Uint8Array(110);
|
|
return [(_array), sl, $ifaceNil];
|
|
};
|
|
SockaddrUnix.prototype.sockaddr = function() { return this.$val.sockaddr(); };
|
|
SockaddrLinklayer.ptr.prototype.sockaddr = function() {
|
|
var _array, _struct, _view, i, sa, x, x$1;
|
|
sa = this;
|
|
if (sa.Ifindex < 0 || sa.Ifindex > 2147483647) {
|
|
return [0, 0, new Errno(22)];
|
|
}
|
|
sa.raw.Family = 17;
|
|
sa.raw.Protocol = sa.Protocol;
|
|
sa.raw.Ifindex = ((sa.Ifindex >> 0));
|
|
sa.raw.Hatype = sa.Hatype;
|
|
sa.raw.Pkttype = sa.Pkttype;
|
|
sa.raw.Halen = sa.Halen;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 8)) { break; }
|
|
(x$1 = sa.raw.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i] = (x = sa.Addr, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i]))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
_array = new Uint8Array(20);
|
|
return [(_array), 20, $ifaceNil];
|
|
};
|
|
SockaddrLinklayer.prototype.sockaddr = function() { return this.$val.sockaddr(); };
|
|
SockaddrNetlink.ptr.prototype.sockaddr = function() {
|
|
var _array, _struct, _view, sa;
|
|
sa = this;
|
|
sa.raw.Family = 16;
|
|
sa.raw.Pad = sa.Pad;
|
|
sa.raw.Pid = sa.Pid;
|
|
sa.raw.Groups = sa.Groups;
|
|
_array = new Uint8Array(12);
|
|
return [(_array), 12, $ifaceNil];
|
|
};
|
|
SockaddrNetlink.prototype.sockaddr = function() { return this.$val.sockaddr(); };
|
|
anyToSockaddr = function(rsa) {
|
|
var _1, _array, _array$1, _array$2, _array$3, _array$4, _array$5, _array$6, _array$7, _array$8, _array$9, _struct, _struct$1, _struct$2, _struct$3, _struct$4, _struct$5, _struct$6, _struct$7, _struct$8, _struct$9, _view, _view$1, _view$2, _view$3, _view$4, _view$5, _view$6, _view$7, _view$8, _view$9, bytes, i, i$1, i$2, n, p, p$1, pp, pp$1, pp$2, pp$3, pp$4, rsa, sa, sa$1, sa$2, sa$3, sa$4, x, x$1, x$2, x$3, x$4, x$5, x$6;
|
|
_1 = rsa.Addr.Family;
|
|
if (_1 === (16)) {
|
|
_array$1 = new Uint8Array(112);
|
|
pp = ((_array = (_array$1), _struct = new RawSockaddrNetlink.ptr(0, 0, 0, 0), _view = new DataView(_array.buffer, _array.byteOffset), _struct.Family = _view.getUint16(0, true), _struct.Pad = _view.getUint16(2, true), _struct.Pid = _view.getUint32(4, true), _struct.Groups = _view.getUint32(8, true), _struct));
|
|
_struct$1 = rsa, _view$1 = new DataView(_array$1.buffer, _array$1.byteOffset), _struct$1.Addr.Family = _view$1.getUint16(0, true), _struct$1.Addr.Data = new ($nativeArray($kindInt8))(_array$1.buffer, $min(_array$1.byteOffset + 2, _array$1.buffer.byteLength)), _struct$1.Pad = new ($nativeArray($kindInt8))(_array$1.buffer, $min(_array$1.byteOffset + 16, _array$1.buffer.byteLength));
|
|
sa = new SockaddrNetlink.ptr(0, 0, 0, 0, new RawSockaddrNetlink.ptr(0, 0, 0, 0));
|
|
sa.Family = pp.Family;
|
|
sa.Pad = pp.Pad;
|
|
sa.Pid = pp.Pid;
|
|
sa.Groups = pp.Groups;
|
|
return [sa, $ifaceNil];
|
|
} else if (_1 === (17)) {
|
|
_array$3 = new Uint8Array(112);
|
|
pp$1 = ((_array$2 = (_array$3), _struct$2 = new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero()), _view$2 = new DataView(_array$2.buffer, _array$2.byteOffset), _struct$2.Family = _view$2.getUint16(0, true), _struct$2.Protocol = _view$2.getUint16(2, true), _struct$2.Ifindex = _view$2.getInt32(4, true), _struct$2.Hatype = _view$2.getUint16(8, true), _struct$2.Pkttype = _view$2.getUint8(10, true), _struct$2.Halen = _view$2.getUint8(11, true), _struct$2.Addr = new ($nativeArray($kindUint8))(_array$2.buffer, $min(_array$2.byteOffset + 12, _array$2.buffer.byteLength)), _struct$2));
|
|
_struct$3 = rsa, _view$3 = new DataView(_array$3.buffer, _array$3.byteOffset), _struct$3.Addr.Family = _view$3.getUint16(0, true), _struct$3.Addr.Data = new ($nativeArray($kindInt8))(_array$3.buffer, $min(_array$3.byteOffset + 2, _array$3.buffer.byteLength)), _struct$3.Pad = new ($nativeArray($kindInt8))(_array$3.buffer, $min(_array$3.byteOffset + 16, _array$3.buffer.byteLength));
|
|
sa$1 = new SockaddrLinklayer.ptr(0, 0, 0, 0, 0, arrayType$1.zero(), new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero()));
|
|
sa$1.Protocol = pp$1.Protocol;
|
|
sa$1.Ifindex = ((pp$1.Ifindex >> 0));
|
|
sa$1.Hatype = pp$1.Hatype;
|
|
sa$1.Pkttype = pp$1.Pkttype;
|
|
sa$1.Halen = pp$1.Halen;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 8)) { break; }
|
|
(x$1 = sa$1.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i] = (x = pp$1.Addr, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i]))));
|
|
i = i + (1) >> 0;
|
|
}
|
|
return [sa$1, $ifaceNil];
|
|
} else if (_1 === (1)) {
|
|
_array$5 = new Uint8Array(112);
|
|
pp$2 = ((_array$4 = (_array$5), _struct$4 = new RawSockaddrUnix.ptr(0, arrayType$8.zero()), _view$4 = new DataView(_array$4.buffer, _array$4.byteOffset), _struct$4.Family = _view$4.getUint16(0, true), _struct$4.Path = new ($nativeArray($kindInt8))(_array$4.buffer, $min(_array$4.byteOffset + 2, _array$4.buffer.byteLength)), _struct$4));
|
|
_struct$5 = rsa, _view$5 = new DataView(_array$5.buffer, _array$5.byteOffset), _struct$5.Addr.Family = _view$5.getUint16(0, true), _struct$5.Addr.Data = new ($nativeArray($kindInt8))(_array$5.buffer, $min(_array$5.byteOffset + 2, _array$5.buffer.byteLength)), _struct$5.Pad = new ($nativeArray($kindInt8))(_array$5.buffer, $min(_array$5.byteOffset + 16, _array$5.buffer.byteLength));
|
|
sa$2 = new SockaddrUnix.ptr("", new RawSockaddrUnix.ptr(0, arrayType$8.zero()));
|
|
if (pp$2.Path[0] === 0) {
|
|
pp$2.Path[0] = 64;
|
|
}
|
|
n = 0;
|
|
while (true) {
|
|
if (!(n < 108 && !(((x$2 = pp$2.Path, ((n < 0 || n >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[n])) === 0)))) { break; }
|
|
n = n + (1) >> 0;
|
|
}
|
|
bytes = $subslice(new sliceType((($sliceToArray(new sliceType(pp$2.Path))))), 0, n);
|
|
sa$2.Name = ($bytesToString(bytes));
|
|
return [sa$2, $ifaceNil];
|
|
} else if (_1 === (2)) {
|
|
_array$7 = new Uint8Array(112);
|
|
pp$3 = ((_array$6 = (_array$7), _struct$6 = new RawSockaddrInet4.ptr(0, 0, arrayType$9.zero(), arrayType$1.zero()), _view$6 = new DataView(_array$6.buffer, _array$6.byteOffset), _struct$6.Family = _view$6.getUint16(0, true), _struct$6.Port = _view$6.getUint16(2, true), _struct$6.Addr = new ($nativeArray($kindUint8))(_array$6.buffer, $min(_array$6.byteOffset + 4, _array$6.buffer.byteLength)), _struct$6.Zero = new ($nativeArray($kindUint8))(_array$6.buffer, $min(_array$6.byteOffset + 8, _array$6.buffer.byteLength)), _struct$6));
|
|
_struct$7 = rsa, _view$7 = new DataView(_array$7.buffer, _array$7.byteOffset), _struct$7.Addr.Family = _view$7.getUint16(0, true), _struct$7.Addr.Data = new ($nativeArray($kindInt8))(_array$7.buffer, $min(_array$7.byteOffset + 2, _array$7.buffer.byteLength)), _struct$7.Pad = new ($nativeArray($kindInt8))(_array$7.buffer, $min(_array$7.byteOffset + 16, _array$7.buffer.byteLength));
|
|
sa$3 = new SockaddrInet4.ptr(0, arrayType$9.zero(), new RawSockaddrInet4.ptr(0, 0, arrayType$9.zero(), arrayType$1.zero()));
|
|
p = (((pp$3.$ptr_Port || (pp$3.$ptr_Port = new ptrType$9(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, pp$3)))));
|
|
sa$3.Port = ((((p.nilCheck, p[0]) >> 0)) << 8 >> 0) + (((p.nilCheck, p[1]) >> 0)) >> 0;
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < 4)) { break; }
|
|
(x$4 = sa$3.Addr, ((i$1 < 0 || i$1 >= x$4.length) ? ($throwRuntimeError("index out of range"), undefined) : x$4[i$1] = (x$3 = pp$3.Addr, ((i$1 < 0 || i$1 >= x$3.length) ? ($throwRuntimeError("index out of range"), undefined) : x$3[i$1]))));
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
return [sa$3, $ifaceNil];
|
|
} else if (_1 === (10)) {
|
|
_array$9 = new Uint8Array(112);
|
|
pp$4 = ((_array$8 = (_array$9), _struct$8 = new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0), _view$8 = new DataView(_array$8.buffer, _array$8.byteOffset), _struct$8.Family = _view$8.getUint16(0, true), _struct$8.Port = _view$8.getUint16(2, true), _struct$8.Flowinfo = _view$8.getUint32(4, true), _struct$8.Addr = new ($nativeArray($kindUint8))(_array$8.buffer, $min(_array$8.byteOffset + 8, _array$8.buffer.byteLength)), _struct$8.Scope_id = _view$8.getUint32(24, true), _struct$8));
|
|
_struct$9 = rsa, _view$9 = new DataView(_array$9.buffer, _array$9.byteOffset), _struct$9.Addr.Family = _view$9.getUint16(0, true), _struct$9.Addr.Data = new ($nativeArray($kindInt8))(_array$9.buffer, $min(_array$9.byteOffset + 2, _array$9.buffer.byteLength)), _struct$9.Pad = new ($nativeArray($kindInt8))(_array$9.buffer, $min(_array$9.byteOffset + 16, _array$9.buffer.byteLength));
|
|
sa$4 = new SockaddrInet6.ptr(0, 0, arrayType$2.zero(), new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0));
|
|
p$1 = (((pp$4.$ptr_Port || (pp$4.$ptr_Port = new ptrType$9(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, pp$4)))));
|
|
sa$4.Port = ((((p$1.nilCheck, p$1[0]) >> 0)) << 8 >> 0) + (((p$1.nilCheck, p$1[1]) >> 0)) >> 0;
|
|
sa$4.ZoneId = pp$4.Scope_id;
|
|
i$2 = 0;
|
|
while (true) {
|
|
if (!(i$2 < 16)) { break; }
|
|
(x$6 = sa$4.Addr, ((i$2 < 0 || i$2 >= x$6.length) ? ($throwRuntimeError("index out of range"), undefined) : x$6[i$2] = (x$5 = pp$4.Addr, ((i$2 < 0 || i$2 >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i$2]))));
|
|
i$2 = i$2 + (1) >> 0;
|
|
}
|
|
return [sa$4, $ifaceNil];
|
|
}
|
|
return [$ifaceNil, new Errno(97)];
|
|
};
|
|
Accept = function(fd) {
|
|
var _tuple, _tuple$1, err, fd, len, len$24ptr, nfd, rsa, sa;
|
|
nfd = 0;
|
|
sa = $ifaceNil;
|
|
err = $ifaceNil;
|
|
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$10.zero()), arrayType$11.zero());
|
|
len = 112;
|
|
_tuple = accept(fd, rsa, (len$24ptr || (len$24ptr = new ptrType$19(function() { return len; }, function($v) { len = $v; }))));
|
|
nfd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [nfd, sa, err];
|
|
}
|
|
_tuple$1 = anyToSockaddr(rsa);
|
|
sa = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
Close(nfd);
|
|
nfd = 0;
|
|
}
|
|
return [nfd, sa, err];
|
|
};
|
|
$pkg.Accept = Accept;
|
|
Accept4 = function(fd, flags) {
|
|
var _tuple, _tuple$1, err, fd, flags, len, len$24ptr, nfd, rsa, sa;
|
|
nfd = 0;
|
|
sa = $ifaceNil;
|
|
err = $ifaceNil;
|
|
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$10.zero()), arrayType$11.zero());
|
|
len = 112;
|
|
_tuple = accept4(fd, rsa, (len$24ptr || (len$24ptr = new ptrType$19(function() { return len; }, function($v) { len = $v; }))), flags);
|
|
nfd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [nfd, sa, err];
|
|
}
|
|
if (len > 112) {
|
|
$panic(new $String("RawSockaddrAny too small"));
|
|
}
|
|
_tuple$1 = anyToSockaddr(rsa);
|
|
sa = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
Close(nfd);
|
|
nfd = 0;
|
|
}
|
|
return [nfd, sa, err];
|
|
};
|
|
$pkg.Accept4 = Accept4;
|
|
Getsockname = function(fd) {
|
|
var _tuple, err, fd, len, len$24ptr, rsa, sa;
|
|
sa = $ifaceNil;
|
|
err = $ifaceNil;
|
|
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$10.zero()), arrayType$11.zero());
|
|
len = 112;
|
|
err = getsockname(fd, rsa, (len$24ptr || (len$24ptr = new ptrType$19(function() { return len; }, function($v) { len = $v; }))));
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [sa, err];
|
|
}
|
|
_tuple = anyToSockaddr(rsa);
|
|
sa = _tuple[0];
|
|
err = _tuple[1];
|
|
return [sa, err];
|
|
};
|
|
$pkg.Getsockname = Getsockname;
|
|
SetsockoptIPMreqn = function(fd, level, opt, mreq) {
|
|
var _array, _struct, _view, err, fd, level, mreq, opt;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(12);
|
|
err = setsockopt(fd, level, opt, (_array), 12);
|
|
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Address = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 4, _array.buffer.byteLength)), _struct.Ifindex = _view.getInt32(8, true);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptIPMreqn = SetsockoptIPMreqn;
|
|
Recvmsg = function(fd, p, oob, flags) {
|
|
var _array, _struct, _tuple, _tuple$1, _tuple$2, _view, dummy, dummy$24ptr, err, fd, flags, from, iov, msg, n, oob, oobn, p, recvflags, rsa, sockType;
|
|
n = 0;
|
|
oobn = 0;
|
|
recvflags = 0;
|
|
from = $ifaceNil;
|
|
err = $ifaceNil;
|
|
msg = new Msghdr.ptr(ptrType$2.nil, 0, arrayType$9.zero(), ptrType$20.nil, new $Uint64(0, 0), ptrType$2.nil, new $Uint64(0, 0), 0, arrayType$9.zero());
|
|
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$10.zero()), arrayType$11.zero());
|
|
_array = new Uint8Array(112);
|
|
msg.Name = ((_array));
|
|
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
|
|
msg.Namelen = 112;
|
|
iov = new Iovec.ptr(ptrType$2.nil, new $Uint64(0, 0));
|
|
if (p.$length > 0) {
|
|
iov.Base = $indexPtr(p.$array, p.$offset + 0, ptrType$2);
|
|
iov.SetLen(p.$length);
|
|
}
|
|
dummy = 0;
|
|
if (oob.$length > 0) {
|
|
if (p.$length === 0) {
|
|
sockType = 0;
|
|
_tuple = GetsockoptInt(fd, 1, 3);
|
|
sockType = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [n, oobn, recvflags, from, err];
|
|
}
|
|
if (!((sockType === 2))) {
|
|
iov.Base = (dummy$24ptr || (dummy$24ptr = new ptrType$2(function() { return dummy; }, function($v) { dummy = $v; })));
|
|
iov.SetLen(1);
|
|
}
|
|
}
|
|
msg.Control = $indexPtr(oob.$array, oob.$offset + 0, ptrType$2);
|
|
msg.SetControllen(oob.$length);
|
|
}
|
|
msg.Iov = iov;
|
|
msg.Iovlen = new $Uint64(0, 1);
|
|
_tuple$1 = recvmsg(fd, msg, flags);
|
|
n = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [n, oobn, recvflags, from, err];
|
|
}
|
|
oobn = ((msg.Controllen.$low >> 0));
|
|
recvflags = ((msg.Flags >> 0));
|
|
if (!((rsa.Addr.Family === 0))) {
|
|
_tuple$2 = anyToSockaddr(rsa);
|
|
from = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
}
|
|
return [n, oobn, recvflags, from, err];
|
|
};
|
|
$pkg.Recvmsg = Recvmsg;
|
|
SendmsgN = function(fd, p, oob, to, flags) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, _tuple$1, _tuple$2, dummy, err, err$1, fd, flags, iov, msg, n, oob, p, ptr, salen, sockType, to, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; dummy = $f.dummy; err = $f.err; err$1 = $f.err$1; fd = $f.fd; flags = $f.flags; iov = $f.iov; msg = $f.msg; n = $f.n; oob = $f.oob; p = $f.p; ptr = $f.ptr; salen = $f.salen; sockType = $f.sockType; to = $f.to; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
dummy = [dummy];
|
|
iov = [iov];
|
|
msg = [msg];
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
ptr = 0;
|
|
salen = 0;
|
|
/* */ if (!($interfaceIsEqual(to, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(to, $ifaceNil))) { */ case 1:
|
|
err$1 = $ifaceNil;
|
|
_r = to.sockaddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
ptr = _tuple[0];
|
|
salen = _tuple[1];
|
|
err$1 = _tuple[2];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err$1;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ case 2:
|
|
msg[0] = new Msghdr.ptr(ptrType$2.nil, 0, arrayType$9.zero(), ptrType$20.nil, new $Uint64(0, 0), ptrType$2.nil, new $Uint64(0, 0), 0, arrayType$9.zero());
|
|
msg[0].Name = (ptr);
|
|
msg[0].Namelen = ((salen >>> 0));
|
|
iov[0] = new Iovec.ptr(ptrType$2.nil, new $Uint64(0, 0));
|
|
if (p.$length > 0) {
|
|
iov[0].Base = $indexPtr(p.$array, p.$offset + 0, ptrType$2);
|
|
iov[0].SetLen(p.$length);
|
|
}
|
|
dummy[0] = 0;
|
|
if (oob.$length > 0) {
|
|
if (p.$length === 0) {
|
|
sockType = 0;
|
|
_tuple$1 = GetsockoptInt(fd, 1, 3);
|
|
sockType = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = err;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
if (!((sockType === 2))) {
|
|
iov[0].Base = (dummy.$ptr || (dummy.$ptr = new ptrType$2(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, dummy)));
|
|
iov[0].SetLen(1);
|
|
}
|
|
}
|
|
msg[0].Control = $indexPtr(oob.$array, oob.$offset + 0, ptrType$2);
|
|
msg[0].SetControllen(oob.$length);
|
|
}
|
|
msg[0].Iov = iov[0];
|
|
msg[0].Iovlen = new $Uint64(0, 1);
|
|
_tuple$2 = sendmsg(fd, msg[0], flags);
|
|
n = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$4 = 0;
|
|
_tmp$5 = err;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
}
|
|
if (oob.$length > 0 && (p.$length === 0)) {
|
|
n = 0;
|
|
}
|
|
_tmp$6 = n;
|
|
_tmp$7 = $ifaceNil;
|
|
n = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: SendmsgN }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.dummy = dummy; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.flags = flags; $f.iov = iov; $f.msg = msg; $f.n = n; $f.oob = oob; $f.p = p; $f.ptr = ptr; $f.salen = salen; $f.sockType = sockType; $f.to = to; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.SendmsgN = SendmsgN;
|
|
ReadDirent = function(fd, buf) {
|
|
var _tuple, buf, err, fd, n;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_tuple = Getdents(fd, buf);
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
return [n, err];
|
|
};
|
|
$pkg.ReadDirent = ReadDirent;
|
|
direntIno = function(buf) {
|
|
var buf;
|
|
return readInt(buf, 0, 8);
|
|
};
|
|
direntReclen = function(buf) {
|
|
var buf;
|
|
return readInt(buf, 16, 2);
|
|
};
|
|
direntNamlen = function(buf) {
|
|
var _tuple, buf, ok, reclen;
|
|
_tuple = direntReclen(buf);
|
|
reclen = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!ok) {
|
|
return [new $Uint64(0, 0), false];
|
|
}
|
|
return [new $Uint64(reclen.$high - 0, reclen.$low - 19), true];
|
|
};
|
|
Stat = function(path, stat) {
|
|
var err, path, stat;
|
|
err = $ifaceNil;
|
|
err = fstatat(-100, path, stat, 0);
|
|
return err;
|
|
};
|
|
$pkg.Stat = Stat;
|
|
Lstat = function(path, stat) {
|
|
var err, path, stat;
|
|
err = $ifaceNil;
|
|
err = fstatat(-100, path, stat, 256);
|
|
return err;
|
|
};
|
|
$pkg.Lstat = Lstat;
|
|
Iovec.ptr.prototype.SetLen = function(length) {
|
|
var iov, length;
|
|
iov = this;
|
|
iov.Len = (new $Uint64(0, length));
|
|
};
|
|
Iovec.prototype.SetLen = function(length) { return this.$val.SetLen(length); };
|
|
Msghdr.ptr.prototype.SetControllen = function(length) {
|
|
var length, msghdr;
|
|
msghdr = this;
|
|
msghdr.Controllen = (new $Uint64(0, length));
|
|
};
|
|
Msghdr.prototype.SetControllen = function(length) { return this.$val.SetControllen(length); };
|
|
mmapper.ptr.prototype.Mmap = function(fd, offset, length, prot, flags) {
|
|
var _key, _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, addr, b, data, err, errno, fd, flags, length, m, offset, p, prot, sl, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _key = $f._key; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; addr = $f.addr; b = $f.b; data = $f.data; err = $f.err; errno = $f.errno; fd = $f.fd; flags = $f.flags; length = $f.length; m = $f.m; offset = $f.offset; p = $f.p; prot = $f.prot; sl = $f.sl; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
sl = [sl];
|
|
data = sliceType.nil;
|
|
err = $ifaceNil;
|
|
m = this;
|
|
if (length <= 0) {
|
|
_tmp = sliceType.nil;
|
|
_tmp$1 = new Errno(22);
|
|
data = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [data, err];
|
|
}
|
|
_r = m.mmap(0, ((length >>> 0)), prot, flags, fd, offset); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
addr = _tuple[0];
|
|
errno = _tuple[1];
|
|
if (!($interfaceIsEqual(errno, $ifaceNil))) {
|
|
_tmp$2 = sliceType.nil;
|
|
_tmp$3 = errno;
|
|
data = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [data, err];
|
|
}
|
|
sl[0] = new structType.ptr(addr, length, length);
|
|
b = sl[0];
|
|
p = $indexPtr(b.$array, b.$offset + (b.$capacity - 1 >> 0), ptrType$2);
|
|
$r = m.Mutex.Lock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(m.Mutex, "Unlock"), []]);
|
|
_key = p; (m.active || $throwRuntimeError("assignment to entry in nil map"))[ptrType$2.keyFor(_key)] = { k: _key, v: b };
|
|
_tmp$4 = b;
|
|
_tmp$5 = $ifaceNil;
|
|
data = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [data, err];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [data, err]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: mmapper.ptr.prototype.Mmap }; } $f._key = _key; $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.addr = addr; $f.b = b; $f.data = data; $f.err = err; $f.errno = errno; $f.fd = fd; $f.flags = flags; $f.length = length; $f.m = m; $f.offset = offset; $f.p = p; $f.prot = prot; $f.sl = sl; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
mmapper.prototype.Mmap = function(fd, offset, length, prot, flags) { return this.$val.Mmap(fd, offset, length, prot, flags); };
|
|
mmapper.ptr.prototype.Munmap = function(data) {
|
|
var _entry, _r, b, data, err, errno, m, p, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _r = $f._r; b = $f.b; data = $f.data; err = $f.err; errno = $f.errno; m = $f.m; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
err = $ifaceNil;
|
|
m = this;
|
|
if ((data.$length === 0) || !((data.$length === data.$capacity))) {
|
|
err = new Errno(22);
|
|
$s = -1; return err;
|
|
}
|
|
p = $indexPtr(data.$array, data.$offset + (data.$capacity - 1 >> 0), ptrType$2);
|
|
$r = m.Mutex.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(m.Mutex, "Unlock"), []]);
|
|
b = (_entry = m.active[ptrType$2.keyFor(p)], _entry !== undefined ? _entry.v : sliceType.nil);
|
|
if (b === sliceType.nil || !($indexPtr(b.$array, b.$offset + 0, ptrType$2) === $indexPtr(data.$array, data.$offset + 0, ptrType$2))) {
|
|
err = new Errno(22);
|
|
$s = -1; return err;
|
|
}
|
|
_r = m.munmap((($sliceToArray(b))), ((b.$length >>> 0))); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
errno = _r;
|
|
if (!($interfaceIsEqual(errno, $ifaceNil))) {
|
|
err = errno;
|
|
$s = -1; return err;
|
|
}
|
|
delete m.active[ptrType$2.keyFor(p)];
|
|
err = $ifaceNil;
|
|
$s = -1; return err;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return err; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: mmapper.ptr.prototype.Munmap }; } $f._entry = _entry; $f._r = _r; $f.b = b; $f.data = data; $f.err = err; $f.errno = errno; $f.m = m; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
mmapper.prototype.Munmap = function(data) { return this.$val.Munmap(data); };
|
|
Errno.prototype.Error = function() {
|
|
var e, s;
|
|
e = this.$val;
|
|
if (0 <= ((e >> 0)) && ((e >> 0)) < 133) {
|
|
s = ((e < 0 || e >= errors.length) ? ($throwRuntimeError("index out of range"), undefined) : errors[e]);
|
|
if (!(s === "")) {
|
|
return s;
|
|
}
|
|
}
|
|
return "errno " + itoa(((e >> 0)));
|
|
};
|
|
$ptrType(Errno).prototype.Error = function() { return new Errno(this.$get()).Error(); };
|
|
Errno.prototype.Temporary = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return (e === 4) || (e === 24) || new Errno(e).Timeout();
|
|
};
|
|
$ptrType(Errno).prototype.Temporary = function() { return new Errno(this.$get()).Temporary(); };
|
|
Errno.prototype.Timeout = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return (e === 11) || (e === 11) || (e === 110);
|
|
};
|
|
$ptrType(Errno).prototype.Timeout = function() { return new Errno(this.$get()).Timeout(); };
|
|
errnoErr = function(e) {
|
|
var _1, e;
|
|
_1 = e;
|
|
if (_1 === (0)) {
|
|
return $ifaceNil;
|
|
} else if (_1 === (11)) {
|
|
return errEAGAIN;
|
|
} else if (_1 === (22)) {
|
|
return errEINVAL;
|
|
} else if (_1 === (2)) {
|
|
return errENOENT;
|
|
}
|
|
return new Errno(e);
|
|
};
|
|
Read = function(fd, p) {
|
|
var _tuple, err, fd, n, p;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_tuple = read(fd, p);
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if (false) {
|
|
if (n > 0) {
|
|
race.WriteRange(($sliceToArray(p)), n);
|
|
}
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
race.Acquire(((ioSync$24ptr || (ioSync$24ptr = new ptrType$23(function() { return ioSync; }, function($v) { ioSync = $v; })))));
|
|
}
|
|
}
|
|
if (false && n > 0) {
|
|
msanWrite(($sliceToArray(p)), n);
|
|
}
|
|
return [n, err];
|
|
};
|
|
$pkg.Read = Read;
|
|
Write = function(fd, p) {
|
|
var _tuple, err, fd, n, p;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
if (false) {
|
|
race.ReleaseMerge(((ioSync$24ptr || (ioSync$24ptr = new ptrType$23(function() { return ioSync; }, function($v) { ioSync = $v; })))));
|
|
}
|
|
_tuple = write(fd, p);
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if (false && n > 0) {
|
|
race.ReadRange(($sliceToArray(p)), n);
|
|
}
|
|
if (false && n > 0) {
|
|
msanRead(($sliceToArray(p)), n);
|
|
}
|
|
return [n, err];
|
|
};
|
|
$pkg.Write = Write;
|
|
Bind = function(fd, sa) {
|
|
var _r, _tuple, err, fd, n, ptr, sa, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; fd = $f.fd; n = $f.n; ptr = $f.ptr; sa = $f.sa; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
err = $ifaceNil;
|
|
_r = sa.sockaddr(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
ptr = _tuple[0];
|
|
n = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
err = err;
|
|
$s = -1; return err;
|
|
}
|
|
err = bind(fd, ptr, n);
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Bind }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.fd = fd; $f.n = n; $f.ptr = ptr; $f.sa = sa; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Bind = Bind;
|
|
GetsockoptInt = function(fd, level, opt) {
|
|
var _tmp, _tmp$1, err, fd, level, n, n$24ptr, opt, vallen, vallen$24ptr, value;
|
|
value = 0;
|
|
err = $ifaceNil;
|
|
n = 0;
|
|
vallen = 4;
|
|
err = getsockopt(fd, level, opt, ((n$24ptr || (n$24ptr = new ptrType$4(function() { return n; }, function($v) { n = $v; })))), (vallen$24ptr || (vallen$24ptr = new ptrType$19(function() { return vallen; }, function($v) { vallen = $v; }))));
|
|
_tmp = ((n >> 0));
|
|
_tmp$1 = err;
|
|
value = _tmp;
|
|
err = _tmp$1;
|
|
return [value, err];
|
|
};
|
|
$pkg.GetsockoptInt = GetsockoptInt;
|
|
Recvfrom = function(fd, p, flags) {
|
|
var _tuple, _tuple$1, err, fd, flags, from, len, len$24ptr, n, p, rsa;
|
|
n = 0;
|
|
from = $ifaceNil;
|
|
err = $ifaceNil;
|
|
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$10.zero()), arrayType$11.zero());
|
|
len = 112;
|
|
_tuple = recvfrom(fd, p, flags, rsa, (len$24ptr || (len$24ptr = new ptrType$19(function() { return len; }, function($v) { len = $v; }))));
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [n, from, err];
|
|
}
|
|
if (!((rsa.Addr.Family === 0))) {
|
|
_tuple$1 = anyToSockaddr(rsa);
|
|
from = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
}
|
|
return [n, from, err];
|
|
};
|
|
$pkg.Recvfrom = Recvfrom;
|
|
Sendto = function(fd, p, flags, to) {
|
|
var _r, _tuple, err, fd, flags, n, p, ptr, to, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; fd = $f.fd; flags = $f.flags; n = $f.n; p = $f.p; ptr = $f.ptr; to = $f.to; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
err = $ifaceNil;
|
|
_r = to.sockaddr(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
ptr = _tuple[0];
|
|
n = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
err = err;
|
|
$s = -1; return err;
|
|
}
|
|
err = sendto(fd, p, flags, ptr, n);
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sendto }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.fd = fd; $f.flags = flags; $f.n = n; $f.p = p; $f.ptr = ptr; $f.to = to; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sendto = Sendto;
|
|
SetsockoptByte = function(fd, level, opt, value) {
|
|
var err, fd, level, opt, value, value$24ptr;
|
|
err = $ifaceNil;
|
|
err = setsockopt(fd, level, opt, ((value$24ptr || (value$24ptr = new ptrType$2(function() { return value; }, function($v) { value = $v; })))), 1);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptByte = SetsockoptByte;
|
|
SetsockoptInt = function(fd, level, opt, value) {
|
|
var err, fd, level, n, n$24ptr, opt, value;
|
|
err = $ifaceNil;
|
|
n = ((value >> 0));
|
|
err = setsockopt(fd, level, opt, ((n$24ptr || (n$24ptr = new ptrType$4(function() { return n; }, function($v) { n = $v; })))), 4);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptInt = SetsockoptInt;
|
|
SetsockoptInet4Addr = function(fd, level, opt, value) {
|
|
var err, fd, level, opt, value;
|
|
err = $ifaceNil;
|
|
err = setsockopt(fd, level, opt, ($sliceToArray(new sliceType(value))), 4);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptInet4Addr = SetsockoptInet4Addr;
|
|
SetsockoptIPMreq = function(fd, level, opt, mreq) {
|
|
var _array, _struct, _view, err, fd, level, mreq, opt;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(8);
|
|
err = setsockopt(fd, level, opt, (_array), 8);
|
|
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Interface = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 4, _array.buffer.byteLength));
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptIPMreq = SetsockoptIPMreq;
|
|
SetsockoptIPv6Mreq = function(fd, level, opt, mreq) {
|
|
var _array, _struct, _view, err, fd, level, mreq, opt;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(20);
|
|
err = setsockopt(fd, level, opt, (_array), 20);
|
|
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Interface = _view.getUint32(16, true);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptIPv6Mreq = SetsockoptIPv6Mreq;
|
|
SetsockoptLinger = function(fd, level, opt, l) {
|
|
var _array, _struct, _view, err, fd, l, level, opt;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(8);
|
|
err = setsockopt(fd, level, opt, (_array), 8);
|
|
_struct = l, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Onoff = _view.getInt32(0, true), _struct.Linger = _view.getInt32(4, true);
|
|
return err;
|
|
};
|
|
$pkg.SetsockoptLinger = SetsockoptLinger;
|
|
Socket = function(domain, typ, proto) {
|
|
var _tmp, _tmp$1, _tuple, domain, err, fd, proto, typ;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
if ((domain === 10) && $pkg.SocketDisableIPv6) {
|
|
_tmp = -1;
|
|
_tmp$1 = new Errno(97);
|
|
fd = _tmp;
|
|
err = _tmp$1;
|
|
return [fd, err];
|
|
}
|
|
_tuple = socket(domain, typ, proto);
|
|
fd = _tuple[0];
|
|
err = _tuple[1];
|
|
return [fd, err];
|
|
};
|
|
$pkg.Socket = Socket;
|
|
fchmodat = function(dirfd, path, mode) {
|
|
var _p0, _tuple, _tuple$1, dirfd, e1, err, mode, path;
|
|
err = $ifaceNil;
|
|
_p0 = ptrType$2.nil;
|
|
_tuple = BytePtrFromString(path);
|
|
_p0 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
_tuple$1 = Syscall(268, ((dirfd >>> 0)), ((_p0)), ((mode >>> 0)));
|
|
e1 = _tuple$1[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
openat = function(dirfd, path, flags, mode) {
|
|
var _p0, _tuple, _tuple$1, dirfd, e1, err, fd, flags, mode, path, r0;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_p0 = ptrType$2.nil;
|
|
_tuple = BytePtrFromString(path);
|
|
_p0 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [fd, err];
|
|
}
|
|
_tuple$1 = Syscall6(257, ((dirfd >>> 0)), ((_p0)), ((flags >>> 0)), ((mode >>> 0)), 0, 0);
|
|
r0 = _tuple$1[0];
|
|
e1 = _tuple$1[2];
|
|
fd = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [fd, err];
|
|
};
|
|
Close = function(fd) {
|
|
var _tuple, e1, err, fd;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(3, ((fd >>> 0)), 0, 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Close = Close;
|
|
Dup = function(oldfd) {
|
|
var _tuple, e1, err, fd, oldfd, r0;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(32, ((oldfd >>> 0)), 0, 0);
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
fd = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [fd, err];
|
|
};
|
|
$pkg.Dup = Dup;
|
|
Fchdir = function(fd) {
|
|
var _tuple, e1, err, fd;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(81, ((fd >>> 0)), 0, 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Fchdir = Fchdir;
|
|
Fchmod = function(fd, mode) {
|
|
var _tuple, e1, err, fd, mode;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(91, ((fd >>> 0)), ((mode >>> 0)), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Fchmod = Fchmod;
|
|
fcntl = function(fd, cmd, arg) {
|
|
var _tuple, arg, cmd, e1, err, fd, r0, val;
|
|
val = 0;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(72, ((fd >>> 0)), ((cmd >>> 0)), ((arg >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
val = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [val, err];
|
|
};
|
|
Fsync = function(fd) {
|
|
var _tuple, e1, err, fd;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(74, ((fd >>> 0)), 0, 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Fsync = Fsync;
|
|
Getdents = function(fd, buf) {
|
|
var _p0, _tuple, buf, e1, err, fd, n, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (buf.$length > 0) {
|
|
_p0 = ($sliceToArray(buf));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall(217, ((fd >>> 0)), (_p0), ((buf.$length >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
$pkg.Getdents = Getdents;
|
|
read = function(fd, p) {
|
|
var _p0, _tuple, e1, err, fd, n, p, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (p.$length > 0) {
|
|
_p0 = ($sliceToArray(p));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall(0, ((fd >>> 0)), (_p0), ((p.$length >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
write = function(fd, p) {
|
|
var _p0, _tuple, e1, err, fd, n, p, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (p.$length > 0) {
|
|
_p0 = ($sliceToArray(p));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall(1, ((fd >>> 0)), (_p0), ((p.$length >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
munmap = function(addr, length) {
|
|
var _tuple, addr, e1, err, length;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(11, (addr), (length), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
Fchown = function(fd, uid, gid) {
|
|
var _tuple, e1, err, fd, gid, uid;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(93, ((fd >>> 0)), ((uid >>> 0)), ((gid >>> 0)));
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Fchown = Fchown;
|
|
Fstat = function(fd, stat) {
|
|
var _array, _struct, _tuple, _view, e1, err, fd, stat;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(144);
|
|
_tuple = Syscall(5, ((fd >>> 0)), ((_array)), 0);
|
|
_struct = stat, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Dev = new $Uint64(_view.getUint32(4, true), _view.getUint32(0, true)), _struct.Ino = new $Uint64(_view.getUint32(12, true), _view.getUint32(8, true)), _struct.Nlink = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Mode = _view.getUint32(24, true), _struct.Uid = _view.getUint32(28, true), _struct.Gid = _view.getUint32(32, true), _struct.X__pad0 = _view.getInt32(36, true), _struct.Rdev = new $Uint64(_view.getUint32(44, true), _view.getUint32(40, true)), _struct.Size = new $Int64(_view.getUint32(52, true), _view.getUint32(48, true)), _struct.Blksize = new $Int64(_view.getUint32(60, true), _view.getUint32(56, true)), _struct.Blocks = new $Int64(_view.getUint32(68, true), _view.getUint32(64, true)), _struct.Atim.Sec = new $Int64(_view.getUint32(76, true), _view.getUint32(72, true)), _struct.Atim.Nsec = new $Int64(_view.getUint32(84, true), _view.getUint32(80, true)), _struct.Mtim.Sec = new $Int64(_view.getUint32(92, true), _view.getUint32(88, true)), _struct.Mtim.Nsec = new $Int64(_view.getUint32(100, true), _view.getUint32(96, true)), _struct.Ctim.Sec = new $Int64(_view.getUint32(108, true), _view.getUint32(104, true)), _struct.Ctim.Nsec = new $Int64(_view.getUint32(116, true), _view.getUint32(112, true)), _struct.X__unused = new ($nativeArray($kindInt64))(_array.buffer, $min(_array.byteOffset + 120, _array.buffer.byteLength));
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Fstat = Fstat;
|
|
Ftruncate = function(fd, length) {
|
|
var _tuple, e1, err, fd, length;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(77, ((fd >>> 0)), ((length.$low >>> 0)), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Ftruncate = Ftruncate;
|
|
Pread = function(fd, p, offset) {
|
|
var _p0, _tuple, e1, err, fd, n, offset, p, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (p.$length > 0) {
|
|
_p0 = ($sliceToArray(p));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall6(17, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((offset.$low >>> 0)), 0, 0);
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
$pkg.Pread = Pread;
|
|
Pwrite = function(fd, p, offset) {
|
|
var _p0, _tuple, e1, err, fd, n, offset, p, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (p.$length > 0) {
|
|
_p0 = ($sliceToArray(p));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall6(18, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((offset.$low >>> 0)), 0, 0);
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
$pkg.Pwrite = Pwrite;
|
|
Seek = function(fd, offset, whence) {
|
|
var _tuple, e1, err, fd, off, offset, r0, whence;
|
|
off = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(8, ((fd >>> 0)), ((offset.$low >>> 0)), ((whence >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
off = (new $Int64(0, r0.constructor === Number ? r0 : 1));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [off, err];
|
|
};
|
|
$pkg.Seek = Seek;
|
|
Shutdown = function(fd, how) {
|
|
var _tuple, e1, err, fd, how;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(48, ((fd >>> 0)), ((how >>> 0)), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
$pkg.Shutdown = Shutdown;
|
|
accept = function(s, rsa, addrlen) {
|
|
var _array, _struct, _tuple, _view, addrlen, e1, err, fd, r0, rsa, s;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(112);
|
|
_tuple = Syscall(43, ((s >>> 0)), ((_array)), ((addrlen)));
|
|
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
fd = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [fd, err];
|
|
};
|
|
accept4 = function(s, rsa, addrlen, flags) {
|
|
var _array, _struct, _tuple, _view, addrlen, e1, err, fd, flags, r0, rsa, s;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(112);
|
|
_tuple = Syscall6(288, ((s >>> 0)), ((_array)), ((addrlen)), ((flags >>> 0)), 0, 0);
|
|
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
fd = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [fd, err];
|
|
};
|
|
bind = function(s, addr, addrlen) {
|
|
var _tuple, addr, addrlen, e1, err, s;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall(49, ((s >>> 0)), (addr), ((addrlen >>> 0)));
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
fstatat = function(fd, path, stat, flags) {
|
|
var _array, _p0, _struct, _tuple, _tuple$1, _view, e1, err, fd, flags, path, stat;
|
|
err = $ifaceNil;
|
|
_p0 = ptrType$2.nil;
|
|
_tuple = BytePtrFromString(path);
|
|
_p0 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
_array = new Uint8Array(144);
|
|
_tuple$1 = Syscall6(262, ((fd >>> 0)), ((_p0)), ((_array)), ((flags >>> 0)), 0, 0);
|
|
_struct = stat, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Dev = new $Uint64(_view.getUint32(4, true), _view.getUint32(0, true)), _struct.Ino = new $Uint64(_view.getUint32(12, true), _view.getUint32(8, true)), _struct.Nlink = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Mode = _view.getUint32(24, true), _struct.Uid = _view.getUint32(28, true), _struct.Gid = _view.getUint32(32, true), _struct.X__pad0 = _view.getInt32(36, true), _struct.Rdev = new $Uint64(_view.getUint32(44, true), _view.getUint32(40, true)), _struct.Size = new $Int64(_view.getUint32(52, true), _view.getUint32(48, true)), _struct.Blksize = new $Int64(_view.getUint32(60, true), _view.getUint32(56, true)), _struct.Blocks = new $Int64(_view.getUint32(68, true), _view.getUint32(64, true)), _struct.Atim.Sec = new $Int64(_view.getUint32(76, true), _view.getUint32(72, true)), _struct.Atim.Nsec = new $Int64(_view.getUint32(84, true), _view.getUint32(80, true)), _struct.Mtim.Sec = new $Int64(_view.getUint32(92, true), _view.getUint32(88, true)), _struct.Mtim.Nsec = new $Int64(_view.getUint32(100, true), _view.getUint32(96, true)), _struct.Ctim.Sec = new $Int64(_view.getUint32(108, true), _view.getUint32(104, true)), _struct.Ctim.Nsec = new $Int64(_view.getUint32(116, true), _view.getUint32(112, true)), _struct.X__unused = new ($nativeArray($kindInt64))(_array.buffer, $min(_array.byteOffset + 120, _array.buffer.byteLength));
|
|
e1 = _tuple$1[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
getsockopt = function(s, level, name, val, vallen) {
|
|
var _tuple, e1, err, level, name, s, val, vallen;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall6(55, ((s >>> 0)), ((level >>> 0)), ((name >>> 0)), (val), ((vallen)), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
setsockopt = function(s, level, name, val, vallen) {
|
|
var _tuple, e1, err, level, name, s, val, vallen;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall6(54, ((s >>> 0)), ((level >>> 0)), ((name >>> 0)), (val), (vallen), 0);
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
socket = function(domain, typ, proto) {
|
|
var _tuple, domain, e1, err, fd, proto, r0, typ;
|
|
fd = 0;
|
|
err = $ifaceNil;
|
|
_tuple = RawSyscall(41, ((domain >>> 0)), ((typ >>> 0)), ((proto >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
fd = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [fd, err];
|
|
};
|
|
getsockname = function(fd, rsa, addrlen) {
|
|
var _array, _struct, _tuple, _view, addrlen, e1, err, fd, rsa;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(112);
|
|
_tuple = RawSyscall(51, ((fd >>> 0)), ((_array)), ((addrlen)));
|
|
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
recvfrom = function(fd, p, flags, from, fromlen) {
|
|
var _array, _p0, _struct, _tuple, _view, e1, err, fd, flags, from, fromlen, n, p, r0;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (p.$length > 0) {
|
|
_p0 = ($sliceToArray(p));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_array = new Uint8Array(112);
|
|
_tuple = Syscall6(45, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((flags >>> 0)), ((_array)), ((fromlen)));
|
|
_struct = from, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
sendto = function(s, buf, flags, to, addrlen) {
|
|
var _p0, _tuple, addrlen, buf, e1, err, flags, s, to;
|
|
err = $ifaceNil;
|
|
_p0 = 0;
|
|
if (buf.$length > 0) {
|
|
_p0 = ($sliceToArray(buf));
|
|
} else {
|
|
_p0 = (new Uint8Array(0));
|
|
}
|
|
_tuple = Syscall6(44, ((s >>> 0)), (_p0), ((buf.$length >>> 0)), ((flags >>> 0)), (to), ((addrlen >>> 0)));
|
|
e1 = _tuple[2];
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return err;
|
|
};
|
|
recvmsg = function(s, msg, flags) {
|
|
var _array, _struct, _tuple, _view, e1, err, flags, msg, n, r0, s;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(48);
|
|
_tuple = Syscall(47, ((s >>> 0)), ((_array)), ((flags >>> 0)));
|
|
_struct = msg, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Namelen = _view.getUint32(4, true), _struct.Pad_cgo_0 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 8, _array.buffer.byteLength)), _struct.Iovlen = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Controllen = new $Uint64(_view.getUint32(36, true), _view.getUint32(32, true)), _struct.Flags = _view.getInt32(40, true), _struct.Pad_cgo_1 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 44, _array.buffer.byteLength));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
sendmsg = function(s, msg, flags) {
|
|
var _array, _struct, _tuple, _view, e1, err, flags, msg, n, r0, s;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_array = new Uint8Array(48);
|
|
_tuple = Syscall(46, ((s >>> 0)), ((_array)), ((flags >>> 0)));
|
|
_struct = msg, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Namelen = _view.getUint32(4, true), _struct.Pad_cgo_0 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 8, _array.buffer.byteLength)), _struct.Iovlen = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Controllen = new $Uint64(_view.getUint32(36, true), _view.getUint32(32, true)), _struct.Flags = _view.getInt32(40, true), _struct.Pad_cgo_1 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 44, _array.buffer.byteLength));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
n = ((r0 >> 0));
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [n, err];
|
|
};
|
|
mmap = function(addr, length, prot, flags, fd, offset) {
|
|
var _tuple, addr, e1, err, fd, flags, length, offset, prot, r0, xaddr;
|
|
xaddr = 0;
|
|
err = $ifaceNil;
|
|
_tuple = Syscall6(9, (addr), (length), ((prot >>> 0)), ((flags >>> 0)), ((fd >>> 0)), ((offset.$low >>> 0)));
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[2];
|
|
xaddr = (r0);
|
|
if (!((e1 === 0))) {
|
|
err = errnoErr(e1);
|
|
}
|
|
return [xaddr, err];
|
|
};
|
|
ptrType$24.methods = [{prop: "toWireFormat", name: "toWireFormat", pkg: "syscall", typ: $funcType([], [sliceType], false)}];
|
|
ptrType$25.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
|
|
ptrType$12.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
|
|
ptrType$26.methods = [{prop: "Mmap", name: "Mmap", pkg: "", typ: $funcType([$Int, $Int64, $Int, $Int, $Int], [sliceType, $error], false)}, {prop: "Munmap", name: "Munmap", pkg: "", typ: $funcType([sliceType], [$error], false)}];
|
|
Errno.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$27.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
|
|
ptrType$28.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
|
|
ptrType$29.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
|
|
ptrType$30.methods = [{prop: "Unix", name: "Unix", pkg: "", typ: $funcType([], [$Int64, $Int64], false)}, {prop: "Nano", name: "Nano", pkg: "", typ: $funcType([], [$Int64], false)}];
|
|
ptrType$20.methods = [{prop: "SetLen", name: "SetLen", pkg: "", typ: $funcType([$Int], [], false)}];
|
|
ptrType$32.methods = [{prop: "SetControllen", name: "SetControllen", pkg: "", typ: $funcType([$Int], [], false)}];
|
|
RawConn.init([{prop: "Control", name: "Control", pkg: "", typ: $funcType([funcType], [$error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([funcType$1], [$error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([funcType$1], [$error], false)}]);
|
|
NetlinkRouteRequest.init("", [{prop: "Header", name: "Header", embedded: false, exported: true, typ: NlMsghdr, tag: ""}, {prop: "Data", name: "Data", embedded: false, exported: true, typ: RtGenmsg, tag: ""}]);
|
|
NetlinkMessage.init("", [{prop: "Header", name: "Header", embedded: false, exported: true, typ: NlMsghdr, tag: ""}, {prop: "Data", name: "Data", embedded: false, exported: true, typ: sliceType, tag: ""}]);
|
|
NetlinkRouteAttr.init("", [{prop: "Attr", name: "Attr", embedded: false, exported: true, typ: RtAttr, tag: ""}, {prop: "Value", name: "Value", embedded: false, exported: true, typ: sliceType, tag: ""}]);
|
|
SockaddrLinklayer.init("syscall", [{prop: "Protocol", name: "Protocol", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Ifindex", name: "Ifindex", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Hatype", name: "Hatype", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pkttype", name: "Pkttype", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Halen", name: "Halen", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$1, tag: ""}, {prop: "raw", name: "raw", embedded: false, exported: false, typ: RawSockaddrLinklayer, tag: ""}]);
|
|
SockaddrNetlink.init("syscall", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pad", name: "Pad", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pid", name: "Pid", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Groups", name: "Groups", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "raw", name: "raw", embedded: false, exported: false, typ: RawSockaddrNetlink, tag: ""}]);
|
|
mmapper.init("syscall", [{prop: "Mutex", name: "Mutex", embedded: true, exported: true, typ: sync.Mutex, tag: ""}, {prop: "active", name: "active", embedded: false, exported: false, typ: mapType, tag: ""}, {prop: "mmap", name: "mmap", embedded: false, exported: false, typ: funcType$2, tag: ""}, {prop: "munmap", name: "munmap", embedded: false, exported: false, typ: funcType$3, tag: ""}]);
|
|
Sockaddr.init([{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}]);
|
|
SockaddrInet4.init("syscall", [{prop: "Port", name: "Port", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "raw", name: "raw", embedded: false, exported: false, typ: RawSockaddrInet4, tag: ""}]);
|
|
SockaddrInet6.init("syscall", [{prop: "Port", name: "Port", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "ZoneId", name: "ZoneId", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "raw", name: "raw", embedded: false, exported: false, typ: RawSockaddrInet6, tag: ""}]);
|
|
SockaddrUnix.init("syscall", [{prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "raw", name: "raw", embedded: false, exported: false, typ: RawSockaddrUnix, tag: ""}]);
|
|
Timespec.init("", [{prop: "Sec", name: "Sec", embedded: false, exported: true, typ: $Int64, tag: ""}, {prop: "Nsec", name: "Nsec", embedded: false, exported: true, typ: $Int64, tag: ""}]);
|
|
Stat_t.init("", [{prop: "Dev", name: "Dev", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Ino", name: "Ino", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Nlink", name: "Nlink", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Mode", name: "Mode", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Uid", name: "Uid", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Gid", name: "Gid", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "X__pad0", name: "X__pad0", embedded: false, exported: true, typ: $Int32, tag: ""}, {prop: "Rdev", name: "Rdev", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Size", name: "Size", embedded: false, exported: true, typ: $Int64, tag: ""}, {prop: "Blksize", name: "Blksize", embedded: false, exported: true, typ: $Int64, tag: ""}, {prop: "Blocks", name: "Blocks", embedded: false, exported: true, typ: $Int64, tag: ""}, {prop: "Atim", name: "Atim", embedded: false, exported: true, typ: Timespec, tag: ""}, {prop: "Mtim", name: "Mtim", embedded: false, exported: true, typ: Timespec, tag: ""}, {prop: "Ctim", name: "Ctim", embedded: false, exported: true, typ: Timespec, tag: ""}, {prop: "X__unused", name: "X__unused", embedded: false, exported: true, typ: arrayType$5, tag: ""}]);
|
|
RawSockaddrInet4.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Port", name: "Port", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "Zero", name: "Zero", embedded: false, exported: true, typ: arrayType$1, tag: ""}]);
|
|
RawSockaddrInet6.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Port", name: "Port", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Flowinfo", name: "Flowinfo", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "Scope_id", name: "Scope_id", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
RawSockaddrUnix.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Path", name: "Path", embedded: false, exported: true, typ: arrayType$8, tag: ""}]);
|
|
RawSockaddrLinklayer.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Protocol", name: "Protocol", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Ifindex", name: "Ifindex", embedded: false, exported: true, typ: $Int32, tag: ""}, {prop: "Hatype", name: "Hatype", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pkttype", name: "Pkttype", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Halen", name: "Halen", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: arrayType$1, tag: ""}]);
|
|
RawSockaddrNetlink.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pad", name: "Pad", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pid", name: "Pid", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Groups", name: "Groups", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
RawSockaddr.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Data", name: "Data", embedded: false, exported: true, typ: arrayType$10, tag: ""}]);
|
|
RawSockaddrAny.init("", [{prop: "Addr", name: "Addr", embedded: false, exported: true, typ: RawSockaddr, tag: ""}, {prop: "Pad", name: "Pad", embedded: false, exported: true, typ: arrayType$11, tag: ""}]);
|
|
Linger.init("", [{prop: "Onoff", name: "Onoff", embedded: false, exported: true, typ: $Int32, tag: ""}, {prop: "Linger", name: "Linger", embedded: false, exported: true, typ: $Int32, tag: ""}]);
|
|
Iovec.init("", [{prop: "Base", name: "Base", embedded: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Len", name: "Len", embedded: false, exported: true, typ: $Uint64, tag: ""}]);
|
|
IPMreq.init("", [{prop: "Multiaddr", name: "Multiaddr", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "Interface", name: "Interface", embedded: false, exported: true, typ: arrayType$9, tag: ""}]);
|
|
IPMreqn.init("", [{prop: "Multiaddr", name: "Multiaddr", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "Address", name: "Address", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "Ifindex", name: "Ifindex", embedded: false, exported: true, typ: $Int32, tag: ""}]);
|
|
IPv6Mreq.init("", [{prop: "Multiaddr", name: "Multiaddr", embedded: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "Interface", name: "Interface", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
Msghdr.init("", [{prop: "Name", name: "Name", embedded: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Namelen", name: "Namelen", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Pad_cgo_0", name: "Pad_cgo_0", embedded: false, exported: true, typ: arrayType$9, tag: ""}, {prop: "Iov", name: "Iov", embedded: false, exported: true, typ: ptrType$20, tag: ""}, {prop: "Iovlen", name: "Iovlen", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Control", name: "Control", embedded: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Controllen", name: "Controllen", embedded: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: $Int32, tag: ""}, {prop: "Pad_cgo_1", name: "Pad_cgo_1", embedded: false, exported: true, typ: arrayType$9, tag: ""}]);
|
|
NlMsghdr.init("", [{prop: "Len", name: "Len", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Seq", name: "Seq", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Pid", name: "Pid", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
RtGenmsg.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint8, tag: ""}]);
|
|
RtAttr.init("", [{prop: "Len", name: "Len", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: $Uint16, tag: ""}]);
|
|
IfInfomsg.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "X__ifi_pad", name: "X__ifi_pad", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Index", name: "Index", embedded: false, exported: true, typ: $Int32, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Change", name: "Change", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
IfAddrmsg.init("", [{prop: "Family", name: "Family", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Prefixlen", name: "Prefixlen", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Scope", name: "Scope", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Index", name: "Index", embedded: false, exported: true, typ: $Uint32, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = race.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
lineBuffer = sliceType.nil;
|
|
syscallModule = null;
|
|
$pkg.ForkLock = new sync.RWMutex.ptr(new sync.Mutex.ptr(0, 0), 0, 0, 0, 0);
|
|
$pkg.SocketDisableIPv6 = false;
|
|
ioSync = new $Int64(0, 0);
|
|
warningPrinted = false;
|
|
alreadyTriedToLoad = false;
|
|
minusOne = -1;
|
|
envs = runtime_envs();
|
|
$pkg.Stdin = 0;
|
|
$pkg.Stdout = 1;
|
|
$pkg.Stderr = 2;
|
|
errEAGAIN = new Errno(11);
|
|
errEINVAL = new Errno(22);
|
|
errENOENT = new Errno(2);
|
|
errors = $toNativeArray($kindString, ["", "operation not permitted", "no such file or directory", "no such process", "interrupted system call", "input/output error", "no such device or address", "argument list too long", "exec format error", "bad file descriptor", "no child processes", "resource temporarily unavailable", "cannot allocate memory", "permission denied", "bad address", "block device required", "device or resource busy", "file exists", "invalid cross-device link", "no such device", "not a directory", "is a directory", "invalid argument", "too many open files in system", "too many open files", "inappropriate ioctl for device", "text file busy", "file too large", "no space left on device", "illegal seek", "read-only file system", "too many links", "broken pipe", "numerical argument out of domain", "numerical result out of range", "resource deadlock avoided", "file name too long", "no locks available", "function not implemented", "directory not empty", "too many levels of symbolic links", "", "no message of desired type", "identifier removed", "channel number out of range", "level 2 not synchronized", "level 3 halted", "level 3 reset", "link number out of range", "protocol driver not attached", "no CSI structure available", "level 2 halted", "invalid exchange", "invalid request descriptor", "exchange full", "no anode", "invalid request code", "invalid slot", "", "bad font file format", "device not a stream", "no data available", "timer expired", "out of streams resources", "machine is not on the network", "package not installed", "object is remote", "link has been severed", "advertise error", "srmount error", "communication error on send", "protocol error", "multihop attempted", "RFS specific error", "bad message", "value too large for defined data type", "name not unique on network", "file descriptor in bad state", "remote address changed", "can not access a needed shared library", "accessing a corrupted shared library", ".lib section in a.out corrupted", "attempting to link in too many shared libraries", "cannot exec a shared library directly", "invalid or incomplete multibyte or wide character", "interrupted system call should be restarted", "streams pipe error", "too many users", "socket operation on non-socket", "destination address required", "message too long", "protocol wrong type for socket", "protocol not available", "protocol not supported", "socket type not supported", "operation not supported", "protocol family not supported", "address family not supported by protocol", "address already in use", "cannot assign requested address", "network is down", "network is unreachable", "network dropped connection on reset", "software caused connection abort", "connection reset by peer", "no buffer space available", "transport endpoint is already connected", "transport endpoint is not connected", "cannot send after transport endpoint shutdown", "too many references: cannot splice", "connection timed out", "connection refused", "host is down", "no route to host", "operation already in progress", "operation now in progress", "stale NFS file handle", "structure needs cleaning", "not a XENIX named type file", "no XENIX semaphores available", "is a named type file", "remote I/O error", "disk quota exceeded", "no medium found", "wrong medium type", "operation canceled", "required key not available", "key has expired", "key has been revoked", "key was rejected by service", "owner died", "state not recoverable", "operation not possible due to RF-kill"]);
|
|
mapper = new mmapper.ptr(new sync.Mutex.ptr(0, 0), {}, mmap, munmap);
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/gopherjs/gopherjs/nosync"] = (function() {
|
|
var $pkg = {}, $init, Mutex, Once, Pool, ptrType$1, funcType$1, ptrType$4, sliceType, ptrType$5, funcType$2;
|
|
Mutex = $pkg.Mutex = $newType(0, $kindStruct, "nosync.Mutex", true, "github.com/gopherjs/gopherjs/nosync", true, function(locked_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.locked = false;
|
|
return;
|
|
}
|
|
this.locked = locked_;
|
|
});
|
|
Once = $pkg.Once = $newType(0, $kindStruct, "nosync.Once", true, "github.com/gopherjs/gopherjs/nosync", true, function(doing_, done_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.doing = false;
|
|
this.done = false;
|
|
return;
|
|
}
|
|
this.doing = doing_;
|
|
this.done = done_;
|
|
});
|
|
Pool = $pkg.Pool = $newType(0, $kindStruct, "nosync.Pool", true, "github.com/gopherjs/gopherjs/nosync", true, function(store_, New_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.store = sliceType.nil;
|
|
this.New = $throwNilPointerError;
|
|
return;
|
|
}
|
|
this.store = store_;
|
|
this.New = New_;
|
|
});
|
|
ptrType$1 = $ptrType(Mutex);
|
|
funcType$1 = $funcType([], [], false);
|
|
ptrType$4 = $ptrType(Once);
|
|
sliceType = $sliceType($emptyInterface);
|
|
ptrType$5 = $ptrType(Pool);
|
|
funcType$2 = $funcType([], [$emptyInterface], false);
|
|
Mutex.ptr.prototype.Lock = function() {
|
|
var m;
|
|
m = this;
|
|
if (m.locked) {
|
|
$panic(new $String("nosync: mutex is already locked"));
|
|
}
|
|
m.locked = true;
|
|
};
|
|
Mutex.prototype.Lock = function() { return this.$val.Lock(); };
|
|
Mutex.ptr.prototype.Unlock = function() {
|
|
var m;
|
|
m = this;
|
|
if (!m.locked) {
|
|
$panic(new $String("nosync: unlock of unlocked mutex"));
|
|
}
|
|
m.locked = false;
|
|
};
|
|
Mutex.prototype.Unlock = function() { return this.$val.Unlock(); };
|
|
Once.ptr.prototype.Do = function(f) {
|
|
var f, o, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; f = $f.f; o = $f.o; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
o = [o];
|
|
o[0] = this;
|
|
if (o[0].done) {
|
|
$s = -1; return;
|
|
}
|
|
if (o[0].doing) {
|
|
$panic(new $String("nosync: Do called within f"));
|
|
}
|
|
o[0].doing = true;
|
|
$deferred.push([(function(o) { return function() {
|
|
o[0].doing = false;
|
|
o[0].done = true;
|
|
}; })(o), []]);
|
|
$r = f(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Once.ptr.prototype.Do }; } $f.f = f; $f.o = o; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Once.prototype.Do = function(f) { return this.$val.Do(f); };
|
|
Pool.ptr.prototype.Get = function() {
|
|
var _r, p, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
/* */ if (p.store.$length === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (p.store.$length === 0) { */ case 1:
|
|
/* */ if (!(p.New === $throwNilPointerError)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!(p.New === $throwNilPointerError)) { */ case 3:
|
|
_r = p.New(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 2:
|
|
x$2 = (x = p.store, x$1 = p.store.$length - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
p.store = $subslice(p.store, 0, (p.store.$length - 1 >> 0));
|
|
$s = -1; return x$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Pool.ptr.prototype.Get }; } $f._r = _r; $f.p = p; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Pool.prototype.Get = function() { return this.$val.Get(); };
|
|
Pool.ptr.prototype.Put = function(x) {
|
|
var p, x;
|
|
p = this;
|
|
if ($interfaceIsEqual(x, $ifaceNil)) {
|
|
return;
|
|
}
|
|
p.store = $append(p.store, x);
|
|
};
|
|
Pool.prototype.Put = function(x) { return this.$val.Put(x); };
|
|
ptrType$1.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}];
|
|
ptrType$4.methods = [{prop: "Do", name: "Do", pkg: "", typ: $funcType([funcType$1], [], false)}];
|
|
ptrType$5.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Put", name: "Put", pkg: "", typ: $funcType([$emptyInterface], [], false)}];
|
|
Mutex.init("github.com/gopherjs/gopherjs/nosync", [{prop: "locked", name: "locked", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
Once.init("github.com/gopherjs/gopherjs/nosync", [{prop: "doing", name: "doing", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "done", name: "done", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
Pool.init("github.com/gopherjs/gopherjs/nosync", [{prop: "store", name: "store", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "New", name: "New", embedded: false, exported: true, typ: funcType$2, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["time"] = (function() {
|
|
var $pkg = {}, $init, errors, js, nosync, runtime, syscall, runtimeTimer, ParseError, Timer, Ticker, Time, Month, Weekday, Duration, Location, zone, zoneTrans, sliceType, sliceType$1, ptrType, sliceType$2, arrayType, sliceType$3, arrayType$1, arrayType$2, ptrType$2, chanType, arrayType$3, funcType$1, ptrType$3, ptrType$4, ptrType$5, chanType$1, ptrType$6, ptrType$7, zoneSources, std0x, longDayNames, shortDayNames, shortMonthNames, longMonthNames, atoiError, errBad, errLeadingInt, months, days, daysBefore, startNano, utcLoc, utcLoc$24ptr, localLoc, localLoc$24ptr, localOnce, errLocation, badData, x, init, initLocal, runtimeNano, now, startTimer, stopTimer, indexByte, startsWithLowerCase, nextStdChunk, match, lookup, appendInt, atoi, formatNano, quote, isDigit, getnum, cutspace, skip, Parse, parse, parseTimeZone, parseGMT, parseSignedOffset, parseNanoseconds, leadingInt, when, NewTimer, sendTime, NewTicker, absWeekday, absClock, fmtFrac, fmtInt, lessThanHalf, Until, absDate, daysIn, Now, unixTime, Unix, isLeap, norm, Date, div, FixedZone;
|
|
errors = $packages["errors"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
|
|
runtime = $packages["runtime"];
|
|
syscall = $packages["syscall"];
|
|
runtimeTimer = $pkg.runtimeTimer = $newType(0, $kindStruct, "time.runtimeTimer", true, "time", false, function(i_, when_, period_, f_, arg_, timeout_, active_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.i = 0;
|
|
this.when = new $Int64(0, 0);
|
|
this.period = new $Int64(0, 0);
|
|
this.f = $throwNilPointerError;
|
|
this.arg = $ifaceNil;
|
|
this.timeout = null;
|
|
this.active = false;
|
|
return;
|
|
}
|
|
this.i = i_;
|
|
this.when = when_;
|
|
this.period = period_;
|
|
this.f = f_;
|
|
this.arg = arg_;
|
|
this.timeout = timeout_;
|
|
this.active = active_;
|
|
});
|
|
ParseError = $pkg.ParseError = $newType(0, $kindStruct, "time.ParseError", true, "time", true, function(Layout_, Value_, LayoutElem_, ValueElem_, Message_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Layout = "";
|
|
this.Value = "";
|
|
this.LayoutElem = "";
|
|
this.ValueElem = "";
|
|
this.Message = "";
|
|
return;
|
|
}
|
|
this.Layout = Layout_;
|
|
this.Value = Value_;
|
|
this.LayoutElem = LayoutElem_;
|
|
this.ValueElem = ValueElem_;
|
|
this.Message = Message_;
|
|
});
|
|
Timer = $pkg.Timer = $newType(0, $kindStruct, "time.Timer", true, "time", true, function(C_, r_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.C = $chanNil;
|
|
this.r = new runtimeTimer.ptr(0, new $Int64(0, 0), new $Int64(0, 0), $throwNilPointerError, $ifaceNil, null, false);
|
|
return;
|
|
}
|
|
this.C = C_;
|
|
this.r = r_;
|
|
});
|
|
Ticker = $pkg.Ticker = $newType(0, $kindStruct, "time.Ticker", true, "time", true, function(C_, r_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.C = $chanNil;
|
|
this.r = new runtimeTimer.ptr(0, new $Int64(0, 0), new $Int64(0, 0), $throwNilPointerError, $ifaceNil, null, false);
|
|
return;
|
|
}
|
|
this.C = C_;
|
|
this.r = r_;
|
|
});
|
|
Time = $pkg.Time = $newType(0, $kindStruct, "time.Time", true, "time", true, function(wall_, ext_, loc_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.wall = new $Uint64(0, 0);
|
|
this.ext = new $Int64(0, 0);
|
|
this.loc = ptrType$2.nil;
|
|
return;
|
|
}
|
|
this.wall = wall_;
|
|
this.ext = ext_;
|
|
this.loc = loc_;
|
|
});
|
|
Month = $pkg.Month = $newType(4, $kindInt, "time.Month", true, "time", true, null);
|
|
Weekday = $pkg.Weekday = $newType(4, $kindInt, "time.Weekday", true, "time", true, null);
|
|
Duration = $pkg.Duration = $newType(8, $kindInt64, "time.Duration", true, "time", true, null);
|
|
Location = $pkg.Location = $newType(0, $kindStruct, "time.Location", true, "time", true, function(name_, zone_, tx_, cacheStart_, cacheEnd_, cacheZone_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = "";
|
|
this.zone = sliceType.nil;
|
|
this.tx = sliceType$1.nil;
|
|
this.cacheStart = new $Int64(0, 0);
|
|
this.cacheEnd = new $Int64(0, 0);
|
|
this.cacheZone = ptrType.nil;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.zone = zone_;
|
|
this.tx = tx_;
|
|
this.cacheStart = cacheStart_;
|
|
this.cacheEnd = cacheEnd_;
|
|
this.cacheZone = cacheZone_;
|
|
});
|
|
zone = $pkg.zone = $newType(0, $kindStruct, "time.zone", true, "time", false, function(name_, offset_, isDST_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = "";
|
|
this.offset = 0;
|
|
this.isDST = false;
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.offset = offset_;
|
|
this.isDST = isDST_;
|
|
});
|
|
zoneTrans = $pkg.zoneTrans = $newType(0, $kindStruct, "time.zoneTrans", true, "time", false, function(when_, index_, isstd_, isutc_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.when = new $Int64(0, 0);
|
|
this.index = 0;
|
|
this.isstd = false;
|
|
this.isutc = false;
|
|
return;
|
|
}
|
|
this.when = when_;
|
|
this.index = index_;
|
|
this.isstd = isstd_;
|
|
this.isutc = isutc_;
|
|
});
|
|
sliceType = $sliceType(zone);
|
|
sliceType$1 = $sliceType(zoneTrans);
|
|
ptrType = $ptrType(zone);
|
|
sliceType$2 = $sliceType($String);
|
|
arrayType = $arrayType($Uint8, 20);
|
|
sliceType$3 = $sliceType($Uint8);
|
|
arrayType$1 = $arrayType($Uint8, 9);
|
|
arrayType$2 = $arrayType($Uint8, 64);
|
|
ptrType$2 = $ptrType(Location);
|
|
chanType = $chanType(Time, false, false);
|
|
arrayType$3 = $arrayType($Uint8, 32);
|
|
funcType$1 = $funcType([$emptyInterface, $Uintptr], [], false);
|
|
ptrType$3 = $ptrType(js.Object);
|
|
ptrType$4 = $ptrType(ParseError);
|
|
ptrType$5 = $ptrType(Timer);
|
|
chanType$1 = $chanType(Time, false, true);
|
|
ptrType$6 = $ptrType(Ticker);
|
|
ptrType$7 = $ptrType(Time);
|
|
init = function() {
|
|
$unused(Unix(new $Int64(0, 0), new $Int64(0, 0)));
|
|
};
|
|
initLocal = function() {
|
|
var d, i, j, s;
|
|
d = new ($global.Date)();
|
|
s = $internalize(d, $String);
|
|
i = indexByte(s, 40);
|
|
j = indexByte(s, 41);
|
|
if ((i === -1) || (j === -1)) {
|
|
localLoc.name = "UTC";
|
|
return;
|
|
}
|
|
localLoc.name = $substring(s, (i + 1 >> 0), j);
|
|
localLoc.zone = new sliceType([new zone.ptr(localLoc.name, $imul(($parseInt(d.getTimezoneOffset()) >> 0), -60), false)]);
|
|
};
|
|
runtimeNano = function() {
|
|
return $mul64($internalize(new ($global.Date)().getTime(), $Int64), new $Int64(0, 1000000));
|
|
};
|
|
now = function() {
|
|
var _tmp, _tmp$1, _tmp$2, mono, n, nsec, sec, x$1;
|
|
sec = new $Int64(0, 0);
|
|
nsec = 0;
|
|
mono = new $Int64(0, 0);
|
|
n = runtimeNano();
|
|
_tmp = $div64(n, new $Int64(0, 1000000000), false);
|
|
_tmp$1 = (((x$1 = $div64(n, new $Int64(0, 1000000000), true), x$1.$low + ((x$1.$high >> 31) * 4294967296)) >> 0));
|
|
_tmp$2 = n;
|
|
sec = _tmp;
|
|
nsec = _tmp$1;
|
|
mono = _tmp$2;
|
|
return [sec, nsec, mono];
|
|
};
|
|
startTimer = function(t) {
|
|
var diff, t, x$1, x$2;
|
|
t.active = true;
|
|
diff = $div64(((x$1 = t.when, x$2 = runtimeNano(), new $Int64(x$1.$high - x$2.$high, x$1.$low - x$2.$low))), new $Int64(0, 1000000), false);
|
|
if ((diff.$high > 0 || (diff.$high === 0 && diff.$low > 2147483647))) {
|
|
return;
|
|
}
|
|
if ((diff.$high < 0 || (diff.$high === 0 && diff.$low < 0))) {
|
|
diff = new $Int64(0, 0);
|
|
}
|
|
t.timeout = $setTimeout((function() {
|
|
var x$3, x$4, x$5;
|
|
t.active = false;
|
|
if (!((x$3 = t.period, (x$3.$high === 0 && x$3.$low === 0)))) {
|
|
t.when = (x$4 = t.when, x$5 = t.period, new $Int64(x$4.$high + x$5.$high, x$4.$low + x$5.$low));
|
|
startTimer(t);
|
|
}
|
|
$go(t.f, [t.arg, 0]);
|
|
}), $externalize(new $Int64(diff.$high + 0, diff.$low + 1), $Int64));
|
|
};
|
|
stopTimer = function(t) {
|
|
var t, wasActive;
|
|
$global.clearTimeout(t.timeout);
|
|
wasActive = t.active;
|
|
t.active = false;
|
|
return wasActive;
|
|
};
|
|
indexByte = function(s, c) {
|
|
var c, s;
|
|
return $parseInt(s.indexOf($global.String.fromCharCode(c))) >> 0;
|
|
};
|
|
startsWithLowerCase = function(str) {
|
|
var c, str;
|
|
if (str.length === 0) {
|
|
return false;
|
|
}
|
|
c = str.charCodeAt(0);
|
|
return 97 <= c && c <= 122;
|
|
};
|
|
nextStdChunk = function(layout) {
|
|
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$22, _tmp$23, _tmp$24, _tmp$25, _tmp$26, _tmp$27, _tmp$28, _tmp$29, _tmp$3, _tmp$30, _tmp$31, _tmp$32, _tmp$33, _tmp$34, _tmp$35, _tmp$36, _tmp$37, _tmp$38, _tmp$39, _tmp$4, _tmp$40, _tmp$41, _tmp$42, _tmp$43, _tmp$44, _tmp$45, _tmp$46, _tmp$47, _tmp$48, _tmp$49, _tmp$5, _tmp$50, _tmp$51, _tmp$52, _tmp$53, _tmp$54, _tmp$55, _tmp$56, _tmp$57, _tmp$58, _tmp$59, _tmp$6, _tmp$60, _tmp$61, _tmp$62, _tmp$63, _tmp$64, _tmp$65, _tmp$66, _tmp$67, _tmp$68, _tmp$69, _tmp$7, _tmp$70, _tmp$71, _tmp$72, _tmp$73, _tmp$74, _tmp$75, _tmp$76, _tmp$77, _tmp$78, _tmp$79, _tmp$8, _tmp$80, _tmp$81, _tmp$82, _tmp$83, _tmp$84, _tmp$85, _tmp$86, _tmp$9, c, ch, i, j, layout, prefix, std, std$1, suffix, x$1;
|
|
prefix = "";
|
|
std = 0;
|
|
suffix = "";
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < layout.length)) { break; }
|
|
c = ((layout.charCodeAt(i) >> 0));
|
|
_1 = c;
|
|
if (_1 === (74)) {
|
|
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "Jan") {
|
|
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "January") {
|
|
_tmp = $substring(layout, 0, i);
|
|
_tmp$1 = 257;
|
|
_tmp$2 = $substring(layout, (i + 7 >> 0));
|
|
prefix = _tmp;
|
|
std = _tmp$1;
|
|
suffix = _tmp$2;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (!startsWithLowerCase($substring(layout, (i + 3 >> 0)))) {
|
|
_tmp$3 = $substring(layout, 0, i);
|
|
_tmp$4 = 258;
|
|
_tmp$5 = $substring(layout, (i + 3 >> 0));
|
|
prefix = _tmp$3;
|
|
std = _tmp$4;
|
|
suffix = _tmp$5;
|
|
return [prefix, std, suffix];
|
|
}
|
|
}
|
|
} else if (_1 === (77)) {
|
|
if (layout.length >= (i + 3 >> 0)) {
|
|
if ($substring(layout, i, (i + 3 >> 0)) === "Mon") {
|
|
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "Monday") {
|
|
_tmp$6 = $substring(layout, 0, i);
|
|
_tmp$7 = 261;
|
|
_tmp$8 = $substring(layout, (i + 6 >> 0));
|
|
prefix = _tmp$6;
|
|
std = _tmp$7;
|
|
suffix = _tmp$8;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (!startsWithLowerCase($substring(layout, (i + 3 >> 0)))) {
|
|
_tmp$9 = $substring(layout, 0, i);
|
|
_tmp$10 = 262;
|
|
_tmp$11 = $substring(layout, (i + 3 >> 0));
|
|
prefix = _tmp$9;
|
|
std = _tmp$10;
|
|
suffix = _tmp$11;
|
|
return [prefix, std, suffix];
|
|
}
|
|
}
|
|
if ($substring(layout, i, (i + 3 >> 0)) === "MST") {
|
|
_tmp$12 = $substring(layout, 0, i);
|
|
_tmp$13 = 21;
|
|
_tmp$14 = $substring(layout, (i + 3 >> 0));
|
|
prefix = _tmp$12;
|
|
std = _tmp$13;
|
|
suffix = _tmp$14;
|
|
return [prefix, std, suffix];
|
|
}
|
|
}
|
|
} else if (_1 === (48)) {
|
|
if (layout.length >= (i + 2 >> 0) && 49 <= layout.charCodeAt((i + 1 >> 0)) && layout.charCodeAt((i + 1 >> 0)) <= 54) {
|
|
_tmp$15 = $substring(layout, 0, i);
|
|
_tmp$16 = (x$1 = layout.charCodeAt((i + 1 >> 0)) - 49 << 24 >>> 24, ((x$1 < 0 || x$1 >= std0x.length) ? ($throwRuntimeError("index out of range"), undefined) : std0x[x$1]));
|
|
_tmp$17 = $substring(layout, (i + 2 >> 0));
|
|
prefix = _tmp$15;
|
|
std = _tmp$16;
|
|
suffix = _tmp$17;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (49)) {
|
|
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 53)) {
|
|
_tmp$18 = $substring(layout, 0, i);
|
|
_tmp$19 = 522;
|
|
_tmp$20 = $substring(layout, (i + 2 >> 0));
|
|
prefix = _tmp$18;
|
|
std = _tmp$19;
|
|
suffix = _tmp$20;
|
|
return [prefix, std, suffix];
|
|
}
|
|
_tmp$21 = $substring(layout, 0, i);
|
|
_tmp$22 = 259;
|
|
_tmp$23 = $substring(layout, (i + 1 >> 0));
|
|
prefix = _tmp$21;
|
|
std = _tmp$22;
|
|
suffix = _tmp$23;
|
|
return [prefix, std, suffix];
|
|
} else if (_1 === (50)) {
|
|
if (layout.length >= (i + 4 >> 0) && $substring(layout, i, (i + 4 >> 0)) === "2006") {
|
|
_tmp$24 = $substring(layout, 0, i);
|
|
_tmp$25 = 273;
|
|
_tmp$26 = $substring(layout, (i + 4 >> 0));
|
|
prefix = _tmp$24;
|
|
std = _tmp$25;
|
|
suffix = _tmp$26;
|
|
return [prefix, std, suffix];
|
|
}
|
|
_tmp$27 = $substring(layout, 0, i);
|
|
_tmp$28 = 263;
|
|
_tmp$29 = $substring(layout, (i + 1 >> 0));
|
|
prefix = _tmp$27;
|
|
std = _tmp$28;
|
|
suffix = _tmp$29;
|
|
return [prefix, std, suffix];
|
|
} else if (_1 === (95)) {
|
|
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 50)) {
|
|
if (layout.length >= (i + 5 >> 0) && $substring(layout, (i + 1 >> 0), (i + 5 >> 0)) === "2006") {
|
|
_tmp$30 = $substring(layout, 0, (i + 1 >> 0));
|
|
_tmp$31 = 273;
|
|
_tmp$32 = $substring(layout, (i + 5 >> 0));
|
|
prefix = _tmp$30;
|
|
std = _tmp$31;
|
|
suffix = _tmp$32;
|
|
return [prefix, std, suffix];
|
|
}
|
|
_tmp$33 = $substring(layout, 0, i);
|
|
_tmp$34 = 264;
|
|
_tmp$35 = $substring(layout, (i + 2 >> 0));
|
|
prefix = _tmp$33;
|
|
std = _tmp$34;
|
|
suffix = _tmp$35;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (51)) {
|
|
_tmp$36 = $substring(layout, 0, i);
|
|
_tmp$37 = 523;
|
|
_tmp$38 = $substring(layout, (i + 1 >> 0));
|
|
prefix = _tmp$36;
|
|
std = _tmp$37;
|
|
suffix = _tmp$38;
|
|
return [prefix, std, suffix];
|
|
} else if (_1 === (52)) {
|
|
_tmp$39 = $substring(layout, 0, i);
|
|
_tmp$40 = 525;
|
|
_tmp$41 = $substring(layout, (i + 1 >> 0));
|
|
prefix = _tmp$39;
|
|
std = _tmp$40;
|
|
suffix = _tmp$41;
|
|
return [prefix, std, suffix];
|
|
} else if (_1 === (53)) {
|
|
_tmp$42 = $substring(layout, 0, i);
|
|
_tmp$43 = 527;
|
|
_tmp$44 = $substring(layout, (i + 1 >> 0));
|
|
prefix = _tmp$42;
|
|
std = _tmp$43;
|
|
suffix = _tmp$44;
|
|
return [prefix, std, suffix];
|
|
} else if (_1 === (80)) {
|
|
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 77)) {
|
|
_tmp$45 = $substring(layout, 0, i);
|
|
_tmp$46 = 531;
|
|
_tmp$47 = $substring(layout, (i + 2 >> 0));
|
|
prefix = _tmp$45;
|
|
std = _tmp$46;
|
|
suffix = _tmp$47;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (112)) {
|
|
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 109)) {
|
|
_tmp$48 = $substring(layout, 0, i);
|
|
_tmp$49 = 532;
|
|
_tmp$50 = $substring(layout, (i + 2 >> 0));
|
|
prefix = _tmp$48;
|
|
std = _tmp$49;
|
|
suffix = _tmp$50;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (45)) {
|
|
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "-070000") {
|
|
_tmp$51 = $substring(layout, 0, i);
|
|
_tmp$52 = 28;
|
|
_tmp$53 = $substring(layout, (i + 7 >> 0));
|
|
prefix = _tmp$51;
|
|
std = _tmp$52;
|
|
suffix = _tmp$53;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 9 >> 0) && $substring(layout, i, (i + 9 >> 0)) === "-07:00:00") {
|
|
_tmp$54 = $substring(layout, 0, i);
|
|
_tmp$55 = 31;
|
|
_tmp$56 = $substring(layout, (i + 9 >> 0));
|
|
prefix = _tmp$54;
|
|
std = _tmp$55;
|
|
suffix = _tmp$56;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 5 >> 0) && $substring(layout, i, (i + 5 >> 0)) === "-0700") {
|
|
_tmp$57 = $substring(layout, 0, i);
|
|
_tmp$58 = 27;
|
|
_tmp$59 = $substring(layout, (i + 5 >> 0));
|
|
prefix = _tmp$57;
|
|
std = _tmp$58;
|
|
suffix = _tmp$59;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "-07:00") {
|
|
_tmp$60 = $substring(layout, 0, i);
|
|
_tmp$61 = 30;
|
|
_tmp$62 = $substring(layout, (i + 6 >> 0));
|
|
prefix = _tmp$60;
|
|
std = _tmp$61;
|
|
suffix = _tmp$62;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "-07") {
|
|
_tmp$63 = $substring(layout, 0, i);
|
|
_tmp$64 = 29;
|
|
_tmp$65 = $substring(layout, (i + 3 >> 0));
|
|
prefix = _tmp$63;
|
|
std = _tmp$64;
|
|
suffix = _tmp$65;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (90)) {
|
|
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "Z070000") {
|
|
_tmp$66 = $substring(layout, 0, i);
|
|
_tmp$67 = 23;
|
|
_tmp$68 = $substring(layout, (i + 7 >> 0));
|
|
prefix = _tmp$66;
|
|
std = _tmp$67;
|
|
suffix = _tmp$68;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 9 >> 0) && $substring(layout, i, (i + 9 >> 0)) === "Z07:00:00") {
|
|
_tmp$69 = $substring(layout, 0, i);
|
|
_tmp$70 = 26;
|
|
_tmp$71 = $substring(layout, (i + 9 >> 0));
|
|
prefix = _tmp$69;
|
|
std = _tmp$70;
|
|
suffix = _tmp$71;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 5 >> 0) && $substring(layout, i, (i + 5 >> 0)) === "Z0700") {
|
|
_tmp$72 = $substring(layout, 0, i);
|
|
_tmp$73 = 22;
|
|
_tmp$74 = $substring(layout, (i + 5 >> 0));
|
|
prefix = _tmp$72;
|
|
std = _tmp$73;
|
|
suffix = _tmp$74;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "Z07:00") {
|
|
_tmp$75 = $substring(layout, 0, i);
|
|
_tmp$76 = 25;
|
|
_tmp$77 = $substring(layout, (i + 6 >> 0));
|
|
prefix = _tmp$75;
|
|
std = _tmp$76;
|
|
suffix = _tmp$77;
|
|
return [prefix, std, suffix];
|
|
}
|
|
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "Z07") {
|
|
_tmp$78 = $substring(layout, 0, i);
|
|
_tmp$79 = 24;
|
|
_tmp$80 = $substring(layout, (i + 3 >> 0));
|
|
prefix = _tmp$78;
|
|
std = _tmp$79;
|
|
suffix = _tmp$80;
|
|
return [prefix, std, suffix];
|
|
}
|
|
} else if (_1 === (46)) {
|
|
if ((i + 1 >> 0) < layout.length && ((layout.charCodeAt((i + 1 >> 0)) === 48) || (layout.charCodeAt((i + 1 >> 0)) === 57))) {
|
|
ch = layout.charCodeAt((i + 1 >> 0));
|
|
j = i + 1 >> 0;
|
|
while (true) {
|
|
if (!(j < layout.length && (layout.charCodeAt(j) === ch))) { break; }
|
|
j = j + (1) >> 0;
|
|
}
|
|
if (!isDigit(layout, j)) {
|
|
std$1 = 32;
|
|
if (layout.charCodeAt((i + 1 >> 0)) === 57) {
|
|
std$1 = 33;
|
|
}
|
|
std$1 = std$1 | ((((j - ((i + 1 >> 0)) >> 0)) << 16 >> 0));
|
|
_tmp$81 = $substring(layout, 0, i);
|
|
_tmp$82 = std$1;
|
|
_tmp$83 = $substring(layout, j);
|
|
prefix = _tmp$81;
|
|
std = _tmp$82;
|
|
suffix = _tmp$83;
|
|
return [prefix, std, suffix];
|
|
}
|
|
}
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$84 = layout;
|
|
_tmp$85 = 0;
|
|
_tmp$86 = "";
|
|
prefix = _tmp$84;
|
|
std = _tmp$85;
|
|
suffix = _tmp$86;
|
|
return [prefix, std, suffix];
|
|
};
|
|
match = function(s1, s2) {
|
|
var c1, c2, i, s1, s2;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s1.length)) { break; }
|
|
c1 = s1.charCodeAt(i);
|
|
c2 = s2.charCodeAt(i);
|
|
if (!((c1 === c2))) {
|
|
c1 = (c1 | (32)) >>> 0;
|
|
c2 = (c2 | (32)) >>> 0;
|
|
if (!((c1 === c2)) || c1 < 97 || c1 > 122) {
|
|
return false;
|
|
}
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
lookup = function(tab, val) {
|
|
var _i, _ref, i, tab, v, val;
|
|
_ref = tab;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
v = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (val.length >= v.length && match($substring(val, 0, v.length), v)) {
|
|
return [i, $substring(val, v.length), $ifaceNil];
|
|
}
|
|
_i++;
|
|
}
|
|
return [-1, val, errBad];
|
|
};
|
|
appendInt = function(b, x$1, width) {
|
|
var _q, b, buf, i, q, u, w, width, x$1;
|
|
u = ((x$1 >>> 0));
|
|
if (x$1 < 0) {
|
|
b = $append(b, 45);
|
|
u = ((-x$1 >>> 0));
|
|
}
|
|
buf = arrayType.zero();
|
|
i = 20;
|
|
while (true) {
|
|
if (!(u >= 10)) { break; }
|
|
i = i - (1) >> 0;
|
|
q = (_q = u / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = ((((48 + u >>> 0) - (q * 10 >>> 0) >>> 0) << 24 >>> 24)));
|
|
u = q;
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = (((48 + u >>> 0) << 24 >>> 24)));
|
|
w = 20 - i >> 0;
|
|
while (true) {
|
|
if (!(w < width)) { break; }
|
|
b = $append(b, 48);
|
|
w = w + (1) >> 0;
|
|
}
|
|
return $appendSlice(b, $subslice(new sliceType$3(buf), i));
|
|
};
|
|
atoi = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, err, neg, q, rem, s, x$1;
|
|
x$1 = 0;
|
|
err = $ifaceNil;
|
|
neg = false;
|
|
if (!(s === "") && ((s.charCodeAt(0) === 45) || (s.charCodeAt(0) === 43))) {
|
|
neg = s.charCodeAt(0) === 45;
|
|
s = $substring(s, 1);
|
|
}
|
|
_tuple = leadingInt(s);
|
|
q = _tuple[0];
|
|
rem = _tuple[1];
|
|
err = _tuple[2];
|
|
x$1 = (((q.$low + ((q.$high >> 31) * 4294967296)) >> 0));
|
|
if (!($interfaceIsEqual(err, $ifaceNil)) || !(rem === "")) {
|
|
_tmp = 0;
|
|
_tmp$1 = atoiError;
|
|
x$1 = _tmp;
|
|
err = _tmp$1;
|
|
return [x$1, err];
|
|
}
|
|
if (neg) {
|
|
x$1 = -x$1;
|
|
}
|
|
_tmp$2 = x$1;
|
|
_tmp$3 = $ifaceNil;
|
|
x$1 = _tmp$2;
|
|
err = _tmp$3;
|
|
return [x$1, err];
|
|
};
|
|
formatNano = function(b, nanosec, n, trim) {
|
|
var _q, _r, b, buf, n, nanosec, start, trim, u, x$1;
|
|
u = nanosec;
|
|
buf = arrayType$1.zero();
|
|
start = 9;
|
|
while (true) {
|
|
if (!(start > 0)) { break; }
|
|
start = start - (1) >> 0;
|
|
((start < 0 || start >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[start] = ((((_r = u % 10, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) + 48 >>> 0) << 24 >>> 24)));
|
|
u = (_q = u / (10), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
}
|
|
if (n > 9) {
|
|
n = 9;
|
|
}
|
|
if (trim) {
|
|
while (true) {
|
|
if (!(n > 0 && ((x$1 = n - 1 >> 0, ((x$1 < 0 || x$1 >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[x$1])) === 48))) { break; }
|
|
n = n - (1) >> 0;
|
|
}
|
|
if (n === 0) {
|
|
return b;
|
|
}
|
|
}
|
|
b = $append(b, 46);
|
|
return $appendSlice(b, $subslice(new sliceType$3(buf), 0, n));
|
|
};
|
|
Time.ptr.prototype.String = function() {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, buf, m0, m1, m2, s, sign, t, wid, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; buf = $f.buf; m0 = $f.m0; m1 = $f.m1; m2 = $f.m2; s = $f.s; sign = $f.sign; t = $f.t; wid = $f.wid; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).Format("2006-01-02 15:04:05.999999999 -0700 MST"); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
s = _r;
|
|
if (!((x$1 = (x$2 = t.wall, new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
m2 = ((x$3 = t.ext, new $Uint64(x$3.$high, x$3.$low)));
|
|
sign = 43;
|
|
if ((x$4 = t.ext, (x$4.$high < 0 || (x$4.$high === 0 && x$4.$low < 0)))) {
|
|
sign = 45;
|
|
m2 = new $Uint64(-m2.$high, -m2.$low);
|
|
}
|
|
_tmp = $div64(m2, new $Uint64(0, 1000000000), false);
|
|
_tmp$1 = $div64(m2, new $Uint64(0, 1000000000), true);
|
|
m1 = _tmp;
|
|
m2 = _tmp$1;
|
|
_tmp$2 = $div64(m1, new $Uint64(0, 1000000000), false);
|
|
_tmp$3 = $div64(m1, new $Uint64(0, 1000000000), true);
|
|
m0 = _tmp$2;
|
|
m1 = _tmp$3;
|
|
buf = sliceType$3.nil;
|
|
buf = $appendSlice(buf, " m=");
|
|
buf = $append(buf, sign);
|
|
wid = 0;
|
|
if (!((m0.$high === 0 && m0.$low === 0))) {
|
|
buf = appendInt(buf, ((m0.$low >> 0)), 0);
|
|
wid = 9;
|
|
}
|
|
buf = appendInt(buf, ((m1.$low >> 0)), wid);
|
|
buf = $append(buf, 46);
|
|
buf = appendInt(buf, ((m2.$low >> 0)), 9);
|
|
s = s + (($bytesToString(buf)));
|
|
}
|
|
$s = -1; return s;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.String }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.buf = buf; $f.m0 = m0; $f.m1 = m1; $f.m2 = m2; $f.s = s; $f.sign = sign; $f.t = t; $f.wid = wid; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.String = function() { return this.$val.String(); };
|
|
Time.ptr.prototype.Format = function(layout) {
|
|
var _r, b, buf, layout, max, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; buf = $f.buf; layout = $f.layout; max = $f.max; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
b = sliceType$3.nil;
|
|
max = layout.length + 10 >> 0;
|
|
if (max < 64) {
|
|
buf = arrayType$2.zero();
|
|
b = $subslice(new sliceType$3(buf), 0, 0);
|
|
} else {
|
|
b = $makeSlice(sliceType$3, 0, max);
|
|
}
|
|
_r = $clone(t, Time).AppendFormat(b, layout); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
b = _r;
|
|
$s = -1; return ($bytesToString(b));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Format }; } $f._r = _r; $f.b = b; $f.buf = buf; $f.layout = layout; $f.max = max; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Format = function(layout) { return this.$val.Format(layout); };
|
|
Time.ptr.prototype.AppendFormat = function(b, layout) {
|
|
var _1, _q, _q$1, _q$2, _q$3, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _tuple, _tuple$1, _tuple$2, _tuple$3, abs, absoffset, b, day, hour, hr, hr$1, layout, m, min, month, name, offset, prefix, s, sec, std, suffix, t, y, year, zone$1, zone$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _q = $f._q; _q$1 = $f._q$1; _q$2 = $f._q$2; _q$3 = $f._q$3; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; abs = $f.abs; absoffset = $f.absoffset; b = $f.b; day = $f.day; hour = $f.hour; hr = $f.hr; hr$1 = $f.hr$1; layout = $f.layout; m = $f.m; min = $f.min; month = $f.month; name = $f.name; offset = $f.offset; prefix = $f.prefix; s = $f.s; sec = $f.sec; std = $f.std; suffix = $f.suffix; t = $f.t; y = $f.y; year = $f.year; zone$1 = $f.zone$1; zone$2 = $f.zone$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).locabs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
name = _tuple[0];
|
|
offset = _tuple[1];
|
|
abs = _tuple[2];
|
|
year = -1;
|
|
month = 0;
|
|
day = 0;
|
|
hour = -1;
|
|
min = 0;
|
|
sec = 0;
|
|
while (true) {
|
|
if (!(!(layout === ""))) { break; }
|
|
_tuple$1 = nextStdChunk(layout);
|
|
prefix = _tuple$1[0];
|
|
std = _tuple$1[1];
|
|
suffix = _tuple$1[2];
|
|
if (!(prefix === "")) {
|
|
b = $appendSlice(b, prefix);
|
|
}
|
|
if (std === 0) {
|
|
break;
|
|
}
|
|
layout = suffix;
|
|
if (year < 0 && !(((std & 256) === 0))) {
|
|
_tuple$2 = absDate(abs, true);
|
|
year = _tuple$2[0];
|
|
month = _tuple$2[1];
|
|
day = _tuple$2[2];
|
|
}
|
|
if (hour < 0 && !(((std & 512) === 0))) {
|
|
_tuple$3 = absClock(abs);
|
|
hour = _tuple$3[0];
|
|
min = _tuple$3[1];
|
|
sec = _tuple$3[2];
|
|
}
|
|
switch (0) { default:
|
|
_1 = std & 65535;
|
|
if (_1 === (274)) {
|
|
y = year;
|
|
if (y < 0) {
|
|
y = -y;
|
|
}
|
|
b = appendInt(b, (_r$1 = y % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")), 2);
|
|
} else if (_1 === (273)) {
|
|
b = appendInt(b, year, 4);
|
|
} else if (_1 === (258)) {
|
|
b = $appendSlice(b, $substring(new Month(month).String(), 0, 3));
|
|
} else if (_1 === (257)) {
|
|
m = new Month(month).String();
|
|
b = $appendSlice(b, m);
|
|
} else if (_1 === (259)) {
|
|
b = appendInt(b, ((month >> 0)), 0);
|
|
} else if (_1 === (260)) {
|
|
b = appendInt(b, ((month >> 0)), 2);
|
|
} else if (_1 === (262)) {
|
|
b = $appendSlice(b, $substring(new Weekday(absWeekday(abs)).String(), 0, 3));
|
|
} else if (_1 === (261)) {
|
|
s = new Weekday(absWeekday(abs)).String();
|
|
b = $appendSlice(b, s);
|
|
} else if (_1 === (263)) {
|
|
b = appendInt(b, day, 0);
|
|
} else if (_1 === (264)) {
|
|
if (day < 10) {
|
|
b = $append(b, 32);
|
|
}
|
|
b = appendInt(b, day, 0);
|
|
} else if (_1 === (265)) {
|
|
b = appendInt(b, day, 2);
|
|
} else if (_1 === (522)) {
|
|
b = appendInt(b, hour, 2);
|
|
} else if (_1 === (523)) {
|
|
hr = (_r$2 = hour % 12, _r$2 === _r$2 ? _r$2 : $throwRuntimeError("integer divide by zero"));
|
|
if (hr === 0) {
|
|
hr = 12;
|
|
}
|
|
b = appendInt(b, hr, 0);
|
|
} else if (_1 === (524)) {
|
|
hr$1 = (_r$3 = hour % 12, _r$3 === _r$3 ? _r$3 : $throwRuntimeError("integer divide by zero"));
|
|
if (hr$1 === 0) {
|
|
hr$1 = 12;
|
|
}
|
|
b = appendInt(b, hr$1, 2);
|
|
} else if (_1 === (525)) {
|
|
b = appendInt(b, min, 0);
|
|
} else if (_1 === (526)) {
|
|
b = appendInt(b, min, 2);
|
|
} else if (_1 === (527)) {
|
|
b = appendInt(b, sec, 0);
|
|
} else if (_1 === (528)) {
|
|
b = appendInt(b, sec, 2);
|
|
} else if (_1 === (531)) {
|
|
if (hour >= 12) {
|
|
b = $appendSlice(b, "PM");
|
|
} else {
|
|
b = $appendSlice(b, "AM");
|
|
}
|
|
} else if (_1 === (532)) {
|
|
if (hour >= 12) {
|
|
b = $appendSlice(b, "pm");
|
|
} else {
|
|
b = $appendSlice(b, "am");
|
|
}
|
|
} else if ((_1 === (22)) || (_1 === (25)) || (_1 === (23)) || (_1 === (24)) || (_1 === (26)) || (_1 === (27)) || (_1 === (30)) || (_1 === (28)) || (_1 === (29)) || (_1 === (31))) {
|
|
if ((offset === 0) && ((std === 22) || (std === 25) || (std === 23) || (std === 24) || (std === 26))) {
|
|
b = $append(b, 90);
|
|
break;
|
|
}
|
|
zone$1 = (_q = offset / 60, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
absoffset = offset;
|
|
if (zone$1 < 0) {
|
|
b = $append(b, 45);
|
|
zone$1 = -zone$1;
|
|
absoffset = -absoffset;
|
|
} else {
|
|
b = $append(b, 43);
|
|
}
|
|
b = appendInt(b, (_q$1 = zone$1 / 60, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero")), 2);
|
|
if ((std === 25) || (std === 30) || (std === 26) || (std === 31)) {
|
|
b = $append(b, 58);
|
|
}
|
|
if (!((std === 29)) && !((std === 24))) {
|
|
b = appendInt(b, (_r$4 = zone$1 % 60, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero")), 2);
|
|
}
|
|
if ((std === 23) || (std === 28) || (std === 31) || (std === 26)) {
|
|
if ((std === 31) || (std === 26)) {
|
|
b = $append(b, 58);
|
|
}
|
|
b = appendInt(b, (_r$5 = absoffset % 60, _r$5 === _r$5 ? _r$5 : $throwRuntimeError("integer divide by zero")), 2);
|
|
}
|
|
} else if (_1 === (21)) {
|
|
if (!(name === "")) {
|
|
b = $appendSlice(b, name);
|
|
break;
|
|
}
|
|
zone$2 = (_q$2 = offset / 60, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
if (zone$2 < 0) {
|
|
b = $append(b, 45);
|
|
zone$2 = -zone$2;
|
|
} else {
|
|
b = $append(b, 43);
|
|
}
|
|
b = appendInt(b, (_q$3 = zone$2 / 60, (_q$3 === _q$3 && _q$3 !== 1/0 && _q$3 !== -1/0) ? _q$3 >> 0 : $throwRuntimeError("integer divide by zero")), 2);
|
|
b = appendInt(b, (_r$6 = zone$2 % 60, _r$6 === _r$6 ? _r$6 : $throwRuntimeError("integer divide by zero")), 2);
|
|
} else if ((_1 === (32)) || (_1 === (33))) {
|
|
b = formatNano(b, (($clone(t, Time).Nanosecond() >>> 0)), std >> 16 >> 0, (std & 65535) === 33);
|
|
}
|
|
}
|
|
}
|
|
$s = -1; return b;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.AppendFormat }; } $f._1 = _1; $f._q = _q; $f._q$1 = _q$1; $f._q$2 = _q$2; $f._q$3 = _q$3; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.abs = abs; $f.absoffset = absoffset; $f.b = b; $f.day = day; $f.hour = hour; $f.hr = hr; $f.hr$1 = hr$1; $f.layout = layout; $f.m = m; $f.min = min; $f.month = month; $f.name = name; $f.offset = offset; $f.prefix = prefix; $f.s = s; $f.sec = sec; $f.std = std; $f.suffix = suffix; $f.t = t; $f.y = y; $f.year = year; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.AppendFormat = function(b, layout) { return this.$val.AppendFormat(b, layout); };
|
|
quote = function(s) {
|
|
var s;
|
|
return "\"" + s + "\"";
|
|
};
|
|
ParseError.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
if (e.Message === "") {
|
|
return "parsing time " + quote(e.Value) + " as " + quote(e.Layout) + ": cannot parse " + quote(e.ValueElem) + " as " + quote(e.LayoutElem);
|
|
}
|
|
return "parsing time " + quote(e.Value) + e.Message;
|
|
};
|
|
ParseError.prototype.Error = function() { return this.$val.Error(); };
|
|
isDigit = function(s, i) {
|
|
var c, i, s;
|
|
if (s.length <= i) {
|
|
return false;
|
|
}
|
|
c = s.charCodeAt(i);
|
|
return 48 <= c && c <= 57;
|
|
};
|
|
getnum = function(s, fixed) {
|
|
var fixed, s;
|
|
if (!isDigit(s, 0)) {
|
|
return [0, s, errBad];
|
|
}
|
|
if (!isDigit(s, 1)) {
|
|
if (fixed) {
|
|
return [0, s, errBad];
|
|
}
|
|
return [(((s.charCodeAt(0) - 48 << 24 >>> 24) >> 0)), $substring(s, 1), $ifaceNil];
|
|
}
|
|
return [($imul((((s.charCodeAt(0) - 48 << 24 >>> 24) >> 0)), 10)) + (((s.charCodeAt(1) - 48 << 24 >>> 24) >> 0)) >> 0, $substring(s, 2), $ifaceNil];
|
|
};
|
|
cutspace = function(s) {
|
|
var s;
|
|
while (true) {
|
|
if (!(s.length > 0 && (s.charCodeAt(0) === 32))) { break; }
|
|
s = $substring(s, 1);
|
|
}
|
|
return s;
|
|
};
|
|
skip = function(value, prefix) {
|
|
var prefix, value;
|
|
while (true) {
|
|
if (!(prefix.length > 0)) { break; }
|
|
if (prefix.charCodeAt(0) === 32) {
|
|
if (value.length > 0 && !((value.charCodeAt(0) === 32))) {
|
|
return [value, errBad];
|
|
}
|
|
prefix = cutspace(prefix);
|
|
value = cutspace(value);
|
|
continue;
|
|
}
|
|
if ((value.length === 0) || !((value.charCodeAt(0) === prefix.charCodeAt(0)))) {
|
|
return [value, errBad];
|
|
}
|
|
prefix = $substring(prefix, 1);
|
|
value = $substring(value, 1);
|
|
}
|
|
return [value, $ifaceNil];
|
|
};
|
|
Parse = function(layout, value) {
|
|
var _r, layout, value, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; layout = $f.layout; value = $f.value; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = parse(layout, value, $pkg.UTC, $pkg.Local); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Parse }; } $f._r = _r; $f.layout = layout; $f.value = value; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Parse = Parse;
|
|
parse = function(layout, value, defaultLocation, local) {
|
|
var _1, _2, _3, _4, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$22, _tmp$23, _tmp$24, _tmp$25, _tmp$26, _tmp$27, _tmp$28, _tmp$29, _tmp$3, _tmp$30, _tmp$31, _tmp$32, _tmp$33, _tmp$34, _tmp$35, _tmp$36, _tmp$37, _tmp$38, _tmp$39, _tmp$4, _tmp$40, _tmp$41, _tmp$42, _tmp$43, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$10, _tuple$11, _tuple$12, _tuple$13, _tuple$14, _tuple$15, _tuple$16, _tuple$17, _tuple$18, _tuple$19, _tuple$2, _tuple$20, _tuple$21, _tuple$22, _tuple$23, _tuple$24, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, _tuple$8, _tuple$9, alayout, amSet, avalue, day, defaultLocation, err, hour, hour$1, hr, i, layout, local, min, min$1, mm, month, n, n$1, name, ndigit, nsec, offset, offset$1, ok, ok$1, p, pmSet, prefix, rangeErrString, sec, seconds, sign, ss, std, stdstr, suffix, t, t$1, value, x$1, x$2, year, z, zoneName, zoneOffset, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$16 = $f._tmp$16; _tmp$17 = $f._tmp$17; _tmp$18 = $f._tmp$18; _tmp$19 = $f._tmp$19; _tmp$2 = $f._tmp$2; _tmp$20 = $f._tmp$20; _tmp$21 = $f._tmp$21; _tmp$22 = $f._tmp$22; _tmp$23 = $f._tmp$23; _tmp$24 = $f._tmp$24; _tmp$25 = $f._tmp$25; _tmp$26 = $f._tmp$26; _tmp$27 = $f._tmp$27; _tmp$28 = $f._tmp$28; _tmp$29 = $f._tmp$29; _tmp$3 = $f._tmp$3; _tmp$30 = $f._tmp$30; _tmp$31 = $f._tmp$31; _tmp$32 = $f._tmp$32; _tmp$33 = $f._tmp$33; _tmp$34 = $f._tmp$34; _tmp$35 = $f._tmp$35; _tmp$36 = $f._tmp$36; _tmp$37 = $f._tmp$37; _tmp$38 = $f._tmp$38; _tmp$39 = $f._tmp$39; _tmp$4 = $f._tmp$4; _tmp$40 = $f._tmp$40; _tmp$41 = $f._tmp$41; _tmp$42 = $f._tmp$42; _tmp$43 = $f._tmp$43; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$10 = $f._tuple$10; _tuple$11 = $f._tuple$11; _tuple$12 = $f._tuple$12; _tuple$13 = $f._tuple$13; _tuple$14 = $f._tuple$14; _tuple$15 = $f._tuple$15; _tuple$16 = $f._tuple$16; _tuple$17 = $f._tuple$17; _tuple$18 = $f._tuple$18; _tuple$19 = $f._tuple$19; _tuple$2 = $f._tuple$2; _tuple$20 = $f._tuple$20; _tuple$21 = $f._tuple$21; _tuple$22 = $f._tuple$22; _tuple$23 = $f._tuple$23; _tuple$24 = $f._tuple$24; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; _tuple$8 = $f._tuple$8; _tuple$9 = $f._tuple$9; alayout = $f.alayout; amSet = $f.amSet; avalue = $f.avalue; day = $f.day; defaultLocation = $f.defaultLocation; err = $f.err; hour = $f.hour; hour$1 = $f.hour$1; hr = $f.hr; i = $f.i; layout = $f.layout; local = $f.local; min = $f.min; min$1 = $f.min$1; mm = $f.mm; month = $f.month; n = $f.n; n$1 = $f.n$1; name = $f.name; ndigit = $f.ndigit; nsec = $f.nsec; offset = $f.offset; offset$1 = $f.offset$1; ok = $f.ok; ok$1 = $f.ok$1; p = $f.p; pmSet = $f.pmSet; prefix = $f.prefix; rangeErrString = $f.rangeErrString; sec = $f.sec; seconds = $f.seconds; sign = $f.sign; ss = $f.ss; std = $f.std; stdstr = $f.stdstr; suffix = $f.suffix; t = $f.t; t$1 = $f.t$1; value = $f.value; x$1 = $f.x$1; x$2 = $f.x$2; year = $f.year; z = $f.z; zoneName = $f.zoneName; zoneOffset = $f.zoneOffset; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tmp = layout;
|
|
_tmp$1 = value;
|
|
alayout = _tmp;
|
|
avalue = _tmp$1;
|
|
rangeErrString = "";
|
|
amSet = false;
|
|
pmSet = false;
|
|
year = 0;
|
|
month = 1;
|
|
day = 1;
|
|
hour = 0;
|
|
min = 0;
|
|
sec = 0;
|
|
nsec = 0;
|
|
z = ptrType$2.nil;
|
|
zoneOffset = -1;
|
|
zoneName = "";
|
|
while (true) {
|
|
err = $ifaceNil;
|
|
_tuple = nextStdChunk(layout);
|
|
prefix = _tuple[0];
|
|
std = _tuple[1];
|
|
suffix = _tuple[2];
|
|
stdstr = $substring(layout, prefix.length, (layout.length - suffix.length >> 0));
|
|
_tuple$1 = skip(value, prefix);
|
|
value = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, prefix, value, "")];
|
|
}
|
|
if (std === 0) {
|
|
if (!((value.length === 0))) {
|
|
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, "", value, ": extra text: " + value)];
|
|
}
|
|
break;
|
|
}
|
|
layout = suffix;
|
|
p = "";
|
|
switch (0) { default:
|
|
_1 = std & 65535;
|
|
if (_1 === (274)) {
|
|
if (value.length < 2) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$2 = $substring(value, 0, 2);
|
|
_tmp$3 = $substring(value, 2);
|
|
p = _tmp$2;
|
|
value = _tmp$3;
|
|
_tuple$2 = atoi(p);
|
|
year = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
if (year >= 69) {
|
|
year = year + (1900) >> 0;
|
|
} else {
|
|
year = year + (2000) >> 0;
|
|
}
|
|
} else if (_1 === (273)) {
|
|
if (value.length < 4 || !isDigit(value, 0)) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$4 = $substring(value, 0, 4);
|
|
_tmp$5 = $substring(value, 4);
|
|
p = _tmp$4;
|
|
value = _tmp$5;
|
|
_tuple$3 = atoi(p);
|
|
year = _tuple$3[0];
|
|
err = _tuple$3[1];
|
|
} else if (_1 === (258)) {
|
|
_tuple$4 = lookup(shortMonthNames, value);
|
|
month = _tuple$4[0];
|
|
value = _tuple$4[1];
|
|
err = _tuple$4[2];
|
|
month = month + (1) >> 0;
|
|
} else if (_1 === (257)) {
|
|
_tuple$5 = lookup(longMonthNames, value);
|
|
month = _tuple$5[0];
|
|
value = _tuple$5[1];
|
|
err = _tuple$5[2];
|
|
month = month + (1) >> 0;
|
|
} else if ((_1 === (259)) || (_1 === (260))) {
|
|
_tuple$6 = getnum(value, std === 260);
|
|
month = _tuple$6[0];
|
|
value = _tuple$6[1];
|
|
err = _tuple$6[2];
|
|
if (month <= 0 || 12 < month) {
|
|
rangeErrString = "month";
|
|
}
|
|
} else if (_1 === (262)) {
|
|
_tuple$7 = lookup(shortDayNames, value);
|
|
value = _tuple$7[1];
|
|
err = _tuple$7[2];
|
|
} else if (_1 === (261)) {
|
|
_tuple$8 = lookup(longDayNames, value);
|
|
value = _tuple$8[1];
|
|
err = _tuple$8[2];
|
|
} else if ((_1 === (263)) || (_1 === (264)) || (_1 === (265))) {
|
|
if ((std === 264) && value.length > 0 && (value.charCodeAt(0) === 32)) {
|
|
value = $substring(value, 1);
|
|
}
|
|
_tuple$9 = getnum(value, std === 265);
|
|
day = _tuple$9[0];
|
|
value = _tuple$9[1];
|
|
err = _tuple$9[2];
|
|
if (day < 0) {
|
|
rangeErrString = "day";
|
|
}
|
|
} else if (_1 === (522)) {
|
|
_tuple$10 = getnum(value, false);
|
|
hour = _tuple$10[0];
|
|
value = _tuple$10[1];
|
|
err = _tuple$10[2];
|
|
if (hour < 0 || 24 <= hour) {
|
|
rangeErrString = "hour";
|
|
}
|
|
} else if ((_1 === (523)) || (_1 === (524))) {
|
|
_tuple$11 = getnum(value, std === 524);
|
|
hour = _tuple$11[0];
|
|
value = _tuple$11[1];
|
|
err = _tuple$11[2];
|
|
if (hour < 0 || 12 < hour) {
|
|
rangeErrString = "hour";
|
|
}
|
|
} else if ((_1 === (525)) || (_1 === (526))) {
|
|
_tuple$12 = getnum(value, std === 526);
|
|
min = _tuple$12[0];
|
|
value = _tuple$12[1];
|
|
err = _tuple$12[2];
|
|
if (min < 0 || 60 <= min) {
|
|
rangeErrString = "minute";
|
|
}
|
|
} else if ((_1 === (527)) || (_1 === (528))) {
|
|
_tuple$13 = getnum(value, std === 528);
|
|
sec = _tuple$13[0];
|
|
value = _tuple$13[1];
|
|
err = _tuple$13[2];
|
|
if (sec < 0 || 60 <= sec) {
|
|
rangeErrString = "second";
|
|
break;
|
|
}
|
|
if (value.length >= 2 && (value.charCodeAt(0) === 46) && isDigit(value, 1)) {
|
|
_tuple$14 = nextStdChunk(layout);
|
|
std = _tuple$14[1];
|
|
std = std & (65535);
|
|
if ((std === 32) || (std === 33)) {
|
|
break;
|
|
}
|
|
n = 2;
|
|
while (true) {
|
|
if (!(n < value.length && isDigit(value, n))) { break; }
|
|
n = n + (1) >> 0;
|
|
}
|
|
_tuple$15 = parseNanoseconds(value, n);
|
|
nsec = _tuple$15[0];
|
|
rangeErrString = _tuple$15[1];
|
|
err = _tuple$15[2];
|
|
value = $substring(value, n);
|
|
}
|
|
} else if (_1 === (531)) {
|
|
if (value.length < 2) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$6 = $substring(value, 0, 2);
|
|
_tmp$7 = $substring(value, 2);
|
|
p = _tmp$6;
|
|
value = _tmp$7;
|
|
_2 = p;
|
|
if (_2 === ("PM")) {
|
|
pmSet = true;
|
|
} else if (_2 === ("AM")) {
|
|
amSet = true;
|
|
} else {
|
|
err = errBad;
|
|
}
|
|
} else if (_1 === (532)) {
|
|
if (value.length < 2) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$8 = $substring(value, 0, 2);
|
|
_tmp$9 = $substring(value, 2);
|
|
p = _tmp$8;
|
|
value = _tmp$9;
|
|
_3 = p;
|
|
if (_3 === ("pm")) {
|
|
pmSet = true;
|
|
} else if (_3 === ("am")) {
|
|
amSet = true;
|
|
} else {
|
|
err = errBad;
|
|
}
|
|
} else if ((_1 === (22)) || (_1 === (25)) || (_1 === (23)) || (_1 === (24)) || (_1 === (26)) || (_1 === (27)) || (_1 === (29)) || (_1 === (30)) || (_1 === (28)) || (_1 === (31))) {
|
|
if (((std === 22) || (std === 24) || (std === 25)) && value.length >= 1 && (value.charCodeAt(0) === 90)) {
|
|
value = $substring(value, 1);
|
|
z = $pkg.UTC;
|
|
break;
|
|
}
|
|
_tmp$10 = "";
|
|
_tmp$11 = "";
|
|
_tmp$12 = "";
|
|
_tmp$13 = "";
|
|
sign = _tmp$10;
|
|
hour$1 = _tmp$11;
|
|
min$1 = _tmp$12;
|
|
seconds = _tmp$13;
|
|
if ((std === 25) || (std === 30)) {
|
|
if (value.length < 6) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
if (!((value.charCodeAt(3) === 58))) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$14 = $substring(value, 0, 1);
|
|
_tmp$15 = $substring(value, 1, 3);
|
|
_tmp$16 = $substring(value, 4, 6);
|
|
_tmp$17 = "00";
|
|
_tmp$18 = $substring(value, 6);
|
|
sign = _tmp$14;
|
|
hour$1 = _tmp$15;
|
|
min$1 = _tmp$16;
|
|
seconds = _tmp$17;
|
|
value = _tmp$18;
|
|
} else if ((std === 29) || (std === 24)) {
|
|
if (value.length < 3) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$19 = $substring(value, 0, 1);
|
|
_tmp$20 = $substring(value, 1, 3);
|
|
_tmp$21 = "00";
|
|
_tmp$22 = "00";
|
|
_tmp$23 = $substring(value, 3);
|
|
sign = _tmp$19;
|
|
hour$1 = _tmp$20;
|
|
min$1 = _tmp$21;
|
|
seconds = _tmp$22;
|
|
value = _tmp$23;
|
|
} else if ((std === 26) || (std === 31)) {
|
|
if (value.length < 9) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
if (!((value.charCodeAt(3) === 58)) || !((value.charCodeAt(6) === 58))) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$24 = $substring(value, 0, 1);
|
|
_tmp$25 = $substring(value, 1, 3);
|
|
_tmp$26 = $substring(value, 4, 6);
|
|
_tmp$27 = $substring(value, 7, 9);
|
|
_tmp$28 = $substring(value, 9);
|
|
sign = _tmp$24;
|
|
hour$1 = _tmp$25;
|
|
min$1 = _tmp$26;
|
|
seconds = _tmp$27;
|
|
value = _tmp$28;
|
|
} else if ((std === 23) || (std === 28)) {
|
|
if (value.length < 7) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$29 = $substring(value, 0, 1);
|
|
_tmp$30 = $substring(value, 1, 3);
|
|
_tmp$31 = $substring(value, 3, 5);
|
|
_tmp$32 = $substring(value, 5, 7);
|
|
_tmp$33 = $substring(value, 7);
|
|
sign = _tmp$29;
|
|
hour$1 = _tmp$30;
|
|
min$1 = _tmp$31;
|
|
seconds = _tmp$32;
|
|
value = _tmp$33;
|
|
} else {
|
|
if (value.length < 5) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$34 = $substring(value, 0, 1);
|
|
_tmp$35 = $substring(value, 1, 3);
|
|
_tmp$36 = $substring(value, 3, 5);
|
|
_tmp$37 = "00";
|
|
_tmp$38 = $substring(value, 5);
|
|
sign = _tmp$34;
|
|
hour$1 = _tmp$35;
|
|
min$1 = _tmp$36;
|
|
seconds = _tmp$37;
|
|
value = _tmp$38;
|
|
}
|
|
_tmp$39 = 0;
|
|
_tmp$40 = 0;
|
|
_tmp$41 = 0;
|
|
hr = _tmp$39;
|
|
mm = _tmp$40;
|
|
ss = _tmp$41;
|
|
_tuple$16 = atoi(hour$1);
|
|
hr = _tuple$16[0];
|
|
err = _tuple$16[1];
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
_tuple$17 = atoi(min$1);
|
|
mm = _tuple$17[0];
|
|
err = _tuple$17[1];
|
|
}
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
_tuple$18 = atoi(seconds);
|
|
ss = _tuple$18[0];
|
|
err = _tuple$18[1];
|
|
}
|
|
zoneOffset = ($imul(((($imul(hr, 60)) + mm >> 0)), 60)) + ss >> 0;
|
|
_4 = sign.charCodeAt(0);
|
|
if (_4 === (43)) {
|
|
} else if (_4 === (45)) {
|
|
zoneOffset = -zoneOffset;
|
|
} else {
|
|
err = errBad;
|
|
}
|
|
} else if (_1 === (21)) {
|
|
if (value.length >= 3 && $substring(value, 0, 3) === "UTC") {
|
|
z = $pkg.UTC;
|
|
value = $substring(value, 3);
|
|
break;
|
|
}
|
|
_tuple$19 = parseTimeZone(value);
|
|
n$1 = _tuple$19[0];
|
|
ok = _tuple$19[1];
|
|
if (!ok) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tmp$42 = $substring(value, 0, n$1);
|
|
_tmp$43 = $substring(value, n$1);
|
|
zoneName = _tmp$42;
|
|
value = _tmp$43;
|
|
} else if (_1 === (32)) {
|
|
ndigit = 1 + ((std >> 16 >> 0)) >> 0;
|
|
if (value.length < ndigit) {
|
|
err = errBad;
|
|
break;
|
|
}
|
|
_tuple$20 = parseNanoseconds(value, ndigit);
|
|
nsec = _tuple$20[0];
|
|
rangeErrString = _tuple$20[1];
|
|
err = _tuple$20[2];
|
|
value = $substring(value, ndigit);
|
|
} else if (_1 === (33)) {
|
|
if (value.length < 2 || !((value.charCodeAt(0) === 46)) || value.charCodeAt(1) < 48 || 57 < value.charCodeAt(1)) {
|
|
break;
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 9 && (i + 1 >> 0) < value.length && 48 <= value.charCodeAt((i + 1 >> 0)) && value.charCodeAt((i + 1 >> 0)) <= 57)) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tuple$21 = parseNanoseconds(value, 1 + i >> 0);
|
|
nsec = _tuple$21[0];
|
|
rangeErrString = _tuple$21[1];
|
|
err = _tuple$21[2];
|
|
value = $substring(value, (1 + i >> 0));
|
|
}
|
|
}
|
|
if (!(rangeErrString === "")) {
|
|
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, stdstr, value, ": " + rangeErrString + " out of range")];
|
|
}
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, stdstr, value, "")];
|
|
}
|
|
}
|
|
if (pmSet && hour < 12) {
|
|
hour = hour + (12) >> 0;
|
|
} else if (amSet && (hour === 12)) {
|
|
hour = 0;
|
|
}
|
|
if (day < 1 || day > daysIn(((month >> 0)), year)) {
|
|
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, "", value, ": day out of range")];
|
|
}
|
|
/* */ if (!(z === ptrType$2.nil)) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!(z === ptrType$2.nil)) { */ case 1:
|
|
_r = Date(year, ((month >> 0)), day, hour, min, sec, nsec, z); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return [_r, $ifaceNil];
|
|
/* } */ case 2:
|
|
/* */ if (!((zoneOffset === -1))) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (!((zoneOffset === -1))) { */ case 4:
|
|
_r$1 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, $pkg.UTC); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
t = $clone(_r$1, Time);
|
|
t.addSec((x$1 = (new $Int64(0, zoneOffset)), new $Int64(-x$1.$high, -x$1.$low)));
|
|
_r$2 = local.lookup(t.unixSec()); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$22 = _r$2;
|
|
name = _tuple$22[0];
|
|
offset = _tuple$22[1];
|
|
if ((offset === zoneOffset) && (zoneName === "" || name === zoneName)) {
|
|
t.setLoc(local);
|
|
$s = -1; return [t, $ifaceNil];
|
|
}
|
|
t.setLoc(FixedZone(zoneName, zoneOffset));
|
|
$s = -1; return [t, $ifaceNil];
|
|
/* } */ case 5:
|
|
/* */ if (!(zoneName === "")) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (!(zoneName === "")) { */ case 8:
|
|
_r$3 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, $pkg.UTC); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
t$1 = $clone(_r$3, Time);
|
|
_r$4 = local.lookupName(zoneName, t$1.unixSec()); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple$23 = _r$4;
|
|
offset$1 = _tuple$23[0];
|
|
ok$1 = _tuple$23[1];
|
|
if (ok$1) {
|
|
t$1.addSec((x$2 = (new $Int64(0, offset$1)), new $Int64(-x$2.$high, -x$2.$low)));
|
|
t$1.setLoc(local);
|
|
$s = -1; return [t$1, $ifaceNil];
|
|
}
|
|
if (zoneName.length > 3 && $substring(zoneName, 0, 3) === "GMT") {
|
|
_tuple$24 = atoi($substring(zoneName, 3));
|
|
offset$1 = _tuple$24[0];
|
|
offset$1 = $imul(offset$1, (3600));
|
|
}
|
|
t$1.setLoc(FixedZone(zoneName, offset$1));
|
|
$s = -1; return [t$1, $ifaceNil];
|
|
/* } */ case 9:
|
|
_r$5 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, defaultLocation); /* */ $s = 12; case 12: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$s = -1; return [_r$5, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parse }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$16 = _tmp$16; $f._tmp$17 = _tmp$17; $f._tmp$18 = _tmp$18; $f._tmp$19 = _tmp$19; $f._tmp$2 = _tmp$2; $f._tmp$20 = _tmp$20; $f._tmp$21 = _tmp$21; $f._tmp$22 = _tmp$22; $f._tmp$23 = _tmp$23; $f._tmp$24 = _tmp$24; $f._tmp$25 = _tmp$25; $f._tmp$26 = _tmp$26; $f._tmp$27 = _tmp$27; $f._tmp$28 = _tmp$28; $f._tmp$29 = _tmp$29; $f._tmp$3 = _tmp$3; $f._tmp$30 = _tmp$30; $f._tmp$31 = _tmp$31; $f._tmp$32 = _tmp$32; $f._tmp$33 = _tmp$33; $f._tmp$34 = _tmp$34; $f._tmp$35 = _tmp$35; $f._tmp$36 = _tmp$36; $f._tmp$37 = _tmp$37; $f._tmp$38 = _tmp$38; $f._tmp$39 = _tmp$39; $f._tmp$4 = _tmp$4; $f._tmp$40 = _tmp$40; $f._tmp$41 = _tmp$41; $f._tmp$42 = _tmp$42; $f._tmp$43 = _tmp$43; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$10 = _tuple$10; $f._tuple$11 = _tuple$11; $f._tuple$12 = _tuple$12; $f._tuple$13 = _tuple$13; $f._tuple$14 = _tuple$14; $f._tuple$15 = _tuple$15; $f._tuple$16 = _tuple$16; $f._tuple$17 = _tuple$17; $f._tuple$18 = _tuple$18; $f._tuple$19 = _tuple$19; $f._tuple$2 = _tuple$2; $f._tuple$20 = _tuple$20; $f._tuple$21 = _tuple$21; $f._tuple$22 = _tuple$22; $f._tuple$23 = _tuple$23; $f._tuple$24 = _tuple$24; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f._tuple$8 = _tuple$8; $f._tuple$9 = _tuple$9; $f.alayout = alayout; $f.amSet = amSet; $f.avalue = avalue; $f.day = day; $f.defaultLocation = defaultLocation; $f.err = err; $f.hour = hour; $f.hour$1 = hour$1; $f.hr = hr; $f.i = i; $f.layout = layout; $f.local = local; $f.min = min; $f.min$1 = min$1; $f.mm = mm; $f.month = month; $f.n = n; $f.n$1 = n$1; $f.name = name; $f.ndigit = ndigit; $f.nsec = nsec; $f.offset = offset; $f.offset$1 = offset$1; $f.ok = ok; $f.ok$1 = ok$1; $f.p = p; $f.pmSet = pmSet; $f.prefix = prefix; $f.rangeErrString = rangeErrString; $f.sec = sec; $f.seconds = seconds; $f.sign = sign; $f.ss = ss; $f.std = std; $f.stdstr = stdstr; $f.suffix = suffix; $f.t = t; $f.t$1 = t$1; $f.value = value; $f.x$1 = x$1; $f.x$2 = x$2; $f.year = year; $f.z = z; $f.zoneName = zoneName; $f.zoneOffset = zoneOffset; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseTimeZone = function(value) {
|
|
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, c, length, nUpper, ok, ok$1, value;
|
|
length = 0;
|
|
ok = false;
|
|
if (value.length < 3) {
|
|
_tmp = 0;
|
|
_tmp$1 = false;
|
|
length = _tmp;
|
|
ok = _tmp$1;
|
|
return [length, ok];
|
|
}
|
|
if (value.length >= 4 && ($substring(value, 0, 4) === "ChST" || $substring(value, 0, 4) === "MeST")) {
|
|
_tmp$2 = 4;
|
|
_tmp$3 = true;
|
|
length = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [length, ok];
|
|
}
|
|
if ($substring(value, 0, 3) === "GMT") {
|
|
length = parseGMT(value);
|
|
_tmp$4 = length;
|
|
_tmp$5 = true;
|
|
length = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [length, ok];
|
|
}
|
|
if ((value.charCodeAt(0) === 43) || (value.charCodeAt(0) === 45)) {
|
|
length = parseSignedOffset(value);
|
|
ok$1 = length > 0;
|
|
_tmp$6 = length;
|
|
_tmp$7 = ok$1;
|
|
length = _tmp$6;
|
|
ok = _tmp$7;
|
|
return [length, ok];
|
|
}
|
|
nUpper = 0;
|
|
nUpper = 0;
|
|
while (true) {
|
|
if (!(nUpper < 6)) { break; }
|
|
if (nUpper >= value.length) {
|
|
break;
|
|
}
|
|
c = value.charCodeAt(nUpper);
|
|
if (c < 65 || 90 < c) {
|
|
break;
|
|
}
|
|
nUpper = nUpper + (1) >> 0;
|
|
}
|
|
_1 = nUpper;
|
|
if ((_1 === (0)) || (_1 === (1)) || (_1 === (2)) || (_1 === (6))) {
|
|
_tmp$8 = 0;
|
|
_tmp$9 = false;
|
|
length = _tmp$8;
|
|
ok = _tmp$9;
|
|
return [length, ok];
|
|
} else if (_1 === (5)) {
|
|
if (value.charCodeAt(4) === 84) {
|
|
_tmp$10 = 5;
|
|
_tmp$11 = true;
|
|
length = _tmp$10;
|
|
ok = _tmp$11;
|
|
return [length, ok];
|
|
}
|
|
} else if (_1 === (4)) {
|
|
if ((value.charCodeAt(3) === 84) || $substring(value, 0, 4) === "WITA") {
|
|
_tmp$12 = 4;
|
|
_tmp$13 = true;
|
|
length = _tmp$12;
|
|
ok = _tmp$13;
|
|
return [length, ok];
|
|
}
|
|
} else if (_1 === (3)) {
|
|
_tmp$14 = 3;
|
|
_tmp$15 = true;
|
|
length = _tmp$14;
|
|
ok = _tmp$15;
|
|
return [length, ok];
|
|
}
|
|
_tmp$16 = 0;
|
|
_tmp$17 = false;
|
|
length = _tmp$16;
|
|
ok = _tmp$17;
|
|
return [length, ok];
|
|
};
|
|
parseGMT = function(value) {
|
|
var value;
|
|
value = $substring(value, 3);
|
|
if (value.length === 0) {
|
|
return 3;
|
|
}
|
|
return 3 + parseSignedOffset(value) >> 0;
|
|
};
|
|
parseSignedOffset = function(value) {
|
|
var _tuple, err, rem, sign, value, x$1;
|
|
sign = value.charCodeAt(0);
|
|
if (!((sign === 45)) && !((sign === 43))) {
|
|
return 0;
|
|
}
|
|
_tuple = leadingInt($substring(value, 1));
|
|
x$1 = _tuple[0];
|
|
rem = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil)) || $substring(value, 1) === rem) {
|
|
return 0;
|
|
}
|
|
if (sign === 45) {
|
|
x$1 = new $Int64(-x$1.$high, -x$1.$low);
|
|
}
|
|
if ((x$1.$high < -1 || (x$1.$high === -1 && x$1.$low < 4294967273)) || (0 < x$1.$high || (0 === x$1.$high && 23 < x$1.$low))) {
|
|
return 0;
|
|
}
|
|
return value.length - rem.length >> 0;
|
|
};
|
|
parseNanoseconds = function(value, nbytes) {
|
|
var _tuple, err, i, nbytes, ns, rangeErrString, scaleDigits, value;
|
|
ns = 0;
|
|
rangeErrString = "";
|
|
err = $ifaceNil;
|
|
if (!((value.charCodeAt(0) === 46))) {
|
|
err = errBad;
|
|
return [ns, rangeErrString, err];
|
|
}
|
|
_tuple = atoi($substring(value, 1, nbytes));
|
|
ns = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [ns, rangeErrString, err];
|
|
}
|
|
if (ns < 0 || 1000000000 <= ns) {
|
|
rangeErrString = "fractional second";
|
|
return [ns, rangeErrString, err];
|
|
}
|
|
scaleDigits = 10 - nbytes >> 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < scaleDigits)) { break; }
|
|
ns = $imul(ns, (10));
|
|
i = i + (1) >> 0;
|
|
}
|
|
return [ns, rangeErrString, err];
|
|
};
|
|
leadingInt = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, c, err, i, rem, s, x$1, x$2, x$3, x$4;
|
|
x$1 = new $Int64(0, 0);
|
|
rem = "";
|
|
err = $ifaceNil;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
c = s.charCodeAt(i);
|
|
if (c < 48 || c > 57) {
|
|
break;
|
|
}
|
|
if ((x$1.$high > 214748364 || (x$1.$high === 214748364 && x$1.$low > 3435973836))) {
|
|
_tmp = new $Int64(0, 0);
|
|
_tmp$1 = "";
|
|
_tmp$2 = errLeadingInt;
|
|
x$1 = _tmp;
|
|
rem = _tmp$1;
|
|
err = _tmp$2;
|
|
return [x$1, rem, err];
|
|
}
|
|
x$1 = (x$2 = (x$3 = $mul64(x$1, new $Int64(0, 10)), x$4 = (new $Int64(0, c)), new $Int64(x$3.$high + x$4.$high, x$3.$low + x$4.$low)), new $Int64(x$2.$high - 0, x$2.$low - 48));
|
|
if ((x$1.$high < 0 || (x$1.$high === 0 && x$1.$low < 0))) {
|
|
_tmp$3 = new $Int64(0, 0);
|
|
_tmp$4 = "";
|
|
_tmp$5 = errLeadingInt;
|
|
x$1 = _tmp$3;
|
|
rem = _tmp$4;
|
|
err = _tmp$5;
|
|
return [x$1, rem, err];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$6 = x$1;
|
|
_tmp$7 = $substring(s, i);
|
|
_tmp$8 = $ifaceNil;
|
|
x$1 = _tmp$6;
|
|
rem = _tmp$7;
|
|
err = _tmp$8;
|
|
return [x$1, rem, err];
|
|
};
|
|
when = function(d) {
|
|
var d, t, x$1, x$2;
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
|
|
return runtimeNano();
|
|
}
|
|
t = (x$1 = runtimeNano(), x$2 = (new $Int64(d.$high, d.$low)), new $Int64(x$1.$high + x$2.$high, x$1.$low + x$2.$low));
|
|
if ((t.$high < 0 || (t.$high === 0 && t.$low < 0))) {
|
|
t = new $Int64(2147483647, 4294967295);
|
|
}
|
|
return t;
|
|
};
|
|
Timer.ptr.prototype.Stop = function() {
|
|
var t;
|
|
t = this;
|
|
if (t.r.f === $throwNilPointerError) {
|
|
$panic(new $String("time: Stop called on uninitialized Timer"));
|
|
}
|
|
return stopTimer(t.r);
|
|
};
|
|
Timer.prototype.Stop = function() { return this.$val.Stop(); };
|
|
NewTimer = function(d) {
|
|
var c, d, t;
|
|
c = new $Chan(Time, 1);
|
|
t = new Timer.ptr(c, new runtimeTimer.ptr(0, when(d), new $Int64(0, 0), sendTime, new chanType(c), null, false));
|
|
startTimer(t.r);
|
|
return t;
|
|
};
|
|
$pkg.NewTimer = NewTimer;
|
|
Timer.ptr.prototype.Reset = function(d) {
|
|
var active, d, t, w;
|
|
t = this;
|
|
if (t.r.f === $throwNilPointerError) {
|
|
$panic(new $String("time: Reset called on uninitialized Timer"));
|
|
}
|
|
w = when(d);
|
|
active = stopTimer(t.r);
|
|
t.r.when = w;
|
|
startTimer(t.r);
|
|
return active;
|
|
};
|
|
Timer.prototype.Reset = function(d) { return this.$val.Reset(d); };
|
|
sendTime = function(c, seq) {
|
|
var _selection, c, seq, $r;
|
|
/* */ var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _selection = $f._selection; c = $f.c; seq = $f.seq; $r = $f.$r; }
|
|
_selection = $select([[$assertType(c, chanType), $clone(Now(), Time)], []]);
|
|
if (_selection[0] === 0) {
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
/* */ if ($f === undefined) { $f = { $blk: sendTime }; } $f._selection = _selection; $f.c = c; $f.seq = seq; $f.$r = $r; return $f;
|
|
};
|
|
NewTicker = function(d) {
|
|
var c, d, t;
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
|
|
$panic(errors.New("non-positive interval for NewTicker"));
|
|
}
|
|
c = new $Chan(Time, 1);
|
|
t = new Ticker.ptr(c, new runtimeTimer.ptr(0, when(d), (new $Int64(d.$high, d.$low)), sendTime, new chanType(c), null, false));
|
|
startTimer(t.r);
|
|
return t;
|
|
};
|
|
$pkg.NewTicker = NewTicker;
|
|
Ticker.ptr.prototype.Stop = function() {
|
|
var t;
|
|
t = this;
|
|
stopTimer(t.r);
|
|
};
|
|
Ticker.prototype.Stop = function() { return this.$val.Stop(); };
|
|
Time.ptr.prototype.nsec = function() {
|
|
var t, x$1;
|
|
t = this;
|
|
return (((x$1 = t.wall, new $Uint64(x$1.$high & 0, (x$1.$low & 1073741823) >>> 0)).$low >> 0));
|
|
};
|
|
Time.prototype.nsec = function() { return this.$val.nsec(); };
|
|
Time.ptr.prototype.sec = function() {
|
|
var t, x$1, x$2, x$3, x$4;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = t.wall, new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
return (x$3 = ((x$4 = $shiftRightUint64($shiftLeft64(t.wall, 1), 31), new $Int64(x$4.$high, x$4.$low))), new $Int64(13 + x$3.$high, 3618733952 + x$3.$low));
|
|
}
|
|
return t.ext;
|
|
};
|
|
Time.prototype.sec = function() { return this.$val.sec(); };
|
|
Time.ptr.prototype.unixSec = function() {
|
|
var t, x$1;
|
|
t = this;
|
|
return (x$1 = t.sec(), new $Int64(x$1.$high + -15, x$1.$low + 2288912640));
|
|
};
|
|
Time.prototype.unixSec = function() { return this.$val.unixSec(); };
|
|
Time.ptr.prototype.addSec = function(d) {
|
|
var d, dsec, sec, t, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = t.wall, new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
sec = ((x$3 = $shiftRightUint64($shiftLeft64(t.wall, 1), 31), new $Int64(x$3.$high, x$3.$low)));
|
|
dsec = new $Int64(sec.$high + d.$high, sec.$low + d.$low);
|
|
if ((0 < dsec.$high || (0 === dsec.$high && 0 <= dsec.$low)) && (dsec.$high < 1 || (dsec.$high === 1 && dsec.$low <= 4294967295))) {
|
|
t.wall = (x$4 = (x$5 = (x$6 = t.wall, new $Uint64(x$6.$high & 0, (x$6.$low & 1073741823) >>> 0)), x$7 = $shiftLeft64((new $Uint64(dsec.$high, dsec.$low)), 30), new $Uint64(x$5.$high | x$7.$high, (x$5.$low | x$7.$low) >>> 0)), new $Uint64(x$4.$high | 2147483648, (x$4.$low | 0) >>> 0));
|
|
return;
|
|
}
|
|
t.stripMono();
|
|
}
|
|
t.ext = (x$8 = t.ext, x$9 = d, new $Int64(x$8.$high + x$9.$high, x$8.$low + x$9.$low));
|
|
};
|
|
Time.prototype.addSec = function(d) { return this.$val.addSec(d); };
|
|
Time.ptr.prototype.setLoc = function(loc) {
|
|
var loc, t;
|
|
t = this;
|
|
if (loc === utcLoc) {
|
|
loc = ptrType$2.nil;
|
|
}
|
|
t.stripMono();
|
|
t.loc = loc;
|
|
};
|
|
Time.prototype.setLoc = function(loc) { return this.$val.setLoc(loc); };
|
|
Time.ptr.prototype.stripMono = function() {
|
|
var t, x$1, x$2, x$3, x$4;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = t.wall, new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
t.ext = t.sec();
|
|
t.wall = (x$3 = t.wall, x$4 = new $Uint64(0, 1073741823), new $Uint64(x$3.$high & x$4.$high, (x$3.$low & x$4.$low) >>> 0));
|
|
}
|
|
};
|
|
Time.prototype.stripMono = function() { return this.$val.stripMono(); };
|
|
Time.ptr.prototype.After = function(u) {
|
|
var t, ts, u, us, x$1, x$2, x$3, x$4, x$5, x$6;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = (x$3 = t.wall, x$4 = u.wall, new $Uint64(x$3.$high & x$4.$high, (x$3.$low & x$4.$low) >>> 0)), new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
return (x$5 = t.ext, x$6 = u.ext, (x$5.$high > x$6.$high || (x$5.$high === x$6.$high && x$5.$low > x$6.$low)));
|
|
}
|
|
ts = t.sec();
|
|
us = u.sec();
|
|
return (ts.$high > us.$high || (ts.$high === us.$high && ts.$low > us.$low)) || (ts.$high === us.$high && ts.$low === us.$low) && t.nsec() > u.nsec();
|
|
};
|
|
Time.prototype.After = function(u) { return this.$val.After(u); };
|
|
Time.ptr.prototype.Before = function(u) {
|
|
var t, u, x$1, x$10, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = (x$3 = t.wall, x$4 = u.wall, new $Uint64(x$3.$high & x$4.$high, (x$3.$low & x$4.$low) >>> 0)), new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
return (x$5 = t.ext, x$6 = u.ext, (x$5.$high < x$6.$high || (x$5.$high === x$6.$high && x$5.$low < x$6.$low)));
|
|
}
|
|
return (x$7 = t.sec(), x$8 = u.sec(), (x$7.$high < x$8.$high || (x$7.$high === x$8.$high && x$7.$low < x$8.$low))) || (x$9 = t.sec(), x$10 = u.sec(), (x$9.$high === x$10.$high && x$9.$low === x$10.$low)) && t.nsec() < u.nsec();
|
|
};
|
|
Time.prototype.Before = function(u) { return this.$val.Before(u); };
|
|
Time.ptr.prototype.Equal = function(u) {
|
|
var t, u, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = (x$3 = t.wall, x$4 = u.wall, new $Uint64(x$3.$high & x$4.$high, (x$3.$low & x$4.$low) >>> 0)), new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
return (x$5 = t.ext, x$6 = u.ext, (x$5.$high === x$6.$high && x$5.$low === x$6.$low));
|
|
}
|
|
return (x$7 = t.sec(), x$8 = u.sec(), (x$7.$high === x$8.$high && x$7.$low === x$8.$low)) && (t.nsec() === u.nsec());
|
|
};
|
|
Time.prototype.Equal = function(u) { return this.$val.Equal(u); };
|
|
Month.prototype.String = function() {
|
|
var buf, m, n, x$1;
|
|
m = this.$val;
|
|
if (1 <= m && m <= 12) {
|
|
return (x$1 = m - 1 >> 0, ((x$1 < 0 || x$1 >= months.length) ? ($throwRuntimeError("index out of range"), undefined) : months[x$1]));
|
|
}
|
|
buf = $makeSlice(sliceType$3, 20);
|
|
n = fmtInt(buf, (new $Uint64(0, m)));
|
|
return "%!Month(" + ($bytesToString($subslice(buf, n))) + ")";
|
|
};
|
|
$ptrType(Month).prototype.String = function() { return new Month(this.$get()).String(); };
|
|
Weekday.prototype.String = function() {
|
|
var buf, d, n;
|
|
d = this.$val;
|
|
if (0 <= d && d <= 6) {
|
|
return ((d < 0 || d >= days.length) ? ($throwRuntimeError("index out of range"), undefined) : days[d]);
|
|
}
|
|
buf = $makeSlice(sliceType$3, 20);
|
|
n = fmtInt(buf, (new $Uint64(0, d)));
|
|
return "%!Weekday(" + ($bytesToString($subslice(buf, n))) + ")";
|
|
};
|
|
$ptrType(Weekday).prototype.String = function() { return new Weekday(this.$get()).String(); };
|
|
Time.ptr.prototype.IsZero = function() {
|
|
var t, x$1;
|
|
t = this;
|
|
return (x$1 = t.sec(), (x$1.$high === 0 && x$1.$low === 0)) && (t.nsec() === 0);
|
|
};
|
|
Time.prototype.IsZero = function() { return this.$val.IsZero(); };
|
|
Time.ptr.prototype.abs = function() {
|
|
var _r, _r$1, _tuple, l, offset, sec, t, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; l = $f.l; offset = $f.offset; sec = $f.sec; t = $f.t; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
l = t.loc;
|
|
/* */ if (l === ptrType$2.nil || l === localLoc) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (l === ptrType$2.nil || l === localLoc) { */ case 1:
|
|
_r = l.get(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
l = _r;
|
|
/* } */ case 2:
|
|
sec = t.unixSec();
|
|
/* */ if (!(l === utcLoc)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (!(l === utcLoc)) { */ case 4:
|
|
/* */ if (!(l.cacheZone === ptrType.nil) && (x$1 = l.cacheStart, (x$1.$high < sec.$high || (x$1.$high === sec.$high && x$1.$low <= sec.$low))) && (x$2 = l.cacheEnd, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (!(l.cacheZone === ptrType.nil) && (x$1 = l.cacheStart, (x$1.$high < sec.$high || (x$1.$high === sec.$high && x$1.$low <= sec.$low))) && (x$2 = l.cacheEnd, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) { */ case 6:
|
|
sec = (x$3 = (new $Int64(0, l.cacheZone.offset)), new $Int64(sec.$high + x$3.$high, sec.$low + x$3.$low));
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
_r$1 = l.lookup(sec); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
offset = _tuple[1];
|
|
sec = (x$4 = (new $Int64(0, offset)), new $Int64(sec.$high + x$4.$high, sec.$low + x$4.$low));
|
|
/* } */ case 8:
|
|
/* } */ case 5:
|
|
$s = -1; return ((x$5 = new $Int64(sec.$high + 2147483646, sec.$low + 450480384), new $Uint64(x$5.$high, x$5.$low)));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.abs }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.l = l; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.abs = function() { return this.$val.abs(); };
|
|
Time.ptr.prototype.locabs = function() {
|
|
var _r, _r$1, _tuple, abs, l, name, offset, sec, t, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; abs = $f.abs; l = $f.l; name = $f.name; offset = $f.offset; sec = $f.sec; t = $f.t; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
name = "";
|
|
offset = 0;
|
|
abs = new $Uint64(0, 0);
|
|
t = this;
|
|
l = t.loc;
|
|
/* */ if (l === ptrType$2.nil || l === localLoc) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (l === ptrType$2.nil || l === localLoc) { */ case 1:
|
|
_r = l.get(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
l = _r;
|
|
/* } */ case 2:
|
|
sec = t.unixSec();
|
|
/* */ if (!(l === utcLoc)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (!(l === utcLoc)) { */ case 4:
|
|
/* */ if (!(l.cacheZone === ptrType.nil) && (x$1 = l.cacheStart, (x$1.$high < sec.$high || (x$1.$high === sec.$high && x$1.$low <= sec.$low))) && (x$2 = l.cacheEnd, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!(l.cacheZone === ptrType.nil) && (x$1 = l.cacheStart, (x$1.$high < sec.$high || (x$1.$high === sec.$high && x$1.$low <= sec.$low))) && (x$2 = l.cacheEnd, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) { */ case 7:
|
|
name = l.cacheZone.name;
|
|
offset = l.cacheZone.offset;
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
_r$1 = l.lookup(sec); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
name = _tuple[0];
|
|
offset = _tuple[1];
|
|
/* } */ case 9:
|
|
sec = (x$3 = (new $Int64(0, offset)), new $Int64(sec.$high + x$3.$high, sec.$low + x$3.$low));
|
|
$s = 6; continue;
|
|
/* } else { */ case 5:
|
|
name = "UTC";
|
|
/* } */ case 6:
|
|
abs = ((x$4 = new $Int64(sec.$high + 2147483646, sec.$low + 450480384), new $Uint64(x$4.$high, x$4.$low)));
|
|
$s = -1; return [name, offset, abs];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.locabs }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.abs = abs; $f.l = l; $f.name = name; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.locabs = function() { return this.$val.locabs(); };
|
|
Time.ptr.prototype.Date = function() {
|
|
var _r, _tuple, day, month, t, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; day = $f.day; month = $f.month; t = $f.t; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
year = 0;
|
|
month = 0;
|
|
day = 0;
|
|
t = this;
|
|
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
year = _tuple[0];
|
|
month = _tuple[1];
|
|
day = _tuple[2];
|
|
$s = -1; return [year, month, day];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Date }; } $f._r = _r; $f._tuple = _tuple; $f.day = day; $f.month = month; $f.t = t; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Date = function() { return this.$val.Date(); };
|
|
Time.ptr.prototype.Year = function() {
|
|
var _r, _tuple, t, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; t = $f.t; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).date(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
year = _tuple[0];
|
|
$s = -1; return year;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Year }; } $f._r = _r; $f._tuple = _tuple; $f.t = t; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Year = function() { return this.$val.Year(); };
|
|
Time.ptr.prototype.Month = function() {
|
|
var _r, _tuple, month, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; month = $f.month; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
month = _tuple[1];
|
|
$s = -1; return month;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Month }; } $f._r = _r; $f._tuple = _tuple; $f.month = month; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Month = function() { return this.$val.Month(); };
|
|
Time.ptr.prototype.Day = function() {
|
|
var _r, _tuple, day, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; day = $f.day; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
day = _tuple[2];
|
|
$s = -1; return day;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Day }; } $f._r = _r; $f._tuple = _tuple; $f.day = day; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Day = function() { return this.$val.Day(); };
|
|
Time.ptr.prototype.Weekday = function() {
|
|
var _r, _r$1, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = absWeekday(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Weekday }; } $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Weekday = function() { return this.$val.Weekday(); };
|
|
absWeekday = function(abs) {
|
|
var _q, abs, sec;
|
|
sec = $div64((new $Uint64(abs.$high + 0, abs.$low + 86400)), new $Uint64(0, 604800), true);
|
|
return (((_q = ((sec.$low >> 0)) / 86400, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0));
|
|
};
|
|
Time.ptr.prototype.ISOWeek = function() {
|
|
var _q, _r, _r$1, _r$2, _r$3, _r$4, _tuple, day, dec31wday, jan1wday, month, t, wday, week, yday, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; day = $f.day; dec31wday = $f.dec31wday; jan1wday = $f.jan1wday; month = $f.month; t = $f.t; wday = $f.wday; week = $f.week; yday = $f.yday; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
year = 0;
|
|
week = 0;
|
|
t = this;
|
|
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
year = _tuple[0];
|
|
month = _tuple[1];
|
|
day = _tuple[2];
|
|
yday = _tuple[3];
|
|
_r$2 = $clone(t, Time).Weekday(); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
wday = (_r$1 = (((_r$2 + 6 >> 0) >> 0)) % 7, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero"));
|
|
week = (_q = (((yday - wday >> 0) + 7 >> 0)) / 7, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
jan1wday = (_r$3 = (((wday - yday >> 0) + 371 >> 0)) % 7, _r$3 === _r$3 ? _r$3 : $throwRuntimeError("integer divide by zero"));
|
|
if (1 <= jan1wday && jan1wday <= 3) {
|
|
week = week + (1) >> 0;
|
|
}
|
|
if (week === 0) {
|
|
year = year - (1) >> 0;
|
|
week = 52;
|
|
if ((jan1wday === 4) || ((jan1wday === 5) && isLeap(year))) {
|
|
week = week + (1) >> 0;
|
|
}
|
|
}
|
|
if ((month === 12) && day >= 29 && wday < 3) {
|
|
dec31wday = (_r$4 = (((wday + 31 >> 0) - day >> 0)) % 7, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero"));
|
|
if (0 <= dec31wday && dec31wday <= 2) {
|
|
year = year + (1) >> 0;
|
|
week = 1;
|
|
}
|
|
}
|
|
$s = -1; return [year, week];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.ISOWeek }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f.day = day; $f.dec31wday = dec31wday; $f.jan1wday = jan1wday; $f.month = month; $f.t = t; $f.wday = wday; $f.week = week; $f.yday = yday; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.ISOWeek = function() { return this.$val.ISOWeek(); };
|
|
Time.ptr.prototype.Clock = function() {
|
|
var _r, _r$1, _tuple, hour, min, sec, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; hour = $f.hour; min = $f.min; sec = $f.sec; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
hour = 0;
|
|
min = 0;
|
|
sec = 0;
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = absClock(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
hour = _tuple[0];
|
|
min = _tuple[1];
|
|
sec = _tuple[2];
|
|
$s = -1; return [hour, min, sec];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Clock }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.hour = hour; $f.min = min; $f.sec = sec; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Clock = function() { return this.$val.Clock(); };
|
|
absClock = function(abs) {
|
|
var _q, _q$1, abs, hour, min, sec;
|
|
hour = 0;
|
|
min = 0;
|
|
sec = 0;
|
|
sec = (($div64(abs, new $Uint64(0, 86400), true).$low >> 0));
|
|
hour = (_q = sec / 3600, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
sec = sec - (($imul(hour, 3600))) >> 0;
|
|
min = (_q$1 = sec / 60, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
sec = sec - (($imul(min, 60))) >> 0;
|
|
return [hour, min, sec];
|
|
};
|
|
Time.ptr.prototype.Hour = function() {
|
|
var _q, _r, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (_q = (($div64(_r, new $Uint64(0, 86400), true).$low >> 0)) / 3600, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Hour }; } $f._q = _q; $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Hour = function() { return this.$val.Hour(); };
|
|
Time.ptr.prototype.Minute = function() {
|
|
var _q, _r, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (_q = (($div64(_r, new $Uint64(0, 3600), true).$low >> 0)) / 60, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Minute }; } $f._q = _q; $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Minute = function() { return this.$val.Minute(); };
|
|
Time.ptr.prototype.Second = function() {
|
|
var _r, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (($div64(_r, new $Uint64(0, 60), true).$low >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Second }; } $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Second = function() { return this.$val.Second(); };
|
|
Time.ptr.prototype.Nanosecond = function() {
|
|
var t;
|
|
t = this;
|
|
return ((t.nsec() >> 0));
|
|
};
|
|
Time.prototype.Nanosecond = function() { return this.$val.Nanosecond(); };
|
|
Time.ptr.prototype.YearDay = function() {
|
|
var _r, _tuple, t, yday, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; t = $f.t; yday = $f.yday; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).date(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
yday = _tuple[3];
|
|
$s = -1; return yday + 1 >> 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.YearDay }; } $f._r = _r; $f._tuple = _tuple; $f.t = t; $f.yday = yday; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.YearDay = function() { return this.$val.YearDay(); };
|
|
Duration.prototype.String = function() {
|
|
var _tuple, _tuple$1, buf, d, neg, prec, u, w;
|
|
d = this;
|
|
buf = arrayType$3.zero();
|
|
w = 32;
|
|
u = (new $Uint64(d.$high, d.$low));
|
|
neg = (d.$high < 0 || (d.$high === 0 && d.$low < 0));
|
|
if (neg) {
|
|
u = new $Uint64(-u.$high, -u.$low);
|
|
}
|
|
if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000000000))) {
|
|
prec = 0;
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 115);
|
|
w = w - (1) >> 0;
|
|
if ((u.$high === 0 && u.$low === 0)) {
|
|
return "0s";
|
|
} else if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000))) {
|
|
prec = 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 110);
|
|
} else if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000000))) {
|
|
prec = 3;
|
|
w = w - (1) >> 0;
|
|
$copyString($subslice(new sliceType$3(buf), w), "\xC2\xB5");
|
|
} else {
|
|
prec = 6;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 109);
|
|
}
|
|
_tuple = fmtFrac($subslice(new sliceType$3(buf), 0, w), u, prec);
|
|
w = _tuple[0];
|
|
u = _tuple[1];
|
|
w = fmtInt($subslice(new sliceType$3(buf), 0, w), u);
|
|
} else {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 115);
|
|
_tuple$1 = fmtFrac($subslice(new sliceType$3(buf), 0, w), u, 9);
|
|
w = _tuple$1[0];
|
|
u = _tuple$1[1];
|
|
w = fmtInt($subslice(new sliceType$3(buf), 0, w), $div64(u, new $Uint64(0, 60), true));
|
|
u = $div64(u, (new $Uint64(0, 60)), false);
|
|
if ((u.$high > 0 || (u.$high === 0 && u.$low > 0))) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 109);
|
|
w = fmtInt($subslice(new sliceType$3(buf), 0, w), $div64(u, new $Uint64(0, 60), true));
|
|
u = $div64(u, (new $Uint64(0, 60)), false);
|
|
if ((u.$high > 0 || (u.$high === 0 && u.$low > 0))) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 104);
|
|
w = fmtInt($subslice(new sliceType$3(buf), 0, w), u);
|
|
}
|
|
}
|
|
}
|
|
if (neg) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
|
|
}
|
|
return ($bytesToString($subslice(new sliceType$3(buf), w)));
|
|
};
|
|
$ptrType(Duration).prototype.String = function() { return this.$get().String(); };
|
|
fmtFrac = function(buf, v, prec) {
|
|
var _tmp, _tmp$1, buf, digit, i, nv, nw, prec, print, v, w;
|
|
nw = 0;
|
|
nv = new $Uint64(0, 0);
|
|
w = buf.$length;
|
|
print = false;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < prec)) { break; }
|
|
digit = $div64(v, new $Uint64(0, 10), true);
|
|
print = print || !((digit.$high === 0 && digit.$low === 0));
|
|
if (print) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = (((digit.$low << 24 >>> 24)) + 48 << 24 >>> 24));
|
|
}
|
|
v = $div64(v, (new $Uint64(0, 10)), false);
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (print) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 46);
|
|
}
|
|
_tmp = w;
|
|
_tmp$1 = v;
|
|
nw = _tmp;
|
|
nv = _tmp$1;
|
|
return [nw, nv];
|
|
};
|
|
fmtInt = function(buf, v) {
|
|
var buf, v, w;
|
|
w = buf.$length;
|
|
if ((v.$high === 0 && v.$low === 0)) {
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 48);
|
|
} else {
|
|
while (true) {
|
|
if (!((v.$high > 0 || (v.$high === 0 && v.$low > 0)))) { break; }
|
|
w = w - (1) >> 0;
|
|
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = ((($div64(v, new $Uint64(0, 10), true).$low << 24 >>> 24)) + 48 << 24 >>> 24));
|
|
v = $div64(v, (new $Uint64(0, 10)), false);
|
|
}
|
|
}
|
|
return w;
|
|
};
|
|
Duration.prototype.Nanoseconds = function() {
|
|
var d;
|
|
d = this;
|
|
return (new $Int64(d.$high, d.$low));
|
|
};
|
|
$ptrType(Duration).prototype.Nanoseconds = function() { return this.$get().Nanoseconds(); };
|
|
Duration.prototype.Seconds = function() {
|
|
var d, nsec, sec;
|
|
d = this;
|
|
sec = $div64(d, new Duration(0, 1000000000), false);
|
|
nsec = $div64(d, new Duration(0, 1000000000), true);
|
|
return ($flatten64(sec)) + ($flatten64(nsec)) / 1e+09;
|
|
};
|
|
$ptrType(Duration).prototype.Seconds = function() { return this.$get().Seconds(); };
|
|
Duration.prototype.Minutes = function() {
|
|
var d, min, nsec;
|
|
d = this;
|
|
min = $div64(d, new Duration(13, 4165425152), false);
|
|
nsec = $div64(d, new Duration(13, 4165425152), true);
|
|
return ($flatten64(min)) + ($flatten64(nsec)) / 6e+10;
|
|
};
|
|
$ptrType(Duration).prototype.Minutes = function() { return this.$get().Minutes(); };
|
|
Duration.prototype.Hours = function() {
|
|
var d, hour, nsec;
|
|
d = this;
|
|
hour = $div64(d, new Duration(838, 817405952), false);
|
|
nsec = $div64(d, new Duration(838, 817405952), true);
|
|
return ($flatten64(hour)) + ($flatten64(nsec)) / 3.6e+12;
|
|
};
|
|
$ptrType(Duration).prototype.Hours = function() { return this.$get().Hours(); };
|
|
Duration.prototype.Truncate = function(m) {
|
|
var d, m, x$1;
|
|
d = this;
|
|
if ((m.$high < 0 || (m.$high === 0 && m.$low <= 0))) {
|
|
return d;
|
|
}
|
|
return (x$1 = $div64(d, m, true), new Duration(d.$high - x$1.$high, d.$low - x$1.$low));
|
|
};
|
|
$ptrType(Duration).prototype.Truncate = function(m) { return this.$get().Truncate(m); };
|
|
lessThanHalf = function(x$1, y) {
|
|
var x$1, x$2, x$3, x$4, x$5, y;
|
|
return (x$2 = (x$3 = (new $Uint64(x$1.$high, x$1.$low)), x$4 = (new $Uint64(x$1.$high, x$1.$low)), new $Uint64(x$3.$high + x$4.$high, x$3.$low + x$4.$low)), x$5 = (new $Uint64(y.$high, y.$low)), (x$2.$high < x$5.$high || (x$2.$high === x$5.$high && x$2.$low < x$5.$low)));
|
|
};
|
|
Duration.prototype.Round = function(m) {
|
|
var d, d1, d1$1, m, r, x$1, x$2;
|
|
d = this;
|
|
if ((m.$high < 0 || (m.$high === 0 && m.$low <= 0))) {
|
|
return d;
|
|
}
|
|
r = $div64(d, m, true);
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0))) {
|
|
r = new Duration(-r.$high, -r.$low);
|
|
if (lessThanHalf(r, m)) {
|
|
return new Duration(d.$high + r.$high, d.$low + r.$low);
|
|
}
|
|
d1 = (x$1 = new Duration(d.$high - m.$high, d.$low - m.$low), new Duration(x$1.$high + r.$high, x$1.$low + r.$low));
|
|
if ((d1.$high < d.$high || (d1.$high === d.$high && d1.$low < d.$low))) {
|
|
return d1;
|
|
}
|
|
return new Duration(-2147483648, 0);
|
|
}
|
|
if (lessThanHalf(r, m)) {
|
|
return new Duration(d.$high - r.$high, d.$low - r.$low);
|
|
}
|
|
d1$1 = (x$2 = new Duration(d.$high + m.$high, d.$low + m.$low), new Duration(x$2.$high - r.$high, x$2.$low - r.$low));
|
|
if ((d1$1.$high > d.$high || (d1$1.$high === d.$high && d1$1.$low > d.$low))) {
|
|
return d1$1;
|
|
}
|
|
return new Duration(2147483647, 4294967295);
|
|
};
|
|
$ptrType(Duration).prototype.Round = function(m) { return this.$get().Round(m); };
|
|
Time.ptr.prototype.Add = function(d) {
|
|
var d, dsec, nsec, t, te, x$1, x$10, x$11, x$12, x$13, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
t = this;
|
|
dsec = ((x$1 = $div64(d, new Duration(0, 1000000000), false), new $Int64(x$1.$high, x$1.$low)));
|
|
nsec = t.nsec() + (((x$2 = $div64(d, new Duration(0, 1000000000), true), x$2.$low + ((x$2.$high >> 31) * 4294967296)) >> 0)) >> 0;
|
|
if (nsec >= 1000000000) {
|
|
dsec = (x$3 = new $Int64(0, 1), new $Int64(dsec.$high + x$3.$high, dsec.$low + x$3.$low));
|
|
nsec = nsec - (1000000000) >> 0;
|
|
} else if (nsec < 0) {
|
|
dsec = (x$4 = new $Int64(0, 1), new $Int64(dsec.$high - x$4.$high, dsec.$low - x$4.$low));
|
|
nsec = nsec + (1000000000) >> 0;
|
|
}
|
|
t.wall = (x$5 = (x$6 = t.wall, new $Uint64(x$6.$high & ~0, (x$6.$low & ~1073741823) >>> 0)), x$7 = (new $Uint64(0, nsec)), new $Uint64(x$5.$high | x$7.$high, (x$5.$low | x$7.$low) >>> 0));
|
|
t.addSec(dsec);
|
|
if (!((x$8 = (x$9 = t.wall, new $Uint64(x$9.$high & 2147483648, (x$9.$low & 0) >>> 0)), (x$8.$high === 0 && x$8.$low === 0)))) {
|
|
te = (x$10 = t.ext, x$11 = (new $Int64(d.$high, d.$low)), new $Int64(x$10.$high + x$11.$high, x$10.$low + x$11.$low));
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0)) && (x$12 = t.ext, (te.$high > x$12.$high || (te.$high === x$12.$high && te.$low > x$12.$low))) || (d.$high > 0 || (d.$high === 0 && d.$low > 0)) && (x$13 = t.ext, (te.$high < x$13.$high || (te.$high === x$13.$high && te.$low < x$13.$low)))) {
|
|
t.stripMono();
|
|
} else {
|
|
t.ext = te;
|
|
}
|
|
}
|
|
return t;
|
|
};
|
|
Time.prototype.Add = function(d) { return this.$val.Add(d); };
|
|
Time.ptr.prototype.Sub = function(u) {
|
|
var d, d$1, t, te, u, ue, x$1, x$10, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
t = this;
|
|
if (!((x$1 = (x$2 = (x$3 = t.wall, x$4 = u.wall, new $Uint64(x$3.$high & x$4.$high, (x$3.$low & x$4.$low) >>> 0)), new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
te = t.ext;
|
|
ue = u.ext;
|
|
d = ((x$5 = new $Int64(te.$high - ue.$high, te.$low - ue.$low), new Duration(x$5.$high, x$5.$low)));
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0)) && (te.$high > ue.$high || (te.$high === ue.$high && te.$low > ue.$low))) {
|
|
return new Duration(2147483647, 4294967295);
|
|
}
|
|
if ((d.$high > 0 || (d.$high === 0 && d.$low > 0)) && (te.$high < ue.$high || (te.$high === ue.$high && te.$low < ue.$low))) {
|
|
return new Duration(-2147483648, 0);
|
|
}
|
|
return d;
|
|
}
|
|
d$1 = (x$6 = $mul64(((x$7 = (x$8 = t.sec(), x$9 = u.sec(), new $Int64(x$8.$high - x$9.$high, x$8.$low - x$9.$low)), new Duration(x$7.$high, x$7.$low))), new Duration(0, 1000000000)), x$10 = (new Duration(0, (t.nsec() - u.nsec() >> 0))), new Duration(x$6.$high + x$10.$high, x$6.$low + x$10.$low));
|
|
if ($clone($clone(u, Time).Add(d$1), Time).Equal($clone(t, Time))) {
|
|
return d$1;
|
|
} else if ($clone(t, Time).Before($clone(u, Time))) {
|
|
return new Duration(-2147483648, 0);
|
|
} else {
|
|
return new Duration(2147483647, 4294967295);
|
|
}
|
|
};
|
|
Time.prototype.Sub = function(u) { return this.$val.Sub(u); };
|
|
Until = function(t) {
|
|
var now$1, t, x$1, x$2, x$3;
|
|
now$1 = new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil);
|
|
if (!((x$1 = (x$2 = t.wall, new $Uint64(x$2.$high & 2147483648, (x$2.$low & 0) >>> 0)), (x$1.$high === 0 && x$1.$low === 0)))) {
|
|
Time.copy(now$1, new Time.ptr(new $Uint64(2147483648, 0), (x$3 = runtimeNano(), new $Int64(x$3.$high - startNano.$high, x$3.$low - startNano.$low)), ptrType$2.nil));
|
|
} else {
|
|
Time.copy(now$1, Now());
|
|
}
|
|
return $clone(t, Time).Sub($clone(now$1, Time));
|
|
};
|
|
$pkg.Until = Until;
|
|
Time.ptr.prototype.AddDate = function(years, months$1, days$1) {
|
|
var _r, _r$1, _r$2, _tuple, _tuple$1, day, days$1, hour, min, month, months$1, sec, t, year, years, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; day = $f.day; days$1 = $f.days$1; hour = $f.hour; min = $f.min; month = $f.month; months$1 = $f.months$1; sec = $f.sec; t = $f.t; year = $f.year; years = $f.years; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).Date(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
year = _tuple[0];
|
|
month = _tuple[1];
|
|
day = _tuple[2];
|
|
_r$1 = $clone(t, Time).Clock(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
hour = _tuple$1[0];
|
|
min = _tuple$1[1];
|
|
sec = _tuple$1[2];
|
|
_r$2 = Date(year + years >> 0, month + ((months$1 >> 0)) >> 0, day + days$1 >> 0, hour, min, sec, ((t.nsec() >> 0)), $clone(t, Time).Location()); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.AddDate }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.day = day; $f.days$1 = days$1; $f.hour = hour; $f.min = min; $f.month = month; $f.months$1 = months$1; $f.sec = sec; $f.t = t; $f.year = year; $f.years = years; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.AddDate = function(years, months$1, days$1) { return this.$val.AddDate(years, months$1, days$1); };
|
|
Time.ptr.prototype.date = function(full) {
|
|
var _r, _r$1, _tuple, day, full, month, t, yday, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; day = $f.day; full = $f.full; month = $f.month; t = $f.t; yday = $f.yday; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
year = 0;
|
|
month = 0;
|
|
day = 0;
|
|
yday = 0;
|
|
t = this;
|
|
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = absDate(_r, full); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
year = _tuple[0];
|
|
month = _tuple[1];
|
|
day = _tuple[2];
|
|
yday = _tuple[3];
|
|
$s = -1; return [year, month, day, yday];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.date }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.day = day; $f.full = full; $f.month = month; $f.t = t; $f.yday = yday; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.date = function(full) { return this.$val.date(full); };
|
|
absDate = function(abs, full) {
|
|
var _q, abs, begin, d, day, end, full, month, n, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, y, yday, year;
|
|
year = 0;
|
|
month = 0;
|
|
day = 0;
|
|
yday = 0;
|
|
d = $div64(abs, new $Uint64(0, 86400), false);
|
|
n = $div64(d, new $Uint64(0, 146097), false);
|
|
y = $mul64(new $Uint64(0, 400), n);
|
|
d = (x$1 = $mul64(new $Uint64(0, 146097), n), new $Uint64(d.$high - x$1.$high, d.$low - x$1.$low));
|
|
n = $div64(d, new $Uint64(0, 36524), false);
|
|
n = (x$2 = $shiftRightUint64(n, 2), new $Uint64(n.$high - x$2.$high, n.$low - x$2.$low));
|
|
y = (x$3 = $mul64(new $Uint64(0, 100), n), new $Uint64(y.$high + x$3.$high, y.$low + x$3.$low));
|
|
d = (x$4 = $mul64(new $Uint64(0, 36524), n), new $Uint64(d.$high - x$4.$high, d.$low - x$4.$low));
|
|
n = $div64(d, new $Uint64(0, 1461), false);
|
|
y = (x$5 = $mul64(new $Uint64(0, 4), n), new $Uint64(y.$high + x$5.$high, y.$low + x$5.$low));
|
|
d = (x$6 = $mul64(new $Uint64(0, 1461), n), new $Uint64(d.$high - x$6.$high, d.$low - x$6.$low));
|
|
n = $div64(d, new $Uint64(0, 365), false);
|
|
n = (x$7 = $shiftRightUint64(n, 2), new $Uint64(n.$high - x$7.$high, n.$low - x$7.$low));
|
|
y = (x$8 = n, new $Uint64(y.$high + x$8.$high, y.$low + x$8.$low));
|
|
d = (x$9 = $mul64(new $Uint64(0, 365), n), new $Uint64(d.$high - x$9.$high, d.$low - x$9.$low));
|
|
year = (((x$10 = (x$11 = (new $Int64(y.$high, y.$low)), new $Int64(x$11.$high + -69, x$11.$low + 4075721025)), x$10.$low + ((x$10.$high >> 31) * 4294967296)) >> 0));
|
|
yday = ((d.$low >> 0));
|
|
if (!full) {
|
|
return [year, month, day, yday];
|
|
}
|
|
day = yday;
|
|
if (isLeap(year)) {
|
|
if (day > 59) {
|
|
day = day - (1) >> 0;
|
|
} else if ((day === 59)) {
|
|
month = 2;
|
|
day = 29;
|
|
return [year, month, day, yday];
|
|
}
|
|
}
|
|
month = (((_q = day / 31, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0));
|
|
end = (((x$12 = month + 1 >> 0, ((x$12 < 0 || x$12 >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x$12])) >> 0));
|
|
begin = 0;
|
|
if (day >= end) {
|
|
month = month + (1) >> 0;
|
|
begin = end;
|
|
} else {
|
|
begin = ((((month < 0 || month >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[month]) >> 0));
|
|
}
|
|
month = month + (1) >> 0;
|
|
day = (day - begin >> 0) + 1 >> 0;
|
|
return [year, month, day, yday];
|
|
};
|
|
daysIn = function(m, year) {
|
|
var m, x$1, year;
|
|
if ((m === 2) && isLeap(year)) {
|
|
return 29;
|
|
}
|
|
return (((((m < 0 || m >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[m]) - (x$1 = m - 1 >> 0, ((x$1 < 0 || x$1 >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x$1])) >> 0) >> 0));
|
|
};
|
|
Now = function() {
|
|
var _tuple, mono, nsec, sec, x$1, x$2, x$3, x$4, x$5, x$6;
|
|
_tuple = now();
|
|
sec = _tuple[0];
|
|
nsec = _tuple[1];
|
|
mono = _tuple[2];
|
|
mono = (x$1 = startNano, new $Int64(mono.$high - x$1.$high, mono.$low - x$1.$low));
|
|
sec = (x$2 = new $Int64(0, 2682288000), new $Int64(sec.$high + x$2.$high, sec.$low + x$2.$low));
|
|
if (!((x$3 = $shiftRightUint64((new $Uint64(sec.$high, sec.$low)), 33), (x$3.$high === 0 && x$3.$low === 0)))) {
|
|
return new Time.ptr((new $Uint64(0, nsec)), new $Int64(sec.$high + 13, sec.$low + 3618733952), $pkg.Local);
|
|
}
|
|
return new Time.ptr((x$4 = (x$5 = $shiftLeft64((new $Uint64(sec.$high, sec.$low)), 30), new $Uint64(2147483648 | x$5.$high, (0 | x$5.$low) >>> 0)), x$6 = (new $Uint64(0, nsec)), new $Uint64(x$4.$high | x$6.$high, (x$4.$low | x$6.$low) >>> 0)), mono, $pkg.Local);
|
|
};
|
|
$pkg.Now = Now;
|
|
unixTime = function(sec, nsec) {
|
|
var nsec, sec;
|
|
return new Time.ptr((new $Uint64(0, nsec)), new $Int64(sec.$high + 14, sec.$low + 2006054656), $pkg.Local);
|
|
};
|
|
Time.ptr.prototype.UTC = function() {
|
|
var t;
|
|
t = this;
|
|
t.setLoc(utcLoc);
|
|
return t;
|
|
};
|
|
Time.prototype.UTC = function() { return this.$val.UTC(); };
|
|
Time.ptr.prototype.Local = function() {
|
|
var t;
|
|
t = this;
|
|
t.setLoc($pkg.Local);
|
|
return t;
|
|
};
|
|
Time.prototype.Local = function() { return this.$val.Local(); };
|
|
Time.ptr.prototype.In = function(loc) {
|
|
var loc, t;
|
|
t = this;
|
|
if (loc === ptrType$2.nil) {
|
|
$panic(new $String("time: missing Location in call to Time.In"));
|
|
}
|
|
t.setLoc(loc);
|
|
return t;
|
|
};
|
|
Time.prototype.In = function(loc) { return this.$val.In(loc); };
|
|
Time.ptr.prototype.Location = function() {
|
|
var l, t;
|
|
t = this;
|
|
l = t.loc;
|
|
if (l === ptrType$2.nil) {
|
|
l = $pkg.UTC;
|
|
}
|
|
return l;
|
|
};
|
|
Time.prototype.Location = function() { return this.$val.Location(); };
|
|
Time.ptr.prototype.Zone = function() {
|
|
var _r, _tuple, name, offset, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; name = $f.name; offset = $f.offset; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
name = "";
|
|
offset = 0;
|
|
t = this;
|
|
_r = t.loc.lookup(t.unixSec()); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
name = _tuple[0];
|
|
offset = _tuple[1];
|
|
$s = -1; return [name, offset];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Zone }; } $f._r = _r; $f._tuple = _tuple; $f.name = name; $f.offset = offset; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.Zone = function() { return this.$val.Zone(); };
|
|
Time.ptr.prototype.Unix = function() {
|
|
var t;
|
|
t = this;
|
|
return t.unixSec();
|
|
};
|
|
Time.prototype.Unix = function() { return this.$val.Unix(); };
|
|
Time.ptr.prototype.UnixNano = function() {
|
|
var t, x$1, x$2;
|
|
t = this;
|
|
return (x$1 = $mul64((t.unixSec()), new $Int64(0, 1000000000)), x$2 = (new $Int64(0, t.nsec())), new $Int64(x$1.$high + x$2.$high, x$1.$low + x$2.$low));
|
|
};
|
|
Time.prototype.UnixNano = function() { return this.$val.UnixNano(); };
|
|
Time.ptr.prototype.MarshalBinary = function() {
|
|
var _q, _r, _r$1, _tuple, enc, nsec, offset, offsetMin, sec, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; enc = $f.enc; nsec = $f.nsec; offset = $f.offset; offsetMin = $f.offsetMin; sec = $f.sec; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
offsetMin = 0;
|
|
/* */ if ($clone(t, Time).Location() === $pkg.UTC) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ($clone(t, Time).Location() === $pkg.UTC) { */ case 1:
|
|
offsetMin = -1;
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
_r = $clone(t, Time).Zone(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
offset = _tuple[1];
|
|
if (!(((_r$1 = offset % 60, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0))) {
|
|
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalBinary: zone offset has fractional minute")];
|
|
}
|
|
offset = (_q = offset / (60), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
if (offset < -32768 || (offset === -1) || offset > 32767) {
|
|
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalBinary: unexpected zone offset")];
|
|
}
|
|
offsetMin = ((offset << 16 >> 16));
|
|
/* } */ case 3:
|
|
sec = t.sec();
|
|
nsec = t.nsec();
|
|
enc = new sliceType$3([1, (($shiftRightInt64(sec, 56).$low << 24 >>> 24)), (($shiftRightInt64(sec, 48).$low << 24 >>> 24)), (($shiftRightInt64(sec, 40).$low << 24 >>> 24)), (($shiftRightInt64(sec, 32).$low << 24 >>> 24)), (($shiftRightInt64(sec, 24).$low << 24 >>> 24)), (($shiftRightInt64(sec, 16).$low << 24 >>> 24)), (($shiftRightInt64(sec, 8).$low << 24 >>> 24)), ((sec.$low << 24 >>> 24)), (((nsec >> 24 >> 0) << 24 >>> 24)), (((nsec >> 16 >> 0) << 24 >>> 24)), (((nsec >> 8 >> 0) << 24 >>> 24)), ((nsec << 24 >>> 24)), (((offsetMin >> 8 << 16 >> 16) << 24 >>> 24)), ((offsetMin << 24 >>> 24))]);
|
|
$s = -1; return [enc, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalBinary }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.enc = enc; $f.nsec = nsec; $f.offset = offset; $f.offsetMin = offsetMin; $f.sec = sec; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.MarshalBinary = function() { return this.$val.MarshalBinary(); };
|
|
Time.ptr.prototype.UnmarshalBinary = function(data) {
|
|
var _r, _tuple, buf, data, localoff, nsec, offset, sec, t, x$1, x$10, x$11, x$12, x$13, x$14, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; buf = $f.buf; data = $f.data; localoff = $f.localoff; nsec = $f.nsec; offset = $f.offset; sec = $f.sec; t = $f.t; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
buf = data;
|
|
if (buf.$length === 0) {
|
|
$s = -1; return errors.New("Time.UnmarshalBinary: no data");
|
|
}
|
|
if (!(((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) === 1))) {
|
|
$s = -1; return errors.New("Time.UnmarshalBinary: unsupported version");
|
|
}
|
|
if (!((buf.$length === 15))) {
|
|
$s = -1; return errors.New("Time.UnmarshalBinary: invalid length");
|
|
}
|
|
buf = $subslice(buf, 1);
|
|
sec = (x$1 = (x$2 = (x$3 = (x$4 = (x$5 = (x$6 = (x$7 = (new $Int64(0, (7 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 7]))), x$8 = $shiftLeft64((new $Int64(0, (6 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 6]))), 8), new $Int64(x$7.$high | x$8.$high, (x$7.$low | x$8.$low) >>> 0)), x$9 = $shiftLeft64((new $Int64(0, (5 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 5]))), 16), new $Int64(x$6.$high | x$9.$high, (x$6.$low | x$9.$low) >>> 0)), x$10 = $shiftLeft64((new $Int64(0, (4 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 4]))), 24), new $Int64(x$5.$high | x$10.$high, (x$5.$low | x$10.$low) >>> 0)), x$11 = $shiftLeft64((new $Int64(0, (3 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 3]))), 32), new $Int64(x$4.$high | x$11.$high, (x$4.$low | x$11.$low) >>> 0)), x$12 = $shiftLeft64((new $Int64(0, (2 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 2]))), 40), new $Int64(x$3.$high | x$12.$high, (x$3.$low | x$12.$low) >>> 0)), x$13 = $shiftLeft64((new $Int64(0, (1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]))), 48), new $Int64(x$2.$high | x$13.$high, (x$2.$low | x$13.$low) >>> 0)), x$14 = $shiftLeft64((new $Int64(0, (0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]))), 56), new $Int64(x$1.$high | x$14.$high, (x$1.$low | x$14.$low) >>> 0));
|
|
buf = $subslice(buf, 8);
|
|
nsec = (((((3 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 3]) >> 0)) | ((((2 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 2]) >> 0)) << 8 >> 0)) | ((((1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]) >> 0)) << 16 >> 0)) | ((((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) >> 0)) << 24 >> 0);
|
|
buf = $subslice(buf, 4);
|
|
offset = $imul(((((((1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]) << 16 >> 16)) | ((((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) << 16 >> 16)) << 8 << 16 >> 16)) >> 0)), 60);
|
|
Time.copy(t, new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil));
|
|
t.wall = (new $Uint64(0, nsec));
|
|
t.ext = sec;
|
|
/* */ if (offset === -60) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (offset === -60) { */ case 1:
|
|
t.setLoc(utcLoc);
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
_r = $pkg.Local.lookup(t.unixSec()); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
localoff = _tuple[1];
|
|
if (offset === localoff) {
|
|
t.setLoc($pkg.Local);
|
|
} else {
|
|
t.setLoc(FixedZone("", offset));
|
|
}
|
|
/* } */ case 3:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalBinary }; } $f._r = _r; $f._tuple = _tuple; $f.buf = buf; $f.data = data; $f.localoff = localoff; $f.nsec = nsec; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.UnmarshalBinary = function(data) { return this.$val.UnmarshalBinary(data); };
|
|
Time.ptr.prototype.GobEncode = function() {
|
|
var _r, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).MarshalBinary(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.GobEncode }; } $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.GobEncode = function() { return this.$val.GobEncode(); };
|
|
Time.ptr.prototype.GobDecode = function(data) {
|
|
var _r, data, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; data = $f.data; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = t.UnmarshalBinary(data); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.GobDecode }; } $f._r = _r; $f.data = data; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.GobDecode = function(data) { return this.$val.GobDecode(data); };
|
|
Time.ptr.prototype.MarshalJSON = function() {
|
|
var _r, _r$1, b, t, y, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; b = $f.b; t = $f.t; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).Year(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
y = _r;
|
|
if (y < 0 || y >= 10000) {
|
|
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]")];
|
|
}
|
|
b = $makeSlice(sliceType$3, 0, 37);
|
|
b = $append(b, 34);
|
|
_r$1 = $clone(t, Time).AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00"); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
b = _r$1;
|
|
b = $append(b, 34);
|
|
$s = -1; return [b, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalJSON }; } $f._r = _r; $f._r$1 = _r$1; $f.b = b; $f.t = t; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.MarshalJSON = function() { return this.$val.MarshalJSON(); };
|
|
Time.ptr.prototype.UnmarshalJSON = function(data) {
|
|
var _r, _tuple, data, err, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; data = $f.data; err = $f.err; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
if (($bytesToString(data)) === "null") {
|
|
$s = -1; return $ifaceNil;
|
|
}
|
|
err = $ifaceNil;
|
|
_r = Parse("\"2006-01-02T15:04:05Z07:00\"", ($bytesToString(data))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
Time.copy(t, _tuple[0]);
|
|
err = _tuple[1];
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalJSON }; } $f._r = _r; $f._tuple = _tuple; $f.data = data; $f.err = err; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.UnmarshalJSON = function(data) { return this.$val.UnmarshalJSON(data); };
|
|
Time.ptr.prototype.MarshalText = function() {
|
|
var _r, _r$1, b, t, y, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; b = $f.b; t = $f.t; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
_r = $clone(t, Time).Year(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
y = _r;
|
|
if (y < 0 || y >= 10000) {
|
|
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalText: year outside of range [0,9999]")];
|
|
}
|
|
b = $makeSlice(sliceType$3, 0, 35);
|
|
_r$1 = $clone(t, Time).AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00"); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return [_r$1, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalText }; } $f._r = _r; $f._r$1 = _r$1; $f.b = b; $f.t = t; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.MarshalText = function() { return this.$val.MarshalText(); };
|
|
Time.ptr.prototype.UnmarshalText = function(data) {
|
|
var _r, _tuple, data, err, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; data = $f.data; err = $f.err; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this;
|
|
err = $ifaceNil;
|
|
_r = Parse("2006-01-02T15:04:05Z07:00", ($bytesToString(data))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
Time.copy(t, _tuple[0]);
|
|
err = _tuple[1];
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalText }; } $f._r = _r; $f._tuple = _tuple; $f.data = data; $f.err = err; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Time.prototype.UnmarshalText = function(data) { return this.$val.UnmarshalText(data); };
|
|
Unix = function(sec, nsec) {
|
|
var n, nsec, sec, x$1, x$2, x$3, x$4;
|
|
if ((nsec.$high < 0 || (nsec.$high === 0 && nsec.$low < 0)) || (nsec.$high > 0 || (nsec.$high === 0 && nsec.$low >= 1000000000))) {
|
|
n = $div64(nsec, new $Int64(0, 1000000000), false);
|
|
sec = (x$1 = n, new $Int64(sec.$high + x$1.$high, sec.$low + x$1.$low));
|
|
nsec = (x$2 = $mul64(n, new $Int64(0, 1000000000)), new $Int64(nsec.$high - x$2.$high, nsec.$low - x$2.$low));
|
|
if ((nsec.$high < 0 || (nsec.$high === 0 && nsec.$low < 0))) {
|
|
nsec = (x$3 = new $Int64(0, 1000000000), new $Int64(nsec.$high + x$3.$high, nsec.$low + x$3.$low));
|
|
sec = (x$4 = new $Int64(0, 1), new $Int64(sec.$high - x$4.$high, sec.$low - x$4.$low));
|
|
}
|
|
}
|
|
return unixTime(sec, (((nsec.$low + ((nsec.$high >> 31) * 4294967296)) >> 0)));
|
|
};
|
|
$pkg.Unix = Unix;
|
|
isLeap = function(year) {
|
|
var _r, _r$1, _r$2, year;
|
|
return ((_r = year % 4, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0) && (!(((_r$1 = year % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0)) || ((_r$2 = year % 400, _r$2 === _r$2 ? _r$2 : $throwRuntimeError("integer divide by zero")) === 0));
|
|
};
|
|
norm = function(hi, lo, base) {
|
|
var _q, _q$1, _tmp, _tmp$1, base, hi, lo, n, n$1, nhi, nlo;
|
|
nhi = 0;
|
|
nlo = 0;
|
|
if (lo < 0) {
|
|
n = (_q = ((-lo - 1 >> 0)) / base, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0;
|
|
hi = hi - (n) >> 0;
|
|
lo = lo + (($imul(n, base))) >> 0;
|
|
}
|
|
if (lo >= base) {
|
|
n$1 = (_q$1 = lo / base, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
hi = hi + (n$1) >> 0;
|
|
lo = lo - (($imul(n$1, base))) >> 0;
|
|
}
|
|
_tmp = hi;
|
|
_tmp$1 = lo;
|
|
nhi = _tmp;
|
|
nlo = _tmp$1;
|
|
return [nhi, nlo];
|
|
};
|
|
Date = function(year, month, day, hour, min, sec, nsec, loc) {
|
|
var _r, _r$1, _r$2, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, abs, d, day, end, hour, loc, m, min, month, n, nsec, offset, sec, start, t, unix, utc, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, y, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; abs = $f.abs; d = $f.d; day = $f.day; end = $f.end; hour = $f.hour; loc = $f.loc; m = $f.m; min = $f.min; month = $f.month; n = $f.n; nsec = $f.nsec; offset = $f.offset; sec = $f.sec; start = $f.start; t = $f.t; unix = $f.unix; utc = $f.utc; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$15 = $f.x$15; x$16 = $f.x$16; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; y = $f.y; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (loc === ptrType$2.nil) {
|
|
$panic(new $String("time: missing Location in call to Date"));
|
|
}
|
|
m = ((month >> 0)) - 1 >> 0;
|
|
_tuple = norm(year, m, 12);
|
|
year = _tuple[0];
|
|
m = _tuple[1];
|
|
month = ((m >> 0)) + 1 >> 0;
|
|
_tuple$1 = norm(sec, nsec, 1000000000);
|
|
sec = _tuple$1[0];
|
|
nsec = _tuple$1[1];
|
|
_tuple$2 = norm(min, sec, 60);
|
|
min = _tuple$2[0];
|
|
sec = _tuple$2[1];
|
|
_tuple$3 = norm(hour, min, 60);
|
|
hour = _tuple$3[0];
|
|
min = _tuple$3[1];
|
|
_tuple$4 = norm(day, hour, 24);
|
|
day = _tuple$4[0];
|
|
hour = _tuple$4[1];
|
|
y = ((x$1 = (x$2 = (new $Int64(0, year)), new $Int64(x$2.$high - -69, x$2.$low - 4075721025)), new $Uint64(x$1.$high, x$1.$low)));
|
|
n = $div64(y, new $Uint64(0, 400), false);
|
|
y = (x$3 = $mul64(new $Uint64(0, 400), n), new $Uint64(y.$high - x$3.$high, y.$low - x$3.$low));
|
|
d = $mul64(new $Uint64(0, 146097), n);
|
|
n = $div64(y, new $Uint64(0, 100), false);
|
|
y = (x$4 = $mul64(new $Uint64(0, 100), n), new $Uint64(y.$high - x$4.$high, y.$low - x$4.$low));
|
|
d = (x$5 = $mul64(new $Uint64(0, 36524), n), new $Uint64(d.$high + x$5.$high, d.$low + x$5.$low));
|
|
n = $div64(y, new $Uint64(0, 4), false);
|
|
y = (x$6 = $mul64(new $Uint64(0, 4), n), new $Uint64(y.$high - x$6.$high, y.$low - x$6.$low));
|
|
d = (x$7 = $mul64(new $Uint64(0, 1461), n), new $Uint64(d.$high + x$7.$high, d.$low + x$7.$low));
|
|
n = y;
|
|
d = (x$8 = $mul64(new $Uint64(0, 365), n), new $Uint64(d.$high + x$8.$high, d.$low + x$8.$low));
|
|
d = (x$9 = (new $Uint64(0, (x$10 = month - 1 >> 0, ((x$10 < 0 || x$10 >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x$10])))), new $Uint64(d.$high + x$9.$high, d.$low + x$9.$low));
|
|
if (isLeap(year) && month >= 3) {
|
|
d = (x$11 = new $Uint64(0, 1), new $Uint64(d.$high + x$11.$high, d.$low + x$11.$low));
|
|
}
|
|
d = (x$12 = (new $Uint64(0, (day - 1 >> 0))), new $Uint64(d.$high + x$12.$high, d.$low + x$12.$low));
|
|
abs = $mul64(d, new $Uint64(0, 86400));
|
|
abs = (x$13 = (new $Uint64(0, ((($imul(hour, 3600)) + ($imul(min, 60)) >> 0) + sec >> 0))), new $Uint64(abs.$high + x$13.$high, abs.$low + x$13.$low));
|
|
unix = (x$14 = (new $Int64(abs.$high, abs.$low)), new $Int64(x$14.$high + -2147483647, x$14.$low + 3844486912));
|
|
_r = loc.lookup(unix); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$5 = _r;
|
|
offset = _tuple$5[1];
|
|
start = _tuple$5[2];
|
|
end = _tuple$5[3];
|
|
/* */ if (!((offset === 0))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((offset === 0))) { */ case 2:
|
|
utc = (x$15 = (new $Int64(0, offset)), new $Int64(unix.$high - x$15.$high, unix.$low - x$15.$low));
|
|
/* */ if ((utc.$high < start.$high || (utc.$high === start.$high && utc.$low < start.$low))) { $s = 5; continue; }
|
|
/* */ if ((utc.$high > end.$high || (utc.$high === end.$high && utc.$low >= end.$low))) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if ((utc.$high < start.$high || (utc.$high === start.$high && utc.$low < start.$low))) { */ case 5:
|
|
_r$1 = loc.lookup(new $Int64(start.$high - 0, start.$low - 1)); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$6 = _r$1;
|
|
offset = _tuple$6[1];
|
|
$s = 7; continue;
|
|
/* } else if ((utc.$high > end.$high || (utc.$high === end.$high && utc.$low >= end.$low))) { */ case 6:
|
|
_r$2 = loc.lookup(end); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$7 = _r$2;
|
|
offset = _tuple$7[1];
|
|
/* } */ case 7:
|
|
case 4:
|
|
unix = (x$16 = (new $Int64(0, offset)), new $Int64(unix.$high - x$16.$high, unix.$low - x$16.$low));
|
|
/* } */ case 3:
|
|
t = $clone(unixTime(unix, ((nsec >> 0))), Time);
|
|
t.setLoc(loc);
|
|
$s = -1; return t;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Date }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f.abs = abs; $f.d = d; $f.day = day; $f.end = end; $f.hour = hour; $f.loc = loc; $f.m = m; $f.min = min; $f.month = month; $f.n = n; $f.nsec = nsec; $f.offset = offset; $f.sec = sec; $f.start = start; $f.t = t; $f.unix = unix; $f.utc = utc; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$15 = x$15; $f.x$16 = x$16; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.y = y; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Date = Date;
|
|
Time.ptr.prototype.Truncate = function(d) {
|
|
var _tuple, d, r, t;
|
|
t = this;
|
|
t.stripMono();
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
|
|
return t;
|
|
}
|
|
_tuple = div($clone(t, Time), d);
|
|
r = _tuple[1];
|
|
return $clone(t, Time).Add(new Duration(-r.$high, -r.$low));
|
|
};
|
|
Time.prototype.Truncate = function(d) { return this.$val.Truncate(d); };
|
|
Time.ptr.prototype.Round = function(d) {
|
|
var _tuple, d, r, t;
|
|
t = this;
|
|
t.stripMono();
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
|
|
return t;
|
|
}
|
|
_tuple = div($clone(t, Time), d);
|
|
r = _tuple[1];
|
|
if (lessThanHalf(r, d)) {
|
|
return $clone(t, Time).Add(new Duration(-r.$high, -r.$low));
|
|
}
|
|
return $clone(t, Time).Add(new Duration(d.$high - r.$high, d.$low - r.$low));
|
|
};
|
|
Time.prototype.Round = function(d) { return this.$val.Round(d); };
|
|
div = function(t, d) {
|
|
var _q, _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, d, d0, d1, d1$1, neg, nsec, qmod2, r, sec, sec$1, t, tmp, u0, u0x, u1, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
qmod2 = 0;
|
|
r = new Duration(0, 0);
|
|
neg = false;
|
|
nsec = t.nsec();
|
|
sec = t.sec();
|
|
if ((sec.$high < 0 || (sec.$high === 0 && sec.$low < 0))) {
|
|
neg = true;
|
|
sec = new $Int64(-sec.$high, -sec.$low);
|
|
nsec = -nsec;
|
|
if (nsec < 0) {
|
|
nsec = nsec + (1000000000) >> 0;
|
|
sec = (x$1 = new $Int64(0, 1), new $Int64(sec.$high - x$1.$high, sec.$low - x$1.$low));
|
|
}
|
|
}
|
|
if ((d.$high < 0 || (d.$high === 0 && d.$low < 1000000000)) && (x$2 = $div64(new Duration(0, 1000000000), (new Duration(d.$high + d.$high, d.$low + d.$low)), true), (x$2.$high === 0 && x$2.$low === 0))) {
|
|
qmod2 = (((_q = nsec / (((d.$low + ((d.$high >> 31) * 4294967296)) >> 0)), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0)) & 1;
|
|
r = (new Duration(0, (_r = nsec % (((d.$low + ((d.$high >> 31) * 4294967296)) >> 0)), _r === _r ? _r : $throwRuntimeError("integer divide by zero"))));
|
|
} else if ((x$3 = $div64(d, new Duration(0, 1000000000), true), (x$3.$high === 0 && x$3.$low === 0))) {
|
|
d1 = ((x$4 = $div64(d, new Duration(0, 1000000000), false), new $Int64(x$4.$high, x$4.$low)));
|
|
qmod2 = (((x$5 = $div64(sec, d1, false), x$5.$low + ((x$5.$high >> 31) * 4294967296)) >> 0)) & 1;
|
|
r = (x$6 = $mul64(((x$7 = $div64(sec, d1, true), new Duration(x$7.$high, x$7.$low))), new Duration(0, 1000000000)), x$8 = (new Duration(0, nsec)), new Duration(x$6.$high + x$8.$high, x$6.$low + x$8.$low));
|
|
} else {
|
|
sec$1 = (new $Uint64(sec.$high, sec.$low));
|
|
tmp = $mul64(($shiftRightUint64(sec$1, 32)), new $Uint64(0, 1000000000));
|
|
u1 = $shiftRightUint64(tmp, 32);
|
|
u0 = $shiftLeft64(tmp, 32);
|
|
tmp = $mul64((new $Uint64(sec$1.$high & 0, (sec$1.$low & 4294967295) >>> 0)), new $Uint64(0, 1000000000));
|
|
_tmp = u0;
|
|
_tmp$1 = new $Uint64(u0.$high + tmp.$high, u0.$low + tmp.$low);
|
|
u0x = _tmp;
|
|
u0 = _tmp$1;
|
|
if ((u0.$high < u0x.$high || (u0.$high === u0x.$high && u0.$low < u0x.$low))) {
|
|
u1 = (x$9 = new $Uint64(0, 1), new $Uint64(u1.$high + x$9.$high, u1.$low + x$9.$low));
|
|
}
|
|
_tmp$2 = u0;
|
|
_tmp$3 = (x$10 = (new $Uint64(0, nsec)), new $Uint64(u0.$high + x$10.$high, u0.$low + x$10.$low));
|
|
u0x = _tmp$2;
|
|
u0 = _tmp$3;
|
|
if ((u0.$high < u0x.$high || (u0.$high === u0x.$high && u0.$low < u0x.$low))) {
|
|
u1 = (x$11 = new $Uint64(0, 1), new $Uint64(u1.$high + x$11.$high, u1.$low + x$11.$low));
|
|
}
|
|
d1$1 = (new $Uint64(d.$high, d.$low));
|
|
while (true) {
|
|
if (!(!((x$12 = $shiftRightUint64(d1$1, 63), (x$12.$high === 0 && x$12.$low === 1))))) { break; }
|
|
d1$1 = $shiftLeft64(d1$1, (1));
|
|
}
|
|
d0 = new $Uint64(0, 0);
|
|
while (true) {
|
|
qmod2 = 0;
|
|
if ((u1.$high > d1$1.$high || (u1.$high === d1$1.$high && u1.$low > d1$1.$low)) || (u1.$high === d1$1.$high && u1.$low === d1$1.$low) && (u0.$high > d0.$high || (u0.$high === d0.$high && u0.$low >= d0.$low))) {
|
|
qmod2 = 1;
|
|
_tmp$4 = u0;
|
|
_tmp$5 = new $Uint64(u0.$high - d0.$high, u0.$low - d0.$low);
|
|
u0x = _tmp$4;
|
|
u0 = _tmp$5;
|
|
if ((u0.$high > u0x.$high || (u0.$high === u0x.$high && u0.$low > u0x.$low))) {
|
|
u1 = (x$13 = new $Uint64(0, 1), new $Uint64(u1.$high - x$13.$high, u1.$low - x$13.$low));
|
|
}
|
|
u1 = (x$14 = d1$1, new $Uint64(u1.$high - x$14.$high, u1.$low - x$14.$low));
|
|
}
|
|
if ((d1$1.$high === 0 && d1$1.$low === 0) && (x$15 = (new $Uint64(d.$high, d.$low)), (d0.$high === x$15.$high && d0.$low === x$15.$low))) {
|
|
break;
|
|
}
|
|
d0 = $shiftRightUint64(d0, (1));
|
|
d0 = (x$16 = $shiftLeft64((new $Uint64(d1$1.$high & 0, (d1$1.$low & 1) >>> 0)), 63), new $Uint64(d0.$high | x$16.$high, (d0.$low | x$16.$low) >>> 0));
|
|
d1$1 = $shiftRightUint64(d1$1, (1));
|
|
}
|
|
r = (new Duration(u0.$high, u0.$low));
|
|
}
|
|
if (neg && !((r.$high === 0 && r.$low === 0))) {
|
|
qmod2 = (qmod2 ^ (1)) >> 0;
|
|
r = new Duration(d.$high - r.$high, d.$low - r.$low);
|
|
}
|
|
return [qmod2, r];
|
|
};
|
|
Location.ptr.prototype.get = function() {
|
|
var l, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; l = $f.l; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
if (l === ptrType$2.nil) {
|
|
$s = -1; return utcLoc;
|
|
}
|
|
/* */ if (l === localLoc) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (l === localLoc) { */ case 1:
|
|
$r = localOnce.Do(initLocal); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
$s = -1; return l;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.get }; } $f.l = l; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Location.prototype.get = function() { return this.$val.get(); };
|
|
Location.ptr.prototype.String = function() {
|
|
var _r, l, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; l = $f.l; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r.name;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.String }; } $f._r = _r; $f.l = l; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Location.prototype.String = function() { return this.$val.String(); };
|
|
FixedZone = function(name, offset) {
|
|
var l, name, offset, x$1;
|
|
l = new Location.ptr(name, new sliceType([new zone.ptr(name, offset, false)]), new sliceType$1([new zoneTrans.ptr(new $Int64(-2147483648, 0), 0, false, false)]), new $Int64(-2147483648, 0), new $Int64(2147483647, 4294967295), ptrType.nil);
|
|
l.cacheZone = (x$1 = l.zone, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0]));
|
|
return l;
|
|
};
|
|
$pkg.FixedZone = FixedZone;
|
|
Location.ptr.prototype.lookup = function(sec) {
|
|
var _q, _r, end, hi, l, lim, lo, m, name, offset, sec, start, tx, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, zone$1, zone$2, zone$3, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; end = $f.end; hi = $f.hi; l = $f.l; lim = $f.lim; lo = $f.lo; m = $f.m; name = $f.name; offset = $f.offset; sec = $f.sec; start = $f.start; tx = $f.tx; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; zone$1 = $f.zone$1; zone$2 = $f.zone$2; zone$3 = $f.zone$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
name = "";
|
|
offset = 0;
|
|
start = new $Int64(0, 0);
|
|
end = new $Int64(0, 0);
|
|
l = this;
|
|
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
l = _r;
|
|
if (l.zone.$length === 0) {
|
|
name = "UTC";
|
|
offset = 0;
|
|
start = new $Int64(-2147483648, 0);
|
|
end = new $Int64(2147483647, 4294967295);
|
|
$s = -1; return [name, offset, start, end];
|
|
}
|
|
zone$1 = l.cacheZone;
|
|
if (!(zone$1 === ptrType.nil) && (x$1 = l.cacheStart, (x$1.$high < sec.$high || (x$1.$high === sec.$high && x$1.$low <= sec.$low))) && (x$2 = l.cacheEnd, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) {
|
|
name = zone$1.name;
|
|
offset = zone$1.offset;
|
|
start = l.cacheStart;
|
|
end = l.cacheEnd;
|
|
$s = -1; return [name, offset, start, end];
|
|
}
|
|
if ((l.tx.$length === 0) || (x$3 = (x$4 = l.tx, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0])).when, (sec.$high < x$3.$high || (sec.$high === x$3.$high && sec.$low < x$3.$low)))) {
|
|
zone$2 = (x$5 = l.zone, x$6 = l.lookupFirstZone(), ((x$6 < 0 || x$6 >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + x$6]));
|
|
name = zone$2.name;
|
|
offset = zone$2.offset;
|
|
start = new $Int64(-2147483648, 0);
|
|
if (l.tx.$length > 0) {
|
|
end = (x$7 = l.tx, (0 >= x$7.$length ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + 0])).when;
|
|
} else {
|
|
end = new $Int64(2147483647, 4294967295);
|
|
}
|
|
$s = -1; return [name, offset, start, end];
|
|
}
|
|
tx = l.tx;
|
|
end = new $Int64(2147483647, 4294967295);
|
|
lo = 0;
|
|
hi = tx.$length;
|
|
while (true) {
|
|
if (!((hi - lo >> 0) > 1)) { break; }
|
|
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
lim = ((m < 0 || m >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + m]).when;
|
|
if ((sec.$high < lim.$high || (sec.$high === lim.$high && sec.$low < lim.$low))) {
|
|
end = lim;
|
|
hi = m;
|
|
} else {
|
|
lo = m;
|
|
}
|
|
}
|
|
zone$3 = (x$8 = l.zone, x$9 = ((lo < 0 || lo >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + lo]).index, ((x$9 < 0 || x$9 >= x$8.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + x$9]));
|
|
name = zone$3.name;
|
|
offset = zone$3.offset;
|
|
start = ((lo < 0 || lo >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + lo]).when;
|
|
$s = -1; return [name, offset, start, end];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.lookup }; } $f._q = _q; $f._r = _r; $f.end = end; $f.hi = hi; $f.l = l; $f.lim = lim; $f.lo = lo; $f.m = m; $f.name = name; $f.offset = offset; $f.sec = sec; $f.start = start; $f.tx = tx; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.zone$3 = zone$3; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Location.prototype.lookup = function(sec) { return this.$val.lookup(sec); };
|
|
Location.ptr.prototype.lookupFirstZone = function() {
|
|
var _i, _ref, l, x$1, x$2, x$3, x$4, x$5, x$6, zi, zi$1;
|
|
l = this;
|
|
if (!l.firstZoneUsed()) {
|
|
return 0;
|
|
}
|
|
if (l.tx.$length > 0 && (x$1 = l.zone, x$2 = (x$3 = l.tx, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).index, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2])).isDST) {
|
|
zi = (((x$4 = l.tx, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0])).index >> 0)) - 1 >> 0;
|
|
while (true) {
|
|
if (!(zi >= 0)) { break; }
|
|
if (!(x$5 = l.zone, ((zi < 0 || zi >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + zi])).isDST) {
|
|
return zi;
|
|
}
|
|
zi = zi - (1) >> 0;
|
|
}
|
|
}
|
|
_ref = l.zone;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
zi$1 = _i;
|
|
if (!(x$6 = l.zone, ((zi$1 < 0 || zi$1 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + zi$1])).isDST) {
|
|
return zi$1;
|
|
}
|
|
_i++;
|
|
}
|
|
return 0;
|
|
};
|
|
Location.prototype.lookupFirstZone = function() { return this.$val.lookupFirstZone(); };
|
|
Location.ptr.prototype.firstZoneUsed = function() {
|
|
var _i, _ref, l, tx;
|
|
l = this;
|
|
_ref = l.tx;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
tx = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), zoneTrans);
|
|
if (tx.index === 0) {
|
|
return true;
|
|
}
|
|
_i++;
|
|
}
|
|
return false;
|
|
};
|
|
Location.prototype.firstZoneUsed = function() { return this.$val.firstZoneUsed(); };
|
|
Location.ptr.prototype.lookupName = function(name, unix) {
|
|
var _i, _i$1, _r, _r$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, i, i$1, l, nam, name, offset, offset$1, ok, unix, x$1, x$2, x$3, zone$1, zone$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; i = $f.i; i$1 = $f.i$1; l = $f.l; nam = $f.nam; name = $f.name; offset = $f.offset; offset$1 = $f.offset$1; ok = $f.ok; unix = $f.unix; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; zone$1 = $f.zone$1; zone$2 = $f.zone$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
offset = 0;
|
|
ok = false;
|
|
l = this;
|
|
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
l = _r;
|
|
_ref = l.zone;
|
|
_i = 0;
|
|
/* while (true) { */ case 2:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 3; continue; }
|
|
i = _i;
|
|
zone$1 = (x$1 = l.zone, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i]));
|
|
/* */ if (zone$1.name === name) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (zone$1.name === name) { */ case 4:
|
|
_r$1 = l.lookup((x$2 = (new $Int64(0, zone$1.offset)), new $Int64(unix.$high - x$2.$high, unix.$low - x$2.$low))); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
nam = _tuple[0];
|
|
offset$1 = _tuple[1];
|
|
if (nam === zone$1.name) {
|
|
_tmp = offset$1;
|
|
_tmp$1 = true;
|
|
offset = _tmp;
|
|
ok = _tmp$1;
|
|
$s = -1; return [offset, ok];
|
|
}
|
|
/* } */ case 5:
|
|
_i++;
|
|
/* } */ $s = 2; continue; case 3:
|
|
_ref$1 = l.zone;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
zone$2 = (x$3 = l.zone, ((i$1 < 0 || i$1 >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + i$1]));
|
|
if (zone$2.name === name) {
|
|
_tmp$2 = zone$2.offset;
|
|
_tmp$3 = true;
|
|
offset = _tmp$2;
|
|
ok = _tmp$3;
|
|
$s = -1; return [offset, ok];
|
|
}
|
|
_i$1++;
|
|
}
|
|
$s = -1; return [offset, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.lookupName }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.i = i; $f.i$1 = i$1; $f.l = l; $f.nam = nam; $f.name = name; $f.offset = offset; $f.offset$1 = offset$1; $f.ok = ok; $f.unix = unix; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Location.prototype.lookupName = function(name, unix) { return this.$val.lookupName(name, unix); };
|
|
ptrType$4.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$5.methods = [{prop: "Stop", name: "Stop", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Reset", name: "Reset", pkg: "", typ: $funcType([Duration], [$Bool], false)}];
|
|
ptrType$6.methods = [{prop: "Stop", name: "Stop", pkg: "", typ: $funcType([], [], false)}];
|
|
Time.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Format", name: "Format", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "AppendFormat", name: "AppendFormat", pkg: "", typ: $funcType([sliceType$3, $String], [sliceType$3], false)}, {prop: "After", name: "After", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "Before", name: "Before", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "Equal", name: "Equal", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "IsZero", name: "IsZero", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "abs", name: "abs", pkg: "time", typ: $funcType([], [$Uint64], false)}, {prop: "locabs", name: "locabs", pkg: "time", typ: $funcType([], [$String, $Int, $Uint64], false)}, {prop: "Date", name: "Date", pkg: "", typ: $funcType([], [$Int, Month, $Int], false)}, {prop: "Year", name: "Year", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Month", name: "Month", pkg: "", typ: $funcType([], [Month], false)}, {prop: "Day", name: "Day", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Weekday", name: "Weekday", pkg: "", typ: $funcType([], [Weekday], false)}, {prop: "ISOWeek", name: "ISOWeek", pkg: "", typ: $funcType([], [$Int, $Int], false)}, {prop: "Clock", name: "Clock", pkg: "", typ: $funcType([], [$Int, $Int, $Int], false)}, {prop: "Hour", name: "Hour", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Minute", name: "Minute", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Second", name: "Second", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Nanosecond", name: "Nanosecond", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "YearDay", name: "YearDay", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Add", name: "Add", pkg: "", typ: $funcType([Duration], [Time], false)}, {prop: "Sub", name: "Sub", pkg: "", typ: $funcType([Time], [Duration], false)}, {prop: "AddDate", name: "AddDate", pkg: "", typ: $funcType([$Int, $Int, $Int], [Time], false)}, {prop: "date", name: "date", pkg: "time", typ: $funcType([$Bool], [$Int, Month, $Int, $Int], false)}, {prop: "UTC", name: "UTC", pkg: "", typ: $funcType([], [Time], false)}, {prop: "Local", name: "Local", pkg: "", typ: $funcType([], [Time], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([ptrType$2], [Time], false)}, {prop: "Location", name: "Location", pkg: "", typ: $funcType([], [ptrType$2], false)}, {prop: "Zone", name: "Zone", pkg: "", typ: $funcType([], [$String, $Int], false)}, {prop: "Unix", name: "Unix", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "UnixNano", name: "UnixNano", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "MarshalBinary", name: "MarshalBinary", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "GobEncode", name: "GobEncode", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "MarshalJSON", name: "MarshalJSON", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "MarshalText", name: "MarshalText", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([Duration], [Time], false)}, {prop: "Round", name: "Round", pkg: "", typ: $funcType([Duration], [Time], false)}];
|
|
ptrType$7.methods = [{prop: "nsec", name: "nsec", pkg: "time", typ: $funcType([], [$Int32], false)}, {prop: "sec", name: "sec", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "unixSec", name: "unixSec", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "addSec", name: "addSec", pkg: "time", typ: $funcType([$Int64], [], false)}, {prop: "setLoc", name: "setLoc", pkg: "time", typ: $funcType([ptrType$2], [], false)}, {prop: "stripMono", name: "stripMono", pkg: "time", typ: $funcType([], [], false)}, {prop: "setMono", name: "setMono", pkg: "time", typ: $funcType([$Int64], [], false)}, {prop: "mono", name: "mono", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "UnmarshalBinary", name: "UnmarshalBinary", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "GobDecode", name: "GobDecode", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "UnmarshalJSON", name: "UnmarshalJSON", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "UnmarshalText", name: "UnmarshalText", pkg: "", typ: $funcType([sliceType$3], [$error], false)}];
|
|
Month.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
Weekday.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
Duration.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Nanoseconds", name: "Nanoseconds", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seconds", name: "Seconds", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Minutes", name: "Minutes", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Hours", name: "Hours", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([Duration], [Duration], false)}, {prop: "Round", name: "Round", pkg: "", typ: $funcType([Duration], [Duration], false)}];
|
|
ptrType$2.methods = [{prop: "get", name: "get", pkg: "time", typ: $funcType([], [ptrType$2], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "lookup", name: "lookup", pkg: "time", typ: $funcType([$Int64], [$String, $Int, $Int64, $Int64], false)}, {prop: "lookupFirstZone", name: "lookupFirstZone", pkg: "time", typ: $funcType([], [$Int], false)}, {prop: "firstZoneUsed", name: "firstZoneUsed", pkg: "time", typ: $funcType([], [$Bool], false)}, {prop: "lookupName", name: "lookupName", pkg: "time", typ: $funcType([$String, $Int64], [$Int, $Bool], false)}];
|
|
runtimeTimer.init("time", [{prop: "i", name: "i", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "when", name: "when", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "period", name: "period", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "f", name: "f", embedded: false, exported: false, typ: funcType$1, tag: ""}, {prop: "arg", name: "arg", embedded: false, exported: false, typ: $emptyInterface, tag: ""}, {prop: "timeout", name: "timeout", embedded: false, exported: false, typ: ptrType$3, tag: ""}, {prop: "active", name: "active", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
ParseError.init("", [{prop: "Layout", name: "Layout", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Value", name: "Value", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "LayoutElem", name: "LayoutElem", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "ValueElem", name: "ValueElem", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Message", name: "Message", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
Timer.init("time", [{prop: "C", name: "C", embedded: false, exported: true, typ: chanType$1, tag: ""}, {prop: "r", name: "r", embedded: false, exported: false, typ: runtimeTimer, tag: ""}]);
|
|
Ticker.init("time", [{prop: "C", name: "C", embedded: false, exported: true, typ: chanType$1, tag: ""}, {prop: "r", name: "r", embedded: false, exported: false, typ: runtimeTimer, tag: ""}]);
|
|
Time.init("time", [{prop: "wall", name: "wall", embedded: false, exported: false, typ: $Uint64, tag: ""}, {prop: "ext", name: "ext", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "loc", name: "loc", embedded: false, exported: false, typ: ptrType$2, tag: ""}]);
|
|
Location.init("time", [{prop: "name", name: "name", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "zone", name: "zone", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "tx", name: "tx", embedded: false, exported: false, typ: sliceType$1, tag: ""}, {prop: "cacheStart", name: "cacheStart", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "cacheEnd", name: "cacheEnd", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "cacheZone", name: "cacheZone", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
|
zone.init("time", [{prop: "name", name: "name", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "offset", name: "offset", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "isDST", name: "isDST", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
zoneTrans.init("time", [{prop: "when", name: "when", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "index", name: "index", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "isstd", name: "isstd", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "isutc", name: "isutc", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = nosync.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syscall.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
localLoc = new Location.ptr("", sliceType.nil, sliceType$1.nil, new $Int64(0, 0), new $Int64(0, 0), ptrType.nil);
|
|
localOnce = new nosync.Once.ptr(false, false);
|
|
zoneSources = new sliceType$2([runtime.GOROOT() + "/lib/time/zoneinfo.zip"]);
|
|
std0x = $toNativeArray($kindInt, [260, 265, 524, 526, 528, 274]);
|
|
longDayNames = new sliceType$2(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]);
|
|
shortDayNames = new sliceType$2(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]);
|
|
shortMonthNames = new sliceType$2(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]);
|
|
longMonthNames = new sliceType$2(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]);
|
|
atoiError = errors.New("time: invalid number");
|
|
errBad = errors.New("bad value for field");
|
|
errLeadingInt = errors.New("time: bad [0-9]*");
|
|
months = $toNativeArray($kindString, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]);
|
|
days = $toNativeArray($kindString, ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]);
|
|
daysBefore = $toNativeArray($kindInt32, [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]);
|
|
startNano = (x = runtimeNano(), new $Int64(x.$high - 0, x.$low - 1));
|
|
utcLoc = new Location.ptr("UTC", sliceType.nil, sliceType$1.nil, new $Int64(0, 0), new $Int64(0, 0), ptrType.nil);
|
|
$pkg.UTC = utcLoc;
|
|
$pkg.Local = localLoc;
|
|
errLocation = errors.New("time: invalid location name");
|
|
badData = errors.New("malformed time zone information");
|
|
$unused(new sliceType$2(["/usr/share/zoneinfo/", "/usr/share/lib/zoneinfo/", "/usr/lib/locale/TZ/", runtime.GOROOT() + "/lib/time/zoneinfo.zip"]));
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/poll"] = (function() {
|
|
var $pkg = {}, $init, errors, io, runtime, atomic, syscall, time, pollDesc, TimeoutError, fdMutex, FD, ptrType, chanType, sliceType, ptrType$1, ptrType$2, arrayType, sliceType$2, ptrType$6, ptrType$7, ptrType$8, ptrType$9, ptrType$10, ptrType$11, sliceType$3, ptrType$12, funcType, funcType$1, ptrType$13, ptrType$14, ptrType$15, ptrType$16, sliceType$4, ptrType$17, semWaiters, tryDupCloexec, tryDupCloexec$24ptr, runtime_Semacquire, runtime_Semrelease, errClosing, consume, fcntl, DupCloseOnExec, dupCloseOnExecOld, writev, accept;
|
|
errors = $packages["errors"];
|
|
io = $packages["io"];
|
|
runtime = $packages["runtime"];
|
|
atomic = $packages["sync/atomic"];
|
|
syscall = $packages["syscall"];
|
|
time = $packages["time"];
|
|
pollDesc = $pkg.pollDesc = $newType(0, $kindStruct, "poll.pollDesc", true, "internal/poll", false, function(closing_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.closing = false;
|
|
return;
|
|
}
|
|
this.closing = closing_;
|
|
});
|
|
TimeoutError = $pkg.TimeoutError = $newType(0, $kindStruct, "poll.TimeoutError", true, "internal/poll", true, function() {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
return;
|
|
}
|
|
});
|
|
fdMutex = $pkg.fdMutex = $newType(0, $kindStruct, "poll.fdMutex", true, "internal/poll", false, function(state_, rsema_, wsema_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.state = new $Uint64(0, 0);
|
|
this.rsema = 0;
|
|
this.wsema = 0;
|
|
return;
|
|
}
|
|
this.state = state_;
|
|
this.rsema = rsema_;
|
|
this.wsema = wsema_;
|
|
});
|
|
FD = $pkg.FD = $newType(0, $kindStruct, "poll.FD", true, "internal/poll", true, function(fdmu_, Sysfd_, pd_, iovecs_, csema_, isBlocking_, IsStream_, ZeroReadIsEOF_, isFile_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.fdmu = new fdMutex.ptr(new $Uint64(0, 0), 0, 0);
|
|
this.Sysfd = 0;
|
|
this.pd = new pollDesc.ptr(false);
|
|
this.iovecs = ptrType$6.nil;
|
|
this.csema = 0;
|
|
this.isBlocking = 0;
|
|
this.IsStream = false;
|
|
this.ZeroReadIsEOF = false;
|
|
this.isFile = false;
|
|
return;
|
|
}
|
|
this.fdmu = fdmu_;
|
|
this.Sysfd = Sysfd_;
|
|
this.pd = pd_;
|
|
this.iovecs = iovecs_;
|
|
this.csema = csema_;
|
|
this.isBlocking = isBlocking_;
|
|
this.IsStream = IsStream_;
|
|
this.ZeroReadIsEOF = ZeroReadIsEOF_;
|
|
this.isFile = isFile_;
|
|
});
|
|
ptrType = $ptrType($Uint32);
|
|
chanType = $chanType($Bool, false, false);
|
|
sliceType = $sliceType(chanType);
|
|
ptrType$1 = $ptrType($Uint64);
|
|
ptrType$2 = $ptrType($Int32);
|
|
arrayType = $arrayType($Uint8, 4);
|
|
sliceType$2 = $sliceType(syscall.Iovec);
|
|
ptrType$6 = $ptrType(sliceType$2);
|
|
ptrType$7 = $ptrType($Uint8);
|
|
ptrType$8 = $ptrType(FD);
|
|
ptrType$9 = $ptrType(pollDesc);
|
|
ptrType$10 = $ptrType(TimeoutError);
|
|
ptrType$11 = $ptrType(fdMutex);
|
|
sliceType$3 = $sliceType($Uint8);
|
|
ptrType$12 = $ptrType(syscall.Stat_t);
|
|
funcType = $funcType([$Uintptr], [], false);
|
|
funcType$1 = $funcType([$Uintptr], [$Bool], false);
|
|
ptrType$13 = $ptrType(syscall.Linger);
|
|
ptrType$14 = $ptrType(syscall.IPMreqn);
|
|
ptrType$15 = $ptrType(syscall.IPMreq);
|
|
ptrType$16 = $ptrType(syscall.IPv6Mreq);
|
|
sliceType$4 = $sliceType(sliceType$3);
|
|
ptrType$17 = $ptrType(sliceType$4);
|
|
pollDesc.ptr.prototype.init = function(fd) {
|
|
var fd, pd;
|
|
pd = this;
|
|
return $ifaceNil;
|
|
};
|
|
pollDesc.prototype.init = function(fd) { return this.$val.init(fd); };
|
|
pollDesc.ptr.prototype.close = function() {
|
|
var pd;
|
|
pd = this;
|
|
};
|
|
pollDesc.prototype.close = function() { return this.$val.close(); };
|
|
pollDesc.ptr.prototype.evict = function() {
|
|
var pd;
|
|
pd = this;
|
|
pd.closing = true;
|
|
};
|
|
pollDesc.prototype.evict = function() { return this.$val.evict(); };
|
|
pollDesc.ptr.prototype.prepare = function(mode, isFile) {
|
|
var isFile, mode, pd;
|
|
pd = this;
|
|
if (pd.closing) {
|
|
return errClosing(isFile);
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
pollDesc.prototype.prepare = function(mode, isFile) { return this.$val.prepare(mode, isFile); };
|
|
pollDesc.ptr.prototype.prepareRead = function(isFile) {
|
|
var isFile, pd;
|
|
pd = this;
|
|
return pd.prepare(114, isFile);
|
|
};
|
|
pollDesc.prototype.prepareRead = function(isFile) { return this.$val.prepareRead(isFile); };
|
|
pollDesc.ptr.prototype.prepareWrite = function(isFile) {
|
|
var isFile, pd;
|
|
pd = this;
|
|
return pd.prepare(119, isFile);
|
|
};
|
|
pollDesc.prototype.prepareWrite = function(isFile) { return this.$val.prepareWrite(isFile); };
|
|
pollDesc.ptr.prototype.wait = function(mode, isFile) {
|
|
var isFile, mode, pd;
|
|
pd = this;
|
|
if (pd.closing) {
|
|
return errClosing(isFile);
|
|
}
|
|
return $pkg.ErrTimeout;
|
|
};
|
|
pollDesc.prototype.wait = function(mode, isFile) { return this.$val.wait(mode, isFile); };
|
|
pollDesc.ptr.prototype.waitRead = function(isFile) {
|
|
var isFile, pd;
|
|
pd = this;
|
|
return pd.wait(114, isFile);
|
|
};
|
|
pollDesc.prototype.waitRead = function(isFile) { return this.$val.waitRead(isFile); };
|
|
pollDesc.ptr.prototype.waitWrite = function(isFile) {
|
|
var isFile, pd;
|
|
pd = this;
|
|
return pd.wait(119, isFile);
|
|
};
|
|
pollDesc.prototype.waitWrite = function(isFile) { return this.$val.waitWrite(isFile); };
|
|
pollDesc.ptr.prototype.pollable = function() {
|
|
return true;
|
|
};
|
|
pollDesc.prototype.pollable = function() { return this.$val.pollable(); };
|
|
FD.ptr.prototype.SetDeadline = function(t) {
|
|
var t;
|
|
return $ifaceNil;
|
|
};
|
|
FD.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
|
|
FD.ptr.prototype.SetReadDeadline = function(t) {
|
|
var t;
|
|
return $ifaceNil;
|
|
};
|
|
FD.prototype.SetReadDeadline = function(t) { return this.$val.SetReadDeadline(t); };
|
|
FD.ptr.prototype.SetWriteDeadline = function(t) {
|
|
var t;
|
|
return $ifaceNil;
|
|
};
|
|
FD.prototype.SetWriteDeadline = function(t) { return this.$val.SetWriteDeadline(t); };
|
|
runtime_Semacquire = function(s) {
|
|
var _entry, _key, _r, ch, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _key = $f._key; _r = $f._r; ch = $f.ch; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if (s.$get() === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (s.$get() === 0) { */ case 1:
|
|
ch = new $Chan($Bool, 0);
|
|
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType.keyFor(_key)] = { k: _key, v: $append((_entry = semWaiters[ptrType.keyFor(s)], _entry !== undefined ? _entry.v : sliceType.nil), ch) };
|
|
_r = $recv(ch); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r[0];
|
|
/* } */ case 2:
|
|
s.$set(s.$get() - (1) >>> 0);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_Semacquire }; } $f._entry = _entry; $f._key = _key; $f._r = _r; $f.ch = ch; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
runtime_Semrelease = function(s) {
|
|
var _entry, _key, ch, s, w, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _key = $f._key; ch = $f.ch; s = $f.s; w = $f.w; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s.$set(s.$get() + (1) >>> 0);
|
|
w = (_entry = semWaiters[ptrType.keyFor(s)], _entry !== undefined ? _entry.v : sliceType.nil);
|
|
if (w.$length === 0) {
|
|
$s = -1; return;
|
|
}
|
|
ch = (0 >= w.$length ? ($throwRuntimeError("index out of range"), undefined) : w.$array[w.$offset + 0]);
|
|
w = $subslice(w, 1);
|
|
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType.keyFor(_key)] = { k: _key, v: w };
|
|
if (w.$length === 0) {
|
|
delete semWaiters[ptrType.keyFor(s)];
|
|
}
|
|
$r = $send(ch, true); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_Semrelease }; } $f._entry = _entry; $f._key = _key; $f.ch = ch; $f.s = s; $f.w = w; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
errClosing = function(isFile) {
|
|
var isFile;
|
|
if (isFile) {
|
|
return $pkg.ErrFileClosing;
|
|
}
|
|
return $pkg.ErrNetClosing;
|
|
};
|
|
TimeoutError.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
return "i/o timeout";
|
|
};
|
|
TimeoutError.prototype.Error = function() { return this.$val.Error(); };
|
|
TimeoutError.ptr.prototype.Timeout = function() {
|
|
var e;
|
|
e = this;
|
|
return true;
|
|
};
|
|
TimeoutError.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
TimeoutError.ptr.prototype.Temporary = function() {
|
|
var e;
|
|
e = this;
|
|
return true;
|
|
};
|
|
TimeoutError.prototype.Temporary = function() { return this.$val.Temporary(); };
|
|
consume = function(v, n) {
|
|
var ln0, n, v, x, x$1, x$2, x$3;
|
|
while (true) {
|
|
if (!(v.$get().$length > 0)) { break; }
|
|
ln0 = (new $Int64(0, (x = v.$get(), (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])).$length));
|
|
if ((ln0.$high > n.$high || (ln0.$high === n.$high && ln0.$low > n.$low))) {
|
|
(x$2 = v.$get(), (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0] = $subslice((x$1 = v.$get(), (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])), $flatten64(n))));
|
|
return;
|
|
}
|
|
n = (x$3 = ln0, new $Int64(n.$high - x$3.$high, n.$low - x$3.$low));
|
|
v.$set($subslice((v.$get()), 1));
|
|
}
|
|
};
|
|
FD.ptr.prototype.Fsync = function() {
|
|
var err, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Fsync(fd.Sysfd);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fsync }; } $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Fsync = function() { return this.$val.Fsync(); };
|
|
fcntl = function(fd, cmd, arg) {
|
|
var _tuple, arg, cmd, e, fd, r;
|
|
_tuple = syscall.Syscall(72, ((fd >>> 0)), ((cmd >>> 0)), ((arg >>> 0)));
|
|
r = _tuple[0];
|
|
e = _tuple[2];
|
|
if (!((e === 0))) {
|
|
return [((r >> 0)), new syscall.Errno((e))];
|
|
}
|
|
return [((r >> 0)), $ifaceNil];
|
|
};
|
|
fdMutex.ptr.prototype.incref = function() {
|
|
var mu, new$1, old, x, x$1;
|
|
mu = this;
|
|
while (true) {
|
|
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
|
|
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
|
|
return false;
|
|
}
|
|
new$1 = new $Uint64(old.$high + 0, old.$low + 8);
|
|
if ((x$1 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
|
|
$panic(new $String("too many concurrent operations on a single file or socket (max 1048575)"));
|
|
}
|
|
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
|
|
return true;
|
|
}
|
|
}
|
|
};
|
|
fdMutex.prototype.incref = function() { return this.$val.incref(); };
|
|
fdMutex.ptr.prototype.increfAndClose = function() {
|
|
var mu, new$1, old, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; mu = $f.mu; new$1 = $f.new$1; old = $f.old; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
mu = this;
|
|
/* while (true) { */ case 1:
|
|
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
|
|
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
|
|
$s = -1; return false;
|
|
}
|
|
new$1 = (x$1 = new $Uint64(old.$high | 0, (old.$low | 1) >>> 0), new $Uint64(x$1.$high + 0, x$1.$low + 8));
|
|
if ((x$2 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$2.$high === 0 && x$2.$low === 0))) {
|
|
$panic(new $String("too many concurrent operations on a single file or socket (max 1048575)"));
|
|
}
|
|
new$1 = (x$3 = new $Uint64(2147483647, 4286578688), new $Uint64(new$1.$high & ~x$3.$high, (new$1.$low & ~x$3.$low) >>> 0));
|
|
/* */ if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { */ case 3:
|
|
/* while (true) { */ case 5:
|
|
/* if (!(!((x$4 = new $Uint64(old.$high & 2047, (old.$low & 4286578688) >>> 0), (x$4.$high === 0 && x$4.$low === 0))))) { break; } */ if(!(!((x$4 = new $Uint64(old.$high & 2047, (old.$low & 4286578688) >>> 0), (x$4.$high === 0 && x$4.$low === 0))))) { $s = 6; continue; }
|
|
old = (x$5 = new $Uint64(0, 8388608), new $Uint64(old.$high - x$5.$high, old.$low - x$5.$low));
|
|
$r = runtime_Semrelease((mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu)))); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ $s = 5; continue; case 6:
|
|
/* while (true) { */ case 8:
|
|
/* if (!(!((x$6 = new $Uint64(old.$high & 2147481600, (old.$low & 0) >>> 0), (x$6.$high === 0 && x$6.$low === 0))))) { break; } */ if(!(!((x$6 = new $Uint64(old.$high & 2147481600, (old.$low & 0) >>> 0), (x$6.$high === 0 && x$6.$low === 0))))) { $s = 9; continue; }
|
|
old = (x$7 = new $Uint64(2048, 0), new $Uint64(old.$high - x$7.$high, old.$low - x$7.$low));
|
|
$r = runtime_Semrelease((mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu)))); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ $s = 8; continue; case 9:
|
|
$s = -1; return true;
|
|
/* } */ case 4:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return false;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: fdMutex.ptr.prototype.increfAndClose }; } $f.mu = mu; $f.new$1 = new$1; $f.old = old; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
fdMutex.prototype.increfAndClose = function() { return this.$val.increfAndClose(); };
|
|
fdMutex.ptr.prototype.decref = function() {
|
|
var mu, new$1, old, x, x$1;
|
|
mu = this;
|
|
while (true) {
|
|
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
|
|
if ((x = new $Uint64(old.$high & 0, (old.$low & 8388600) >>> 0), (x.$high === 0 && x.$low === 0))) {
|
|
$panic(new $String("inconsistent poll.fdMutex"));
|
|
}
|
|
new$1 = new $Uint64(old.$high - 0, old.$low - 8);
|
|
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
|
|
return (x$1 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388601) >>> 0), (x$1.$high === 0 && x$1.$low === 1));
|
|
}
|
|
}
|
|
};
|
|
fdMutex.prototype.decref = function() { return this.$val.decref(); };
|
|
fdMutex.ptr.prototype.rwlock = function(read) {
|
|
var _tmp, _tmp$1, _tmp$2, mu, mutexBit, mutexMask, mutexSema, mutexWait, new$1, old, read, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; mu = $f.mu; mutexBit = $f.mutexBit; mutexMask = $f.mutexMask; mutexSema = $f.mutexSema; mutexWait = $f.mutexWait; new$1 = $f.new$1; old = $f.old; read = $f.read; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
mu = this;
|
|
_tmp = new $Uint64(0, 0);
|
|
_tmp$1 = new $Uint64(0, 0);
|
|
_tmp$2 = new $Uint64(0, 0);
|
|
mutexBit = _tmp;
|
|
mutexWait = _tmp$1;
|
|
mutexMask = _tmp$2;
|
|
mutexSema = ptrType.nil;
|
|
if (read) {
|
|
mutexBit = new $Uint64(0, 2);
|
|
mutexWait = new $Uint64(0, 8388608);
|
|
mutexMask = new $Uint64(2047, 4286578688);
|
|
mutexSema = (mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu)));
|
|
} else {
|
|
mutexBit = new $Uint64(0, 4);
|
|
mutexWait = new $Uint64(2048, 0);
|
|
mutexMask = new $Uint64(2147481600, 0);
|
|
mutexSema = (mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu)));
|
|
}
|
|
/* while (true) { */ case 1:
|
|
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
|
|
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
|
|
$s = -1; return false;
|
|
}
|
|
new$1 = new $Uint64(0, 0);
|
|
if ((x$1 = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
|
|
new$1 = (x$2 = new $Uint64(old.$high | mutexBit.$high, (old.$low | mutexBit.$low) >>> 0), new $Uint64(x$2.$high + 0, x$2.$low + 8));
|
|
if ((x$3 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$3.$high === 0 && x$3.$low === 0))) {
|
|
$panic(new $String("too many concurrent operations on a single file or socket (max 1048575)"));
|
|
}
|
|
} else {
|
|
new$1 = new $Uint64(old.$high + mutexWait.$high, old.$low + mutexWait.$low);
|
|
if ((x$4 = new $Uint64(new$1.$high & mutexMask.$high, (new$1.$low & mutexMask.$low) >>> 0), (x$4.$high === 0 && x$4.$low === 0))) {
|
|
$panic(new $String("too many concurrent operations on a single file or socket (max 1048575)"));
|
|
}
|
|
}
|
|
/* */ if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { */ case 3:
|
|
if ((x$5 = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x$5.$high === 0 && x$5.$low === 0))) {
|
|
$s = -1; return true;
|
|
}
|
|
$r = runtime_Semacquire(mutexSema); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 4:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return false;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: fdMutex.ptr.prototype.rwlock }; } $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f.mu = mu; $f.mutexBit = mutexBit; $f.mutexMask = mutexMask; $f.mutexSema = mutexSema; $f.mutexWait = mutexWait; $f.new$1 = new$1; $f.old = old; $f.read = read; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
fdMutex.prototype.rwlock = function(read) { return this.$val.rwlock(read); };
|
|
fdMutex.ptr.prototype.rwunlock = function(read) {
|
|
var _tmp, _tmp$1, _tmp$2, mu, mutexBit, mutexMask, mutexSema, mutexWait, new$1, old, read, x, x$1, x$2, x$3, x$4, x$5, x$6, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; mu = $f.mu; mutexBit = $f.mutexBit; mutexMask = $f.mutexMask; mutexSema = $f.mutexSema; mutexWait = $f.mutexWait; new$1 = $f.new$1; old = $f.old; read = $f.read; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
mu = this;
|
|
_tmp = new $Uint64(0, 0);
|
|
_tmp$1 = new $Uint64(0, 0);
|
|
_tmp$2 = new $Uint64(0, 0);
|
|
mutexBit = _tmp;
|
|
mutexWait = _tmp$1;
|
|
mutexMask = _tmp$2;
|
|
mutexSema = ptrType.nil;
|
|
if (read) {
|
|
mutexBit = new $Uint64(0, 2);
|
|
mutexWait = new $Uint64(0, 8388608);
|
|
mutexMask = new $Uint64(2047, 4286578688);
|
|
mutexSema = (mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu)));
|
|
} else {
|
|
mutexBit = new $Uint64(0, 4);
|
|
mutexWait = new $Uint64(2048, 0);
|
|
mutexMask = new $Uint64(2147481600, 0);
|
|
mutexSema = (mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu)));
|
|
}
|
|
/* while (true) { */ case 1:
|
|
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
|
|
if ((x = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x.$high === 0 && x.$low === 0)) || (x$1 = new $Uint64(old.$high & 0, (old.$low & 8388600) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
|
|
$panic(new $String("inconsistent poll.fdMutex"));
|
|
}
|
|
new$1 = (x$2 = new $Uint64(old.$high & ~mutexBit.$high, (old.$low & ~mutexBit.$low) >>> 0), new $Uint64(x$2.$high - 0, x$2.$low - 8));
|
|
if (!((x$3 = new $Uint64(old.$high & mutexMask.$high, (old.$low & mutexMask.$low) >>> 0), (x$3.$high === 0 && x$3.$low === 0)))) {
|
|
new$1 = (x$4 = mutexWait, new $Uint64(new$1.$high - x$4.$high, new$1.$low - x$4.$low));
|
|
}
|
|
/* */ if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType$1(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) { */ case 3:
|
|
/* */ if (!((x$5 = new $Uint64(old.$high & mutexMask.$high, (old.$low & mutexMask.$low) >>> 0), (x$5.$high === 0 && x$5.$low === 0)))) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (!((x$5 = new $Uint64(old.$high & mutexMask.$high, (old.$low & mutexMask.$low) >>> 0), (x$5.$high === 0 && x$5.$low === 0)))) { */ case 5:
|
|
$r = runtime_Semrelease(mutexSema); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 6:
|
|
$s = -1; return (x$6 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388601) >>> 0), (x$6.$high === 0 && x$6.$low === 1));
|
|
/* } */ case 4:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return false;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: fdMutex.ptr.prototype.rwunlock }; } $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f.mu = mu; $f.mutexBit = mutexBit; $f.mutexMask = mutexMask; $f.mutexSema = mutexSema; $f.mutexWait = mutexWait; $f.new$1 = new$1; $f.old = old; $f.read = read; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
fdMutex.prototype.rwunlock = function(read) { return this.$val.rwunlock(read); };
|
|
FD.ptr.prototype.incref = function() {
|
|
var fd;
|
|
fd = this;
|
|
if (!fd.fdmu.incref()) {
|
|
return errClosing(fd.isFile);
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
FD.prototype.incref = function() { return this.$val.incref(); };
|
|
FD.ptr.prototype.decref = function() {
|
|
var _r, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
/* */ if (fd.fdmu.decref()) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (fd.fdmu.decref()) { */ case 1:
|
|
_r = fd.destroy(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.decref }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.decref = function() { return this.$val.decref(); };
|
|
FD.ptr.prototype.readLock = function() {
|
|
var _r, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
_r = fd.fdmu.rwlock(true); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!_r) { */ case 1:
|
|
$s = -1; return errClosing(fd.isFile);
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.readLock }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.readLock = function() { return this.$val.readLock(); };
|
|
FD.ptr.prototype.readUnlock = function() {
|
|
var _r, _r$1, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
_r = fd.fdmu.rwunlock(true); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r) { */ case 1:
|
|
_r$1 = fd.destroy(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
/* } */ case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.readUnlock }; } $f._r = _r; $f._r$1 = _r$1; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.readUnlock = function() { return this.$val.readUnlock(); };
|
|
FD.ptr.prototype.writeLock = function() {
|
|
var _r, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
_r = fd.fdmu.rwlock(false); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!_r) { */ case 1:
|
|
$s = -1; return errClosing(fd.isFile);
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.writeLock }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.writeLock = function() { return this.$val.writeLock(); };
|
|
FD.ptr.prototype.writeUnlock = function() {
|
|
var _r, _r$1, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
_r = fd.fdmu.rwunlock(false); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (_r) { */ case 1:
|
|
_r$1 = fd.destroy(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
/* } */ case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.writeUnlock }; } $f._r = _r; $f._r$1 = _r$1; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.writeUnlock = function() { return this.$val.writeUnlock(); };
|
|
FD.ptr.prototype.eofError = function(n, err) {
|
|
var err, fd, n;
|
|
fd = this;
|
|
if ((n === 0) && $interfaceIsEqual(err, $ifaceNil) && fd.ZeroReadIsEOF) {
|
|
return io.EOF;
|
|
}
|
|
return err;
|
|
};
|
|
FD.prototype.eofError = function(n, err) { return this.$val.eofError(n, err); };
|
|
FD.ptr.prototype.Fchmod = function(mode) {
|
|
var err, fd, mode, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; mode = $f.mode; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Fchmod(fd.Sysfd, mode);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchmod }; } $f.err = err; $f.fd = fd; $f.mode = mode; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Fchmod = function(mode) { return this.$val.Fchmod(mode); };
|
|
FD.ptr.prototype.Fchown = function(uid, gid) {
|
|
var err, fd, gid, uid, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; gid = $f.gid; uid = $f.uid; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Fchown(fd.Sysfd, uid, gid);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchown }; } $f.err = err; $f.fd = fd; $f.gid = gid; $f.uid = uid; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Fchown = function(uid, gid) { return this.$val.Fchown(uid, gid); };
|
|
FD.ptr.prototype.Ftruncate = function(size) {
|
|
var err, fd, size, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; size = $f.size; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Ftruncate(fd.Sysfd, size);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Ftruncate }; } $f.err = err; $f.fd = fd; $f.size = size; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Ftruncate = function(size) { return this.$val.Ftruncate(size); };
|
|
FD.ptr.prototype.Init = function(net, pollable) {
|
|
var err, fd, net, pollable;
|
|
fd = this;
|
|
if (net === "file") {
|
|
fd.isFile = true;
|
|
}
|
|
if (!pollable) {
|
|
fd.isBlocking = 1;
|
|
return $ifaceNil;
|
|
}
|
|
err = fd.pd.init(fd);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
fd.isBlocking = 1;
|
|
}
|
|
return err;
|
|
};
|
|
FD.prototype.Init = function(net, pollable) { return this.$val.Init(net, pollable); };
|
|
FD.ptr.prototype.destroy = function() {
|
|
var _r, err, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
fd.pd.close();
|
|
_r = $pkg.CloseFunc(fd.Sysfd); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
fd.Sysfd = -1;
|
|
$r = runtime_Semrelease((fd.$ptr_csema || (fd.$ptr_csema = new ptrType(function() { return this.$target.csema; }, function($v) { this.$target.csema = $v; }, fd)))); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.destroy }; } $f._r = _r; $f.err = err; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.destroy = function() { return this.$val.destroy(); };
|
|
FD.ptr.prototype.Close = function() {
|
|
var _r, _r$1, err, fd, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; err = $f.err; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
_r = fd.fdmu.increfAndClose(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!_r) { */ case 1:
|
|
$s = -1; return errClosing(fd.isFile);
|
|
/* } */ case 2:
|
|
fd.pd.evict();
|
|
_r$1 = fd.decref(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err = _r$1;
|
|
/* */ if (fd.isBlocking === 0) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (fd.isBlocking === 0) { */ case 5:
|
|
$r = runtime_Semacquire((fd.$ptr_csema || (fd.$ptr_csema = new ptrType(function() { return this.$target.csema; }, function($v) { this.$target.csema = $v; }, fd)))); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 6:
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Close }; } $f._r = _r; $f._r$1 = _r$1; $f.err = err; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.Close = function() { return this.$val.Close(); };
|
|
FD.ptr.prototype.Shutdown = function(how) {
|
|
var err, fd, how, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; how = $f.how; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Shutdown(fd.Sysfd, how);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Shutdown }; } $f.err = err; $f.fd = fd; $f.how = how; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Shutdown = function(how) { return this.$val.Shutdown(how); };
|
|
FD.ptr.prototype.SetBlocking = function() {
|
|
var err, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
atomic.StoreUint32((fd.$ptr_isBlocking || (fd.$ptr_isBlocking = new ptrType(function() { return this.$target.isBlocking; }, function($v) { this.$target.isBlocking = $v; }, fd))), 1);
|
|
$s = -1; return syscall.SetNonblock(fd.Sysfd, false);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetBlocking }; } $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetBlocking = function() { return this.$val.SetBlocking(); };
|
|
FD.ptr.prototype.Read = function(p) {
|
|
var _r, _tuple, err, err$1, err$2, fd, n, p, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.readLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "readUnlock"), []]);
|
|
if (p.$length === 0) {
|
|
$s = -1; return [0, $ifaceNil];
|
|
}
|
|
err$1 = fd.pd.prepareRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, err$1];
|
|
}
|
|
if (fd.IsStream && p.$length > 1073741824) {
|
|
p = $subslice(p, 0, 1073741824);
|
|
}
|
|
while (true) {
|
|
_tuple = syscall.Read(fd.Sysfd, p);
|
|
n = _tuple[0];
|
|
err$2 = _tuple[1];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
n = 0;
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitRead(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
continue;
|
|
}
|
|
}
|
|
if (false && $interfaceIsEqual(err$2, new syscall.Errno(4))) {
|
|
continue;
|
|
}
|
|
}
|
|
err$2 = fd.eofError(n, err$2);
|
|
$s = -1; return [n, err$2];
|
|
}
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Read }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Read = function(p) { return this.$val.Read(p); };
|
|
FD.ptr.prototype.Pread = function(p, off) {
|
|
var _r, _tuple, err, err$1, fd, n, off, p, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; fd = $f.fd; n = $f.n; off = $f.off; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
if (fd.IsStream && p.$length > 1073741824) {
|
|
p = $subslice(p, 0, 1073741824);
|
|
}
|
|
_tuple = syscall.Pread(fd.Sysfd, p, off);
|
|
n = _tuple[0];
|
|
err$1 = _tuple[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
n = 0;
|
|
}
|
|
_r = fd.decref(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
err$1 = fd.eofError(n, err$1);
|
|
$s = -1; return [n, err$1];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Pread }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.n = n; $f.off = off; $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.prototype.Pread = function(p, off) { return this.$val.Pread(p, off); };
|
|
FD.ptr.prototype.ReadFrom = function(p) {
|
|
var _r, _tuple, err, err$1, err$2, fd, n, p, sa, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.readLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, $ifaceNil, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "readUnlock"), []]);
|
|
err$1 = fd.pd.prepareRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, $ifaceNil, err$1];
|
|
}
|
|
while (true) {
|
|
_tuple = syscall.Recvfrom(fd.Sysfd, p, 0);
|
|
n = _tuple[0];
|
|
sa = _tuple[1];
|
|
err$2 = _tuple[2];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
n = 0;
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitRead(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
err$2 = fd.eofError(n, err$2);
|
|
$s = -1; return [n, sa, err$2];
|
|
}
|
|
$s = -1; return [0, $ifaceNil, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadFrom }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.ReadFrom = function(p) { return this.$val.ReadFrom(p); };
|
|
FD.ptr.prototype.ReadMsg = function(p, oob) {
|
|
var _r, _tuple, err, err$1, err$2, fd, flags, n, oob, oobn, p, sa, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; flags = $f.flags; n = $f.n; oob = $f.oob; oobn = $f.oobn; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.readLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, 0, 0, $ifaceNil, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "readUnlock"), []]);
|
|
err$1 = fd.pd.prepareRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, 0, 0, $ifaceNil, err$1];
|
|
}
|
|
while (true) {
|
|
_tuple = syscall.Recvmsg(fd.Sysfd, p, oob, 0);
|
|
n = _tuple[0];
|
|
oobn = _tuple[1];
|
|
flags = _tuple[2];
|
|
sa = _tuple[3];
|
|
err$2 = _tuple[4];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitRead(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
err$2 = fd.eofError(n, err$2);
|
|
$s = -1; return [n, oobn, flags, sa, err$2];
|
|
}
|
|
$s = -1; return [0, 0, 0, $ifaceNil, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, 0, 0, $ifaceNil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadMsg }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.flags = flags; $f.n = n; $f.oob = oob; $f.oobn = oobn; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.ReadMsg = function(p, oob) { return this.$val.ReadMsg(p, oob); };
|
|
FD.ptr.prototype.Write = function(p) {
|
|
var _r, _tuple, err, err$1, err$2, fd, max, n, nn, p, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; max = $f.max; n = $f.n; nn = $f.nn; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
err$1 = fd.pd.prepareWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, err$1];
|
|
}
|
|
nn = 0;
|
|
while (true) {
|
|
max = p.$length;
|
|
if (fd.IsStream && (max - nn >> 0) > 1073741824) {
|
|
max = nn + 1073741824 >> 0;
|
|
}
|
|
_tuple = syscall.Write(fd.Sysfd, $subslice(p, nn, max));
|
|
n = _tuple[0];
|
|
err$2 = _tuple[1];
|
|
if (n > 0) {
|
|
nn = nn + (n) >> 0;
|
|
}
|
|
if (nn === p.$length) {
|
|
$s = -1; return [nn, err$2];
|
|
}
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitWrite(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
continue;
|
|
}
|
|
}
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return [nn, err$2];
|
|
}
|
|
if (n === 0) {
|
|
$s = -1; return [nn, io.ErrUnexpectedEOF];
|
|
}
|
|
}
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Write }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.max = max; $f.n = n; $f.nn = nn; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Write = function(p) { return this.$val.Write(p); };
|
|
FD.ptr.prototype.Pwrite = function(p, off) {
|
|
var _tuple, err, err$1, fd, max, n, nn, off, p, x, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; fd = $f.fd; max = $f.max; n = $f.n; nn = $f.nn; off = $f.off; p = $f.p; x = $f.x; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
nn = 0;
|
|
while (true) {
|
|
max = p.$length;
|
|
if (fd.IsStream && (max - nn >> 0) > 1073741824) {
|
|
max = nn + 1073741824 >> 0;
|
|
}
|
|
_tuple = syscall.Pwrite(fd.Sysfd, $subslice(p, nn, max), (x = (new $Int64(0, nn)), new $Int64(off.$high + x.$high, off.$low + x.$low)));
|
|
n = _tuple[0];
|
|
err$1 = _tuple[1];
|
|
if (n > 0) {
|
|
nn = nn + (n) >> 0;
|
|
}
|
|
if (nn === p.$length) {
|
|
$s = -1; return [nn, err$1];
|
|
}
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [nn, err$1];
|
|
}
|
|
if (n === 0) {
|
|
$s = -1; return [nn, io.ErrUnexpectedEOF];
|
|
}
|
|
}
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Pwrite }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.max = max; $f.n = n; $f.nn = nn; $f.off = off; $f.p = p; $f.x = x; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Pwrite = function(p, off) { return this.$val.Pwrite(p, off); };
|
|
FD.ptr.prototype.WriteTo = function(p, sa) {
|
|
var _r, _r$1, err, err$1, err$2, fd, p, sa, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
err$1 = fd.pd.prepareWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, err$1];
|
|
}
|
|
/* while (true) { */ case 2:
|
|
_r$1 = syscall.Sendto(fd.Sysfd, p, 0, sa); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err$2 = _r$1;
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitWrite(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
}
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return [0, err$2];
|
|
}
|
|
$s = -1; return [p.$length, $ifaceNil];
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.WriteTo }; } $f._r = _r; $f._r$1 = _r$1; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.WriteTo = function(p, sa) { return this.$val.WriteTo(p, sa); };
|
|
FD.ptr.prototype.WriteMsg = function(p, oob, sa) {
|
|
var _r, _r$1, _tuple, err, err$1, err$2, fd, n, oob, p, sa, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; oob = $f.oob; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, 0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
err$1 = fd.pd.prepareWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [0, 0, err$1];
|
|
}
|
|
/* while (true) { */ case 2:
|
|
_r$1 = syscall.SendmsgN(fd.Sysfd, p, oob, sa, 0); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
n = _tuple[0];
|
|
err$2 = _tuple[1];
|
|
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitWrite(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
}
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return [n, 0, err$2];
|
|
}
|
|
$s = -1; return [n, oob.$length, err$2];
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return [0, 0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, 0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.WriteMsg }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.oob = oob; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.WriteMsg = function(p, oob, sa) { return this.$val.WriteMsg(p, oob, sa); };
|
|
FD.ptr.prototype.Accept = function() {
|
|
var _1, _r, _r$1, _tuple, err, err$1, err$2, errcall, fd, rsa, s, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; errcall = $f.errcall; fd = $f.fd; rsa = $f.rsa; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.readLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [-1, $ifaceNil, "", err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "readUnlock"), []]);
|
|
err$1 = fd.pd.prepareRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [-1, $ifaceNil, "", err$1];
|
|
}
|
|
/* while (true) { */ case 2:
|
|
_r$1 = accept(fd.Sysfd); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
s = _tuple[0];
|
|
rsa = _tuple[1];
|
|
errcall = _tuple[2];
|
|
err$2 = _tuple[3];
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
$s = -1; return [s, rsa, "", err$2];
|
|
}
|
|
_1 = err$2;
|
|
if ($interfaceIsEqual(_1, new syscall.Errno((11)))) {
|
|
if (fd.pd.pollable()) {
|
|
err$2 = fd.pd.waitRead(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
}
|
|
} else if ($interfaceIsEqual(_1, new syscall.Errno((103)))) {
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
$s = -1; return [-1, $ifaceNil, errcall, err$2];
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return [0, $ifaceNil, "", $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil, "", $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Accept }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.errcall = errcall; $f.fd = fd; $f.rsa = rsa; $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Accept = function() { return this.$val.Accept(); };
|
|
FD.ptr.prototype.Seek = function(offset, whence) {
|
|
var err, fd, offset, whence, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; offset = $f.offset; whence = $f.whence; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [new $Int64(0, 0), err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Seek(fd.Sysfd, offset, whence);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [new $Int64(0, 0), $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Seek }; } $f.err = err; $f.fd = fd; $f.offset = offset; $f.whence = whence; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Seek = function(offset, whence) { return this.$val.Seek(offset, whence); };
|
|
FD.ptr.prototype.ReadDirent = function(buf) {
|
|
var _tuple, buf, err, err$1, fd, n, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; buf = $f.buf; err = $f.err; err$1 = $f.err$1; fd = $f.fd; n = $f.n; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
while (true) {
|
|
_tuple = syscall.ReadDirent(fd.Sysfd, buf);
|
|
n = _tuple[0];
|
|
err$1 = _tuple[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
n = 0;
|
|
if ($interfaceIsEqual(err$1, new syscall.Errno(11)) && fd.pd.pollable()) {
|
|
err$1 = fd.pd.waitRead(fd.isFile);
|
|
if ($interfaceIsEqual(err$1, $ifaceNil)) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
$s = -1; return [n, err$1];
|
|
}
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadDirent }; } $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.n = n; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.ReadDirent = function(buf) { return this.$val.ReadDirent(buf); };
|
|
FD.ptr.prototype.Fchdir = function() {
|
|
var err, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Fchdir(fd.Sysfd);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchdir }; } $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Fchdir = function() { return this.$val.Fchdir(); };
|
|
FD.ptr.prototype.Fstat = function(s) {
|
|
var err, fd, s, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.Fstat(fd.Sysfd, s);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fstat }; } $f.err = err; $f.fd = fd; $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Fstat = function(s) { return this.$val.Fstat(s); };
|
|
DupCloseOnExec = function(fd) {
|
|
var _1, _r, _tuple, e1, fd, r0, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _tuple = $f._tuple; e1 = $f.e1; fd = $f.fd; r0 = $f.r0; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (atomic.LoadInt32((tryDupCloexec$24ptr || (tryDupCloexec$24ptr = new ptrType$2(function() { return tryDupCloexec; }, function($v) { tryDupCloexec = $v; })))) === 1) {
|
|
_tuple = fcntl(fd, 1030, 0);
|
|
r0 = _tuple[0];
|
|
e1 = _tuple[1];
|
|
if ($interfaceIsEqual(e1, $ifaceNil)) {
|
|
$s = -1; return [r0, "", $ifaceNil];
|
|
}
|
|
_1 = $assertType(e1, syscall.Errno);
|
|
if ((_1 === (22)) || (_1 === (38))) {
|
|
atomic.StoreInt32((tryDupCloexec$24ptr || (tryDupCloexec$24ptr = new ptrType$2(function() { return tryDupCloexec; }, function($v) { tryDupCloexec = $v; }))), 0);
|
|
} else {
|
|
$s = -1; return [-1, "fcntl", e1];
|
|
}
|
|
}
|
|
_r = dupCloseOnExecOld(fd); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: DupCloseOnExec }; } $f._1 = _1; $f._r = _r; $f._tuple = _tuple; $f.e1 = e1; $f.fd = fd; $f.r0 = r0; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.DupCloseOnExec = DupCloseOnExec;
|
|
dupCloseOnExecOld = function(fd) {
|
|
var _tuple, err, fd, newfd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; fd = $f.fd; newfd = $f.newfd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
$r = syscall.ForkLock.RLock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(syscall.ForkLock, "RUnlock"), []]);
|
|
_tuple = syscall.Dup(fd);
|
|
newfd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [-1, "dup", err];
|
|
}
|
|
syscall.CloseOnExec(newfd);
|
|
$s = -1; return [newfd, "", $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, "", $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: dupCloseOnExecOld }; } $f._tuple = _tuple; $f.err = err; $f.fd = fd; $f.newfd = newfd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.ptr.prototype.Dup = function() {
|
|
var _r, err, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [-1, "", err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
_r = DupCloseOnExec(fd.Sysfd); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, "", $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Dup }; } $f._r = _r; $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Dup = function() { return this.$val.Dup(); };
|
|
FD.ptr.prototype.WaitWrite = function() {
|
|
var fd;
|
|
fd = this;
|
|
return fd.pd.waitWrite(fd.isFile);
|
|
};
|
|
FD.prototype.WaitWrite = function() { return this.$val.WaitWrite(); };
|
|
FD.ptr.prototype.WriteOnce = function(p) {
|
|
var _r, err, fd, p, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; fd = $f.fd; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [0, err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
$s = -1; return syscall.Write(fd.Sysfd, p);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.WriteOnce }; } $f._r = _r; $f.err = err; $f.fd = fd; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.WriteOnce = function(p) { return this.$val.WriteOnce(p); };
|
|
FD.ptr.prototype.RawControl = function(f) {
|
|
var err, f, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$r = f(((fd.Sysfd >>> 0))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawControl }; } $f.err = err; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.RawControl = function(f) { return this.$val.RawControl(f); };
|
|
FD.ptr.prototype.RawRead = function(f) {
|
|
var _r, _r$1, err, err$1, err$2, f, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.readLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "readUnlock"), []]);
|
|
err$1 = fd.pd.prepareRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return err$1;
|
|
}
|
|
/* while (true) { */ case 2:
|
|
_r$1 = f(((fd.Sysfd >>> 0))); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_r$1) { */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 5:
|
|
err$2 = fd.pd.waitRead(fd.isFile);
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return err$2;
|
|
}
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawRead }; } $f._r = _r; $f._r$1 = _r$1; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.RawRead = function(f) { return this.$val.RawRead(f); };
|
|
FD.ptr.prototype.RawWrite = function(f) {
|
|
var _r, _r$1, err, err$1, err$2, f, fd, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
err$1 = fd.pd.prepareWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return err$1;
|
|
}
|
|
/* while (true) { */ case 2:
|
|
_r$1 = f(((fd.Sysfd >>> 0))); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_r$1) { */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 5:
|
|
err$2 = fd.pd.waitWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return err$2;
|
|
}
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawWrite }; } $f._r = _r; $f._r$1 = _r$1; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.RawWrite = function(f) { return this.$val.RawWrite(f); };
|
|
writev = function(fd, iovecs) {
|
|
var _tuple, e, fd, iovecs, r;
|
|
_tuple = syscall.Syscall(20, ((fd >>> 0)), (($sliceToArray(iovecs))), ((iovecs.$length >>> 0)));
|
|
r = _tuple[0];
|
|
e = _tuple[2];
|
|
if (!((e === 0))) {
|
|
return [r, new syscall.Errno((e))];
|
|
}
|
|
return [r, $ifaceNil];
|
|
};
|
|
accept = function(s) {
|
|
var _1, _r, _r$1, _r$2, _tuple, _tuple$1, err, ns, s, sa, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; err = $f.err; ns = $f.ns; s = $f.s; sa = $f.sa; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $pkg.Accept4Func(s, 526336); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
ns = _tuple[0];
|
|
sa = _tuple[1];
|
|
err = _tuple[2];
|
|
_1 = err;
|
|
if ($interfaceIsEqual(_1, $ifaceNil)) {
|
|
$s = -1; return [ns, sa, "", $ifaceNil];
|
|
} else if ($interfaceIsEqual(_1, new syscall.Errno((38)))) {
|
|
} else if ($interfaceIsEqual(_1, new syscall.Errno((22)))) {
|
|
} else if ($interfaceIsEqual(_1, new syscall.Errno((13)))) {
|
|
} else if ($interfaceIsEqual(_1, new syscall.Errno((14)))) {
|
|
} else {
|
|
$s = -1; return [-1, sa, "accept4", err];
|
|
}
|
|
_r$1 = $pkg.AcceptFunc(s); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
ns = _tuple$1[0];
|
|
sa = _tuple$1[1];
|
|
err = _tuple$1[2];
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
syscall.CloseOnExec(ns);
|
|
}
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [-1, $ifaceNil, "accept", err];
|
|
}
|
|
err = syscall.SetNonblock(ns, true);
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 3:
|
|
_r$2 = $pkg.CloseFunc(ns); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$2;
|
|
$s = -1; return [-1, $ifaceNil, "setnonblock", err];
|
|
/* } */ case 4:
|
|
$s = -1; return [ns, sa, "", $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: accept }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.err = err; $f.ns = ns; $f.s = s; $f.sa = sa; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
FD.ptr.prototype.SetsockoptInt = function(level, name, arg) {
|
|
var arg, err, fd, level, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptInt(fd.Sysfd, level, name, arg);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptInt }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptInt = function(level, name, arg) { return this.$val.SetsockoptInt(level, name, arg); };
|
|
FD.ptr.prototype.SetsockoptInet4Addr = function(level, name, arg) {
|
|
var arg, err, fd, level, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptInet4Addr(fd.Sysfd, level, name, $clone(arg, arrayType));
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptInet4Addr }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptInet4Addr = function(level, name, arg) { return this.$val.SetsockoptInet4Addr(level, name, arg); };
|
|
FD.ptr.prototype.SetsockoptLinger = function(level, name, l) {
|
|
var err, fd, l, level, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; l = $f.l; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptLinger(fd.Sysfd, level, name, l);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptLinger }; } $f.err = err; $f.fd = fd; $f.l = l; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptLinger = function(level, name, l) { return this.$val.SetsockoptLinger(level, name, l); };
|
|
FD.ptr.prototype.SetsockoptIPMreqn = function(level, name, mreq) {
|
|
var err, fd, level, mreq, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptIPMreqn(fd.Sysfd, level, name, mreq);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPMreqn }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptIPMreqn = function(level, name, mreq) { return this.$val.SetsockoptIPMreqn(level, name, mreq); };
|
|
FD.ptr.prototype.SetsockoptByte = function(level, name, arg) {
|
|
var arg, err, fd, level, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptByte(fd.Sysfd, level, name, arg);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptByte }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptByte = function(level, name, arg) { return this.$val.SetsockoptByte(level, name, arg); };
|
|
FD.ptr.prototype.SetsockoptIPMreq = function(level, name, mreq) {
|
|
var err, fd, level, mreq, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptIPMreq(fd.Sysfd, level, name, mreq);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPMreq }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptIPMreq = function(level, name, mreq) { return this.$val.SetsockoptIPMreq(level, name, mreq); };
|
|
FD.ptr.prototype.SetsockoptIPv6Mreq = function(level, name, mreq) {
|
|
var err, fd, level, mreq, name, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
fd = this;
|
|
err = fd.incref();
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
$deferred.push([$methodVal(fd, "decref"), []]);
|
|
$s = -1; return syscall.SetsockoptIPv6Mreq(fd.Sysfd, level, name, mreq);
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPv6Mreq }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.SetsockoptIPv6Mreq = function(level, name, mreq) { return this.$val.SetsockoptIPv6Mreq(level, name, mreq); };
|
|
FD.ptr.prototype.Writev = function(v) {
|
|
var _i, _r, _ref, _tuple, chunk, err, err$1, err$2, fd, iovecs, maxVec, n, v, wrote, x, x$1, x$2, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _tuple = $f._tuple; chunk = $f.chunk; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; iovecs = $f.iovecs; maxVec = $f.maxVec; n = $f.n; v = $f.v; wrote = $f.wrote; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
iovecs = [iovecs];
|
|
fd = this;
|
|
_r = fd.writeLock(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [new $Int64(0, 0), err];
|
|
}
|
|
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
|
|
err$1 = fd.pd.prepareWrite(fd.isFile);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [new $Int64(0, 0), err$1];
|
|
}
|
|
iovecs[0] = sliceType$2.nil;
|
|
if (!(fd.iovecs === ptrType$6.nil)) {
|
|
iovecs[0] = fd.iovecs.$get();
|
|
}
|
|
maxVec = 1024;
|
|
n = new $Int64(0, 0);
|
|
err$2 = $ifaceNil;
|
|
/* while (true) { */ case 2:
|
|
/* if (!(v.$get().$length > 0)) { break; } */ if(!(v.$get().$length > 0)) { $s = 3; continue; }
|
|
iovecs[0] = $subslice(iovecs[0], 0, 0);
|
|
_ref = v.$get();
|
|
_i = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
|
|
chunk = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (chunk.$length === 0) {
|
|
_i++;
|
|
/* continue; */ $s = 4; continue;
|
|
}
|
|
iovecs[0] = $append(iovecs[0], new syscall.Iovec.ptr($indexPtr(chunk.$array, chunk.$offset + 0, ptrType$7), new $Uint64(0, 0)));
|
|
if (fd.IsStream && chunk.$length > 1073741824) {
|
|
(x = iovecs[0].$length - 1 >> 0, ((x < 0 || x >= iovecs[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : iovecs[0].$array[iovecs[0].$offset + x])).SetLen(1073741824);
|
|
/* break; */ $s = 5; continue;
|
|
}
|
|
(x$1 = iovecs[0].$length - 1 >> 0, ((x$1 < 0 || x$1 >= iovecs[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : iovecs[0].$array[iovecs[0].$offset + x$1])).SetLen(chunk.$length);
|
|
if (iovecs[0].$length === maxVec) {
|
|
/* break; */ $s = 5; continue;
|
|
}
|
|
_i++;
|
|
/* } */ $s = 4; continue; case 5:
|
|
if (iovecs[0].$length === 0) {
|
|
/* break; */ $s = 3; continue;
|
|
}
|
|
fd.iovecs = (iovecs.$ptr || (iovecs.$ptr = new ptrType$6(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, iovecs)));
|
|
wrote = 0;
|
|
_tuple = writev(fd.Sysfd, iovecs[0]);
|
|
wrote = _tuple[0];
|
|
err$2 = _tuple[1];
|
|
if (wrote === 4294967295) {
|
|
wrote = 0;
|
|
}
|
|
$r = $pkg.TestHookDidWritev(((wrote >> 0))); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
n = (x$2 = (new $Int64(0, wrote.constructor === Number ? wrote : 1)), new $Int64(n.$high + x$2.$high, n.$low + x$2.$low));
|
|
consume(v, (new $Int64(0, wrote.constructor === Number ? wrote : 1)));
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
if ($assertType(err$2, syscall.Errno) === 11) {
|
|
err$2 = fd.pd.waitWrite(fd.isFile);
|
|
if ($interfaceIsEqual(err$2, $ifaceNil)) {
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
}
|
|
/* break; */ $s = 3; continue;
|
|
}
|
|
if ((n.$high === 0 && n.$low === 0)) {
|
|
err$2 = io.ErrUnexpectedEOF;
|
|
/* break; */ $s = 3; continue;
|
|
}
|
|
/* } */ $s = 2; continue; case 3:
|
|
$s = -1; return [n, err$2];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [new $Int64(0, 0), $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Writev }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._tuple = _tuple; $f.chunk = chunk; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.iovecs = iovecs; $f.maxVec = maxVec; $f.n = n; $f.v = v; $f.wrote = wrote; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
FD.prototype.Writev = function(v) { return this.$val.Writev(v); };
|
|
ptrType$9.methods = [{prop: "init", name: "init", pkg: "internal/poll", typ: $funcType([ptrType$8], [$error], false)}, {prop: "close", name: "close", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "evict", name: "evict", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "prepare", name: "prepare", pkg: "internal/poll", typ: $funcType([$Int, $Bool], [$error], false)}, {prop: "prepareRead", name: "prepareRead", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "prepareWrite", name: "prepareWrite", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "wait", name: "wait", pkg: "internal/poll", typ: $funcType([$Int, $Bool], [$error], false)}, {prop: "waitRead", name: "waitRead", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "waitWrite", name: "waitWrite", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "waitCanceled", name: "waitCanceled", pkg: "internal/poll", typ: $funcType([$Int], [], false)}, {prop: "pollable", name: "pollable", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$10.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$11.methods = [{prop: "incref", name: "incref", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "increfAndClose", name: "increfAndClose", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "decref", name: "decref", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "rwlock", name: "rwlock", pkg: "internal/poll", typ: $funcType([$Bool], [$Bool], false)}, {prop: "rwunlock", name: "rwunlock", pkg: "internal/poll", typ: $funcType([$Bool], [$Bool], false)}];
|
|
ptrType$8.methods = [{prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetReadDeadline", name: "SetReadDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetWriteDeadline", name: "SetWriteDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "Fsync", name: "Fsync", pkg: "", typ: $funcType([], [$error], false)}, {prop: "incref", name: "incref", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "decref", name: "decref", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "readLock", name: "readLock", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "readUnlock", name: "readUnlock", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "writeLock", name: "writeLock", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "writeUnlock", name: "writeUnlock", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "eofError", name: "eofError", pkg: "internal/poll", typ: $funcType([$Int, $error], [$error], false)}, {prop: "Fchmod", name: "Fchmod", pkg: "", typ: $funcType([$Uint32], [$error], false)}, {prop: "Fchown", name: "Fchown", pkg: "", typ: $funcType([$Int, $Int], [$error], false)}, {prop: "Ftruncate", name: "Ftruncate", pkg: "", typ: $funcType([$Int64], [$error], false)}, {prop: "Init", name: "Init", pkg: "", typ: $funcType([$String, $Bool], [$error], false)}, {prop: "destroy", name: "destroy", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Shutdown", name: "Shutdown", pkg: "", typ: $funcType([$Int], [$error], false)}, {prop: "SetBlocking", name: "SetBlocking", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$3], [$Int, $error], false)}, {prop: "Pread", name: "Pread", pkg: "", typ: $funcType([sliceType$3, $Int64], [$Int, $error], false)}, {prop: "ReadFrom", name: "ReadFrom", pkg: "", typ: $funcType([sliceType$3], [$Int, syscall.Sockaddr, $error], false)}, {prop: "ReadMsg", name: "ReadMsg", pkg: "", typ: $funcType([sliceType$3, sliceType$3], [$Int, $Int, $Int, syscall.Sockaddr, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$3], [$Int, $error], false)}, {prop: "Pwrite", name: "Pwrite", pkg: "", typ: $funcType([sliceType$3, $Int64], [$Int, $error], false)}, {prop: "WriteTo", name: "WriteTo", pkg: "", typ: $funcType([sliceType$3, syscall.Sockaddr], [$Int, $error], false)}, {prop: "WriteMsg", name: "WriteMsg", pkg: "", typ: $funcType([sliceType$3, sliceType$3, syscall.Sockaddr], [$Int, $Int, $error], false)}, {prop: "Accept", name: "Accept", pkg: "", typ: $funcType([], [$Int, syscall.Sockaddr, $String, $error], false)}, {prop: "Seek", name: "Seek", pkg: "", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "ReadDirent", name: "ReadDirent", pkg: "", typ: $funcType([sliceType$3], [$Int, $error], false)}, {prop: "Fchdir", name: "Fchdir", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Fstat", name: "Fstat", pkg: "", typ: $funcType([ptrType$12], [$error], false)}, {prop: "Dup", name: "Dup", pkg: "", typ: $funcType([], [$Int, $String, $error], false)}, {prop: "WaitWrite", name: "WaitWrite", pkg: "", typ: $funcType([], [$error], false)}, {prop: "WriteOnce", name: "WriteOnce", pkg: "", typ: $funcType([sliceType$3], [$Int, $error], false)}, {prop: "RawControl", name: "RawControl", pkg: "", typ: $funcType([funcType], [$error], false)}, {prop: "RawRead", name: "RawRead", pkg: "", typ: $funcType([funcType$1], [$error], false)}, {prop: "RawWrite", name: "RawWrite", pkg: "", typ: $funcType([funcType$1], [$error], false)}, {prop: "SetsockoptInt", name: "SetsockoptInt", pkg: "", typ: $funcType([$Int, $Int, $Int], [$error], false)}, {prop: "SetsockoptInet4Addr", name: "SetsockoptInet4Addr", pkg: "", typ: $funcType([$Int, $Int, arrayType], [$error], false)}, {prop: "SetsockoptLinger", name: "SetsockoptLinger", pkg: "", typ: $funcType([$Int, $Int, ptrType$13], [$error], false)}, {prop: "SetsockoptIPMreqn", name: "SetsockoptIPMreqn", pkg: "", typ: $funcType([$Int, $Int, ptrType$14], [$error], false)}, {prop: "SetsockoptByte", name: "SetsockoptByte", pkg: "", typ: $funcType([$Int, $Int, $Uint8], [$error], false)}, {prop: "SetsockoptIPMreq", name: "SetsockoptIPMreq", pkg: "", typ: $funcType([$Int, $Int, ptrType$15], [$error], false)}, {prop: "SetsockoptIPv6Mreq", name: "SetsockoptIPv6Mreq", pkg: "", typ: $funcType([$Int, $Int, ptrType$16], [$error], false)}, {prop: "Writev", name: "Writev", pkg: "", typ: $funcType([ptrType$17], [$Int64, $error], false)}];
|
|
pollDesc.init("internal/poll", [{prop: "closing", name: "closing", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
TimeoutError.init("", []);
|
|
fdMutex.init("internal/poll", [{prop: "state", name: "state", embedded: false, exported: false, typ: $Uint64, tag: ""}, {prop: "rsema", name: "rsema", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "wsema", name: "wsema", embedded: false, exported: false, typ: $Uint32, tag: ""}]);
|
|
FD.init("internal/poll", [{prop: "fdmu", name: "fdmu", embedded: false, exported: false, typ: fdMutex, tag: ""}, {prop: "Sysfd", name: "Sysfd", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "pd", name: "pd", embedded: false, exported: false, typ: pollDesc, tag: ""}, {prop: "iovecs", name: "iovecs", embedded: false, exported: false, typ: ptrType$6, tag: ""}, {prop: "csema", name: "csema", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "isBlocking", name: "isBlocking", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "IsStream", name: "IsStream", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "ZeroReadIsEOF", name: "ZeroReadIsEOF", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "isFile", name: "isFile", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syscall.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
semWaiters = {};
|
|
$pkg.ErrNetClosing = errors.New("use of closed network connection");
|
|
$pkg.ErrFileClosing = errors.New("use of closed file");
|
|
$pkg.ErrNoDeadline = errors.New("file type does not support deadline");
|
|
$pkg.ErrTimeout = new TimeoutError.ptr();
|
|
$pkg.TestHookDidWritev = (function(wrote) {
|
|
var wrote;
|
|
});
|
|
tryDupCloexec = 1;
|
|
$pkg.Accept4Func = syscall.Accept4;
|
|
$pkg.CloseFunc = syscall.Close;
|
|
$pkg.AcceptFunc = syscall.Accept;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/syscall/unix"] = (function() {
|
|
var $pkg = {}, $init, atomic, syscall, IsNonblock;
|
|
atomic = $packages["sync/atomic"];
|
|
syscall = $packages["syscall"];
|
|
IsNonblock = function(fd) {
|
|
var _tmp, _tmp$1, err, fd, nonblocking;
|
|
nonblocking = false;
|
|
err = $ifaceNil;
|
|
_tmp = false;
|
|
_tmp$1 = $ifaceNil;
|
|
nonblocking = _tmp;
|
|
err = _tmp$1;
|
|
return [nonblocking, err];
|
|
};
|
|
$pkg.IsNonblock = IsNonblock;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = atomic.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syscall.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/testlog"] = (function() {
|
|
var $pkg = {}, $init, atomic, Interface, ptrType, logger, Logger, Open, Stat;
|
|
atomic = $packages["sync/atomic"];
|
|
Interface = $pkg.Interface = $newType(8, $kindInterface, "testlog.Interface", true, "internal/testlog", true, null);
|
|
ptrType = $ptrType(Interface);
|
|
Logger = function() {
|
|
var impl;
|
|
impl = logger.Load();
|
|
if ($interfaceIsEqual(impl, $ifaceNil)) {
|
|
return $ifaceNil;
|
|
}
|
|
return $assertType(impl, ptrType).$get();
|
|
};
|
|
$pkg.Logger = Logger;
|
|
Open = function(name) {
|
|
var log, name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; log = $f.log; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
log = Logger();
|
|
/* */ if (!($interfaceIsEqual(log, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(log, $ifaceNil))) { */ case 1:
|
|
$r = log.Open(name); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Open }; } $f.log = log; $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Open = Open;
|
|
Stat = function(name) {
|
|
var log, name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; log = $f.log; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
log = Logger();
|
|
/* */ if (!($interfaceIsEqual(log, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(log, $ifaceNil))) { */ case 1:
|
|
$r = log.Stat(name); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stat }; } $f.log = log; $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Stat = Stat;
|
|
Interface.init([{prop: "Chdir", name: "Chdir", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Getenv", name: "Getenv", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Open", name: "Open", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Stat", name: "Stat", pkg: "", typ: $funcType([$String], [], false)}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = atomic.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
logger = new atomic.Value.ptr($ifaceNil);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["os"] = (function() {
|
|
var $pkg = {}, $init, errors, js, poll, unix, testlog, io, runtime, sync, atomic, syscall, time, dirInfo, timeout, PathError, SyscallError, LinkError, file, rawConn, File, FileInfo, FileMode, fileStat, sliceType, ptrType, sliceType$1, ptrType$1, sliceType$2, ptrType$2, ptrType$3, ptrType$4, sliceType$5, ptrType$12, arrayType$1, ptrType$13, funcType$1, ptrType$15, arrayType$6, ptrType$16, funcType$2, funcType$3, ptrType$18, errFinished, lstat, runtime_args, init, runtime_beforeExit, NewSyscallError, IsNotExist, underlyingError, wrapSyscallError, isNotExist, setStickyBit, Open, OpenFile, Chmod, sigpipe, syscallMode, chmod, fixLongPath, NewFile, newFile, epipecheck, openFileNolog, basename, init$1, Exit, newRawConn, Stat, Lstat, fillFileStatFromSys, timespecToTime, statNolog, lstatNolog;
|
|
errors = $packages["errors"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
poll = $packages["internal/poll"];
|
|
unix = $packages["internal/syscall/unix"];
|
|
testlog = $packages["internal/testlog"];
|
|
io = $packages["io"];
|
|
runtime = $packages["runtime"];
|
|
sync = $packages["sync"];
|
|
atomic = $packages["sync/atomic"];
|
|
syscall = $packages["syscall"];
|
|
time = $packages["time"];
|
|
dirInfo = $pkg.dirInfo = $newType(0, $kindStruct, "os.dirInfo", true, "os", false, function(buf_, nbuf_, bufp_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.buf = sliceType$2.nil;
|
|
this.nbuf = 0;
|
|
this.bufp = 0;
|
|
return;
|
|
}
|
|
this.buf = buf_;
|
|
this.nbuf = nbuf_;
|
|
this.bufp = bufp_;
|
|
});
|
|
timeout = $pkg.timeout = $newType(8, $kindInterface, "os.timeout", true, "os", false, null);
|
|
PathError = $pkg.PathError = $newType(0, $kindStruct, "os.PathError", true, "os", true, function(Op_, Path_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = "";
|
|
this.Path = "";
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.Path = Path_;
|
|
this.Err = Err_;
|
|
});
|
|
SyscallError = $pkg.SyscallError = $newType(0, $kindStruct, "os.SyscallError", true, "os", true, function(Syscall_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Syscall = "";
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Syscall = Syscall_;
|
|
this.Err = Err_;
|
|
});
|
|
LinkError = $pkg.LinkError = $newType(0, $kindStruct, "os.LinkError", true, "os", true, function(Op_, Old_, New_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = "";
|
|
this.Old = "";
|
|
this.New = "";
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.Old = Old_;
|
|
this.New = New_;
|
|
this.Err = Err_;
|
|
});
|
|
file = $pkg.file = $newType(0, $kindStruct, "os.file", true, "os", false, function(pfd_, name_, dirinfo_, nonblock_, stdoutOrErr_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.pfd = new poll.FD.ptr(new poll.fdMutex.ptr(new $Uint64(0, 0), 0, 0), 0, new poll.pollDesc.ptr(false), ptrType$12.nil, 0, 0, false, false, false);
|
|
this.name = "";
|
|
this.dirinfo = ptrType$1.nil;
|
|
this.nonblock = false;
|
|
this.stdoutOrErr = false;
|
|
return;
|
|
}
|
|
this.pfd = pfd_;
|
|
this.name = name_;
|
|
this.dirinfo = dirinfo_;
|
|
this.nonblock = nonblock_;
|
|
this.stdoutOrErr = stdoutOrErr_;
|
|
});
|
|
rawConn = $pkg.rawConn = $newType(0, $kindStruct, "os.rawConn", true, "os", false, function(file_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.file = ptrType.nil;
|
|
return;
|
|
}
|
|
this.file = file_;
|
|
});
|
|
File = $pkg.File = $newType(0, $kindStruct, "os.File", true, "os", true, function(file_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.file = ptrType$13.nil;
|
|
return;
|
|
}
|
|
this.file = file_;
|
|
});
|
|
FileInfo = $pkg.FileInfo = $newType(8, $kindInterface, "os.FileInfo", true, "os", true, null);
|
|
FileMode = $pkg.FileMode = $newType(4, $kindUint32, "os.FileMode", true, "os", true, null);
|
|
fileStat = $pkg.fileStat = $newType(0, $kindStruct, "os.fileStat", true, "os", false, function(name_, size_, mode_, modTime_, sys_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.name = "";
|
|
this.size = new $Int64(0, 0);
|
|
this.mode = 0;
|
|
this.modTime = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil);
|
|
this.sys = new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$1.zero());
|
|
return;
|
|
}
|
|
this.name = name_;
|
|
this.size = size_;
|
|
this.mode = mode_;
|
|
this.modTime = modTime_;
|
|
this.sys = sys_;
|
|
});
|
|
sliceType = $sliceType($String);
|
|
ptrType = $ptrType(File);
|
|
sliceType$1 = $sliceType(FileInfo);
|
|
ptrType$1 = $ptrType(dirInfo);
|
|
sliceType$2 = $sliceType($Uint8);
|
|
ptrType$2 = $ptrType(PathError);
|
|
ptrType$3 = $ptrType(LinkError);
|
|
ptrType$4 = $ptrType(SyscallError);
|
|
sliceType$5 = $sliceType(syscall.Iovec);
|
|
ptrType$12 = $ptrType(sliceType$5);
|
|
arrayType$1 = $arrayType($Int64, 3);
|
|
ptrType$13 = $ptrType(file);
|
|
funcType$1 = $funcType([ptrType$13], [$error], false);
|
|
ptrType$15 = $ptrType(time.Location);
|
|
arrayType$6 = $arrayType($Uint8, 32);
|
|
ptrType$16 = $ptrType(fileStat);
|
|
funcType$2 = $funcType([$Uintptr], [], false);
|
|
funcType$3 = $funcType([$Uintptr], [$Bool], false);
|
|
ptrType$18 = $ptrType(rawConn);
|
|
runtime_args = function() {
|
|
return $pkg.Args;
|
|
};
|
|
init = function() {
|
|
var argv, i, process;
|
|
process = $global.process;
|
|
if (!(process === undefined)) {
|
|
argv = process.argv;
|
|
$pkg.Args = $makeSlice(sliceType, ($parseInt(argv.length) - 1 >> 0));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < ($parseInt(argv.length) - 1 >> 0))) { break; }
|
|
((i < 0 || i >= $pkg.Args.$length) ? ($throwRuntimeError("index out of range"), undefined) : $pkg.Args.$array[$pkg.Args.$offset + i] = $internalize(argv[(i + 1 >> 0)], $String));
|
|
i = i + (1) >> 0;
|
|
}
|
|
}
|
|
if ($pkg.Args.$length === 0) {
|
|
$pkg.Args = new sliceType(["?"]);
|
|
}
|
|
};
|
|
runtime_beforeExit = function() {
|
|
};
|
|
File.ptr.prototype.Readdir = function(n) {
|
|
var _r, f, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
$s = -1; return [sliceType$1.nil, $pkg.ErrInvalid];
|
|
}
|
|
_r = f.readdir(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Readdir }; } $f._r = _r; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Readdir = function(n) { return this.$val.Readdir(n); };
|
|
File.ptr.prototype.Readdirnames = function(n) {
|
|
var _r, _tmp, _tmp$1, _tuple, err, f, n, names, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; err = $f.err; f = $f.f; n = $f.n; names = $f.names; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
names = sliceType.nil;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
_tmp = sliceType.nil;
|
|
_tmp$1 = $pkg.ErrInvalid;
|
|
names = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [names, err];
|
|
}
|
|
_r = f.readdirnames(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
names = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [names, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Readdirnames }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.n = n; $f.names = names; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Readdirnames = function(n) { return this.$val.Readdirnames(n); };
|
|
dirInfo.ptr.prototype.close = function() {
|
|
var d;
|
|
d = this;
|
|
};
|
|
dirInfo.prototype.close = function() { return this.$val.close(); };
|
|
File.ptr.prototype.readdirnames = function(n) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, _tuple$1, d, err, errno, f, n, names, nb, nc, size, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; d = $f.d; err = $f.err; errno = $f.errno; f = $f.f; n = $f.n; names = $f.names; nb = $f.nb; nc = $f.nc; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
names = sliceType.nil;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
if (f.file.dirinfo === ptrType$1.nil) {
|
|
f.file.dirinfo = new dirInfo.ptr(sliceType$2.nil, 0, 0);
|
|
f.file.dirinfo.buf = $makeSlice(sliceType$2, 8192);
|
|
}
|
|
d = f.file.dirinfo;
|
|
size = n;
|
|
if (size <= 0) {
|
|
size = 100;
|
|
n = -1;
|
|
}
|
|
names = $makeSlice(sliceType, 0, size);
|
|
/* while (true) { */ case 1:
|
|
/* if (!(!((n === 0)))) { break; } */ if(!(!((n === 0)))) { $s = 2; continue; }
|
|
/* */ if (d.bufp >= d.nbuf) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (d.bufp >= d.nbuf) { */ case 3:
|
|
d.bufp = 0;
|
|
errno = $ifaceNil;
|
|
_r = f.file.pfd.ReadDirent(d.buf); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
d.nbuf = _tuple[0];
|
|
errno = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
if (!($interfaceIsEqual(errno, $ifaceNil))) {
|
|
_tmp = names;
|
|
_tmp$1 = wrapSyscallError("readdirent", errno);
|
|
names = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [names, err];
|
|
}
|
|
if (d.nbuf <= 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
/* } */ case 4:
|
|
_tmp$2 = 0;
|
|
_tmp$3 = 0;
|
|
nb = _tmp$2;
|
|
nc = _tmp$3;
|
|
_tuple$1 = syscall.ParseDirent($subslice(d.buf, d.bufp, d.nbuf), n, names);
|
|
nb = _tuple$1[0];
|
|
nc = _tuple$1[1];
|
|
names = _tuple$1[2];
|
|
d.bufp = d.bufp + (nb) >> 0;
|
|
n = n - (nc) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (n >= 0 && (names.$length === 0)) {
|
|
_tmp$4 = names;
|
|
_tmp$5 = io.EOF;
|
|
names = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [names, err];
|
|
}
|
|
_tmp$6 = names;
|
|
_tmp$7 = $ifaceNil;
|
|
names = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [names, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.readdirnames }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.d = d; $f.err = err; $f.errno = errno; $f.f = f; $f.n = n; $f.names = names; $f.nb = nb; $f.nc = nc; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.readdirnames = function(n) { return this.$val.readdirnames(n); };
|
|
PathError.ptr.prototype.Error = function() {
|
|
var _r, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return e.Op + " " + e.Path + ": " + _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: PathError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
PathError.prototype.Error = function() { return this.$val.Error(); };
|
|
PathError.ptr.prototype.Timeout = function() {
|
|
var _r, _tuple, _v, e, ok, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _v = $f._v; e = $f.e; ok = $f.ok; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_tuple = $assertType(e.Err, timeout, true);
|
|
t = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!(ok)) { _v = false; $s = 1; continue s; }
|
|
_r = t.Timeout(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 1:
|
|
$s = -1; return _v;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: PathError.ptr.prototype.Timeout }; } $f._r = _r; $f._tuple = _tuple; $f._v = _v; $f.e = e; $f.ok = ok; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
PathError.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
SyscallError.ptr.prototype.Error = function() {
|
|
var _r, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return e.Syscall + ": " + _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: SyscallError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
SyscallError.prototype.Error = function() { return this.$val.Error(); };
|
|
SyscallError.ptr.prototype.Timeout = function() {
|
|
var _r, _tuple, _v, e, ok, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _v = $f._v; e = $f.e; ok = $f.ok; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_tuple = $assertType(e.Err, timeout, true);
|
|
t = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!(ok)) { _v = false; $s = 1; continue s; }
|
|
_r = t.Timeout(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 1:
|
|
$s = -1; return _v;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: SyscallError.ptr.prototype.Timeout }; } $f._r = _r; $f._tuple = _tuple; $f._v = _v; $f.e = e; $f.ok = ok; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
SyscallError.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
NewSyscallError = function(syscall$1, err) {
|
|
var err, syscall$1;
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
return $ifaceNil;
|
|
}
|
|
return new SyscallError.ptr(syscall$1, err);
|
|
};
|
|
$pkg.NewSyscallError = NewSyscallError;
|
|
IsNotExist = function(err) {
|
|
var err;
|
|
return isNotExist(err);
|
|
};
|
|
$pkg.IsNotExist = IsNotExist;
|
|
underlyingError = function(err) {
|
|
var _ref, err, err$1, err$2, err$3;
|
|
_ref = err;
|
|
if ($assertType(_ref, ptrType$2, true)[1]) {
|
|
err$1 = _ref.$val;
|
|
return err$1.Err;
|
|
} else if ($assertType(_ref, ptrType$3, true)[1]) {
|
|
err$2 = _ref.$val;
|
|
return err$2.Err;
|
|
} else if ($assertType(_ref, ptrType$4, true)[1]) {
|
|
err$3 = _ref.$val;
|
|
return err$3.Err;
|
|
}
|
|
return err;
|
|
};
|
|
wrapSyscallError = function(name, err) {
|
|
var _tuple, err, name, ok;
|
|
_tuple = $assertType(err, syscall.Errno, true);
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
err = NewSyscallError(name, err);
|
|
}
|
|
return err;
|
|
};
|
|
isNotExist = function(err) {
|
|
var err;
|
|
err = underlyingError(err);
|
|
return $interfaceIsEqual(err, new syscall.Errno(2)) || $interfaceIsEqual(err, $pkg.ErrNotExist);
|
|
};
|
|
File.ptr.prototype.Name = function() {
|
|
var f;
|
|
f = this;
|
|
return f.file.name;
|
|
};
|
|
File.prototype.Name = function() { return this.$val.Name(); };
|
|
LinkError.ptr.prototype.Error = function() {
|
|
var _r, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return e.Op + " " + e.Old + " " + e.New + ": " + _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: LinkError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
LinkError.prototype.Error = function() { return this.$val.Error(); };
|
|
File.ptr.prototype.Read = function(b) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
err$1 = f.checkValid("read");
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err$1;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
_r = f.read(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
e = _tuple[1];
|
|
_tmp$2 = n;
|
|
_tmp$3 = f.wrapErr("read", e);
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Read = function(b) { return this.$val.Read(b); };
|
|
File.ptr.prototype.ReadAt = function(b, off) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, m, n, off, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; m = $f.m; n = $f.n; off = $f.off; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
err$1 = f.checkValid("read");
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err$1;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
if ((off.$high < 0 || (off.$high === 0 && off.$low < 0))) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = new PathError.ptr("readat", f.file.name, errors.New("negative offset"));
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* while (true) { */ case 1:
|
|
/* if (!(b.$length > 0)) { break; } */ if(!(b.$length > 0)) { $s = 2; continue; }
|
|
_r = f.pread(b, off); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
m = _tuple[0];
|
|
e = _tuple[1];
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
err = f.wrapErr("read", e);
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
n = n + (m) >> 0;
|
|
b = $subslice(b, m);
|
|
off = (x = (new $Int64(0, m)), new $Int64(off.$high + x.$high, off.$low + x.$low));
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.ReadAt }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.m = m; $f.n = n; $f.off = off; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.ReadAt = function(b, off) { return this.$val.ReadAt(b, off); };
|
|
File.ptr.prototype.Write = function(b) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
err$1 = f.checkValid("write");
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err$1;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
_r = f.write(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
e = _tuple[1];
|
|
if (n < 0) {
|
|
n = 0;
|
|
}
|
|
if (!((n === b.$length))) {
|
|
err = io.ErrShortWrite;
|
|
}
|
|
epipecheck(f, e);
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
err = f.wrapErr("write", e);
|
|
}
|
|
_tmp$2 = n;
|
|
_tmp$3 = err;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Write }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Write = function(b) { return this.$val.Write(b); };
|
|
File.ptr.prototype.WriteAt = function(b, off) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, m, n, off, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; m = $f.m; n = $f.n; off = $f.off; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
err$1 = f.checkValid("write");
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err$1;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
if ((off.$high < 0 || (off.$high === 0 && off.$low < 0))) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = new PathError.ptr("writeat", f.file.name, errors.New("negative offset"));
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* while (true) { */ case 1:
|
|
/* if (!(b.$length > 0)) { break; } */ if(!(b.$length > 0)) { $s = 2; continue; }
|
|
_r = f.pwrite(b, off); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
m = _tuple[0];
|
|
e = _tuple[1];
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
err = f.wrapErr("write", e);
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
n = n + (m) >> 0;
|
|
b = $subslice(b, m);
|
|
off = (x = (new $Int64(0, m)), new $Int64(off.$high + x.$high, off.$low + x.$low));
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.WriteAt }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.m = m; $f.n = n; $f.off = off; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.WriteAt = function(b, off) { return this.$val.WriteAt(b, off); };
|
|
File.ptr.prototype.Seek = function(offset, whence) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, e, err, err$1, f, offset, r, ret, whence, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; offset = $f.offset; r = $f.r; ret = $f.ret; whence = $f.whence; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ret = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
f = this;
|
|
err$1 = f.checkValid("seek");
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp = new $Int64(0, 0);
|
|
_tmp$1 = err$1;
|
|
ret = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [ret, err];
|
|
}
|
|
_r = f.seek(offset, whence); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
e = _tuple[1];
|
|
if ($interfaceIsEqual(e, $ifaceNil) && !(f.file.dirinfo === ptrType$1.nil) && !((r.$high === 0 && r.$low === 0))) {
|
|
e = new syscall.Errno(21);
|
|
}
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
_tmp$2 = new $Int64(0, 0);
|
|
_tmp$3 = f.wrapErr("seek", e);
|
|
ret = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [ret, err];
|
|
}
|
|
_tmp$4 = r;
|
|
_tmp$5 = $ifaceNil;
|
|
ret = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [ret, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Seek }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.offset = offset; $f.r = r; $f.ret = ret; $f.whence = whence; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Seek = function(offset, whence) { return this.$val.Seek(offset, whence); };
|
|
File.ptr.prototype.WriteString = function(s) {
|
|
var _r, _tuple, err, f, n, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; f = $f.f; n = $f.n; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.Write((new sliceType$2($stringToBytes(s)))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.WriteString }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.n = n; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.WriteString = function(s) { return this.$val.WriteString(s); };
|
|
setStickyBit = function(name) {
|
|
var _arg, _arg$1, _r, _r$1, _r$2, _tuple, err, fi, name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; err = $f.err; fi = $f.fi; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = Stat(name); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
fi = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_arg = name;
|
|
_r$1 = fi.Mode(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_arg$1 = (_r$1 | 1048576) >>> 0;
|
|
_r$2 = Chmod(_arg, _arg$1); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: setStickyBit }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f.err = err; $f.fi = fi; $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Open = function(name) {
|
|
var _r, name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = OpenFile(name, 0, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Open }; } $f._r = _r; $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Open = Open;
|
|
OpenFile = function(name, flag, perm) {
|
|
var _r, flag, name, perm, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; flag = $f.flag; name = $f.name; perm = $f.perm; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = testlog.Open(name); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r = openFileNolog(name, flag, perm); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: OpenFile }; } $f._r = _r; $f.flag = flag; $f.name = name; $f.perm = perm; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.OpenFile = OpenFile;
|
|
File.ptr.prototype.wrapErr = function(op, err) {
|
|
var err, f, op;
|
|
f = this;
|
|
if ($interfaceIsEqual(err, $ifaceNil) || $interfaceIsEqual(err, io.EOF)) {
|
|
return err;
|
|
}
|
|
if ($interfaceIsEqual(err, poll.ErrFileClosing)) {
|
|
err = $pkg.ErrClosed;
|
|
}
|
|
return new PathError.ptr(op, f.file.name, err);
|
|
};
|
|
File.prototype.wrapErr = function(op, err) { return this.$val.wrapErr(op, err); };
|
|
Chmod = function(name, mode) {
|
|
var mode, name;
|
|
return chmod(name, mode);
|
|
};
|
|
$pkg.Chmod = Chmod;
|
|
File.ptr.prototype.Chmod = function(mode) {
|
|
var _r, f, mode, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; mode = $f.mode; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r = f.chmod(mode); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chmod }; } $f._r = _r; $f.f = f; $f.mode = mode; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Chmod = function(mode) { return this.$val.Chmod(mode); };
|
|
File.ptr.prototype.SetDeadline = function(t) {
|
|
var f, t;
|
|
f = this;
|
|
return f.setDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
|
|
File.ptr.prototype.SetReadDeadline = function(t) {
|
|
var f, t;
|
|
f = this;
|
|
return f.setReadDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.SetReadDeadline = function(t) { return this.$val.SetReadDeadline(t); };
|
|
File.ptr.prototype.SetWriteDeadline = function(t) {
|
|
var f, t;
|
|
f = this;
|
|
return f.setWriteDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.SetWriteDeadline = function(t) { return this.$val.SetWriteDeadline(t); };
|
|
File.ptr.prototype.SyscallConn = function() {
|
|
var _returncast, err, f;
|
|
f = this;
|
|
err = f.checkValid("SyscallConn");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [$ifaceNil, err];
|
|
}
|
|
_returncast = newRawConn(f);
|
|
return [_returncast[0], _returncast[1]];
|
|
};
|
|
File.prototype.SyscallConn = function() { return this.$val.SyscallConn(); };
|
|
sigpipe = function() {
|
|
$throwRuntimeError("native function not implemented: os.sigpipe");
|
|
};
|
|
syscallMode = function(i) {
|
|
var i, o;
|
|
o = 0;
|
|
o = (o | (((new FileMode(i).Perm() >>> 0)))) >>> 0;
|
|
if (!((((i & 8388608) >>> 0) === 0))) {
|
|
o = (o | (2048)) >>> 0;
|
|
}
|
|
if (!((((i & 4194304) >>> 0) === 0))) {
|
|
o = (o | (1024)) >>> 0;
|
|
}
|
|
if (!((((i & 1048576) >>> 0) === 0))) {
|
|
o = (o | (512)) >>> 0;
|
|
}
|
|
return o;
|
|
};
|
|
chmod = function(name, mode) {
|
|
var e, mode, name;
|
|
e = syscall.Chmod(fixLongPath(name), syscallMode(mode));
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
return new PathError.ptr("chmod", name, e);
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
File.ptr.prototype.chmod = function(mode) {
|
|
var _r, e, err, f, mode, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; mode = $f.mode; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
err = f.checkValid("chmod");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = f.file.pfd.Fchmod(syscallMode(mode)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
$s = -1; return f.wrapErr("chmod", e);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.chmod }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.mode = mode; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.chmod = function(mode) { return this.$val.chmod(mode); };
|
|
File.ptr.prototype.Chown = function(uid, gid) {
|
|
var _r, e, err, f, gid, uid, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; gid = $f.gid; uid = $f.uid; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
err = f.checkValid("chown");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = f.file.pfd.Fchown(uid, gid); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
$s = -1; return f.wrapErr("chown", e);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chown }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.gid = gid; $f.uid = uid; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Chown = function(uid, gid) { return this.$val.Chown(uid, gid); };
|
|
File.ptr.prototype.Truncate = function(size) {
|
|
var _r, e, err, f, size, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
err = f.checkValid("truncate");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = f.file.pfd.Ftruncate(size); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
$s = -1; return f.wrapErr("truncate", e);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Truncate }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Truncate = function(size) { return this.$val.Truncate(size); };
|
|
File.ptr.prototype.Sync = function() {
|
|
var _r, e, err, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
err = f.checkValid("sync");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = f.file.pfd.Fsync(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
$s = -1; return f.wrapErr("sync", e);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Sync }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Sync = function() { return this.$val.Sync(); };
|
|
File.ptr.prototype.Chdir = function() {
|
|
var _r, e, err, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
err = f.checkValid("chdir");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = f.file.pfd.Fchdir(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
$s = -1; return f.wrapErr("chdir", e);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chdir }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Chdir = function() { return this.$val.Chdir(); };
|
|
File.ptr.prototype.setDeadline = function(t) {
|
|
var err, f, t;
|
|
f = this;
|
|
err = f.checkValid("SetDeadline");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
return f.file.pfd.SetDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.setDeadline = function(t) { return this.$val.setDeadline(t); };
|
|
File.ptr.prototype.setReadDeadline = function(t) {
|
|
var err, f, t;
|
|
f = this;
|
|
err = f.checkValid("SetReadDeadline");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
return f.file.pfd.SetReadDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.setReadDeadline = function(t) { return this.$val.setReadDeadline(t); };
|
|
File.ptr.prototype.setWriteDeadline = function(t) {
|
|
var err, f, t;
|
|
f = this;
|
|
err = f.checkValid("SetWriteDeadline");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
return f.file.pfd.SetWriteDeadline($clone(t, time.Time));
|
|
};
|
|
File.prototype.setWriteDeadline = function(t) { return this.$val.setWriteDeadline(t); };
|
|
File.ptr.prototype.checkValid = function(op) {
|
|
var f, op;
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
return $pkg.ErrInvalid;
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
File.prototype.checkValid = function(op) { return this.$val.checkValid(op); };
|
|
fixLongPath = function(path) {
|
|
var path;
|
|
return path;
|
|
};
|
|
File.ptr.prototype.Fd = function() {
|
|
var _r, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
$s = -1; return 4294967295;
|
|
}
|
|
/* */ if (f.file.nonblock) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (f.file.nonblock) { */ case 1:
|
|
_r = f.file.pfd.SetBlocking(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
/* } */ case 2:
|
|
$s = -1; return ((f.file.pfd.Sysfd >>> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Fd }; } $f._r = _r; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Fd = function() { return this.$val.Fd(); };
|
|
NewFile = function(fd, name) {
|
|
var _tuple, err, fd, kind, name, nb;
|
|
kind = 0;
|
|
_tuple = unix.IsNonblock(((fd >> 0)));
|
|
nb = _tuple[0];
|
|
err = _tuple[1];
|
|
if ($interfaceIsEqual(err, $ifaceNil) && nb) {
|
|
kind = 3;
|
|
}
|
|
return newFile(fd, name, kind);
|
|
};
|
|
$pkg.NewFile = NewFile;
|
|
newFile = function(fd, name, kind) {
|
|
var _1, err, err$1, err$2, err$3, f, fd, fdi, kind, name, pollable, st;
|
|
fdi = ((fd >> 0));
|
|
if (fdi < 0) {
|
|
return ptrType.nil;
|
|
}
|
|
f = new File.ptr(new file.ptr(new poll.FD.ptr(new poll.fdMutex.ptr(new $Uint64(0, 0), 0, 0), fdi, new poll.pollDesc.ptr(false), ptrType$12.nil, 0, 0, true, true, false), name, ptrType$1.nil, false, (fdi === 1) || (fdi === 2)));
|
|
pollable = (kind === 1) || (kind === 2) || (kind === 3);
|
|
if (kind === 1) {
|
|
st = new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$1.zero());
|
|
_1 = "linux";
|
|
if (_1 === ("freebsd")) {
|
|
pollable = false;
|
|
} else if (_1 === ("dragonfly") || _1 === ("netbsd") || _1 === ("openbsd")) {
|
|
err = syscall.Fstat(fdi, st);
|
|
if ($interfaceIsEqual(err, $ifaceNil) && (((st.Mode & 61440) >>> 0) === 32768)) {
|
|
pollable = false;
|
|
}
|
|
} else if (_1 === ("darwin")) {
|
|
err$1 = syscall.Fstat(fdi, st);
|
|
if ($interfaceIsEqual(err$1, $ifaceNil) && ((((st.Mode & 61440) >>> 0) === 4096) || (((st.Mode & 61440) >>> 0) === 32768))) {
|
|
pollable = false;
|
|
}
|
|
}
|
|
}
|
|
err$2 = f.file.pfd.Init("file", pollable);
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
} else if (pollable) {
|
|
err$3 = syscall.SetNonblock(fdi, true);
|
|
if ($interfaceIsEqual(err$3, $ifaceNil)) {
|
|
f.file.nonblock = true;
|
|
}
|
|
}
|
|
runtime.SetFinalizer(f.file, new funcType$1($methodExpr(ptrType$13, "close")));
|
|
return f;
|
|
};
|
|
epipecheck = function(file$1, e) {
|
|
var e, file$1;
|
|
if ($interfaceIsEqual(e, new syscall.Errno(32)) && file$1.file.stdoutOrErr) {
|
|
sigpipe();
|
|
}
|
|
};
|
|
openFileNolog = function(name, flag, perm) {
|
|
var _r, _r$1, _tuple, _tuple$1, e, err, flag, name, perm, r, setSticky, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; e = $f.e; err = $f.err; flag = $f.flag; name = $f.name; perm = $f.perm; r = $f.r; setSticky = $f.setSticky; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
setSticky = false;
|
|
/* */ if (false && !(((flag & 64) === 0)) && !((((perm & 1048576) >>> 0) === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (false && !(((flag & 64) === 0)) && !((((perm & 1048576) >>> 0) === 0))) { */ case 1:
|
|
_r = Stat(name); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
err = _tuple[1];
|
|
if (IsNotExist(err)) {
|
|
setSticky = true;
|
|
}
|
|
/* } */ case 2:
|
|
r = 0;
|
|
/* while (true) { */ case 4:
|
|
e = $ifaceNil;
|
|
_tuple$1 = syscall.Open(name, flag | 524288, syscallMode(perm));
|
|
r = _tuple$1[0];
|
|
e = _tuple$1[1];
|
|
if ($interfaceIsEqual(e, $ifaceNil)) {
|
|
/* break; */ $s = 5; continue;
|
|
}
|
|
if (false && $interfaceIsEqual(e, new syscall.Errno(4))) {
|
|
/* continue; */ $s = 4; continue;
|
|
}
|
|
$s = -1; return [ptrType.nil, new PathError.ptr("open", name, e)];
|
|
/* } */ $s = 4; continue; case 5:
|
|
/* */ if (setSticky) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (setSticky) { */ case 6:
|
|
_r$1 = setStickyBit(name); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
/* } */ case 7:
|
|
if (false) {
|
|
syscall.CloseOnExec(r);
|
|
}
|
|
$s = -1; return [newFile(((r >>> 0)), name, 1), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: openFileNolog }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.e = e; $f.err = err; $f.flag = flag; $f.name = name; $f.perm = perm; $f.r = r; $f.setSticky = setSticky; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.ptr.prototype.Close = function() {
|
|
var _r, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
$s = -1; return $pkg.ErrInvalid;
|
|
}
|
|
_r = f.file.close(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Close }; } $f._r = _r; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Close = function() { return this.$val.Close(); };
|
|
file.ptr.prototype.close = function() {
|
|
var _r, e, err, file$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; file$1 = $f.file$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
file$1 = this;
|
|
if (file$1 === ptrType$13.nil) {
|
|
$s = -1; return new syscall.Errno(22);
|
|
}
|
|
if (!(file$1.dirinfo === ptrType$1.nil)) {
|
|
file$1.dirinfo.close();
|
|
}
|
|
err = $ifaceNil;
|
|
_r = file$1.pfd.Close(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
e = _r;
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
if ($interfaceIsEqual(e, poll.ErrFileClosing)) {
|
|
e = $pkg.ErrClosed;
|
|
}
|
|
err = new PathError.ptr("close", file$1.name, e);
|
|
}
|
|
runtime.SetFinalizer(file$1, $ifaceNil);
|
|
$s = -1; return err;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: file.ptr.prototype.close }; } $f._r = _r; $f.e = e; $f.err = err; $f.file$1 = file$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
file.prototype.close = function() { return this.$val.close(); };
|
|
File.ptr.prototype.read = function(b) {
|
|
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.file.pfd.Read(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
_tmp = n;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.read = function(b) { return this.$val.read(b); };
|
|
File.ptr.prototype.pread = function(b, off) {
|
|
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, off, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; off = $f.off; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.file.pfd.Pread(b, off); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
_tmp = n;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.pread }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.off = off; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.pread = function(b, off) { return this.$val.pread(b, off); };
|
|
File.ptr.prototype.write = function(b) {
|
|
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.file.pfd.Write(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
_tmp = n;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.write }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.write = function(b) { return this.$val.write(b); };
|
|
File.ptr.prototype.pwrite = function(b, off) {
|
|
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, off, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; off = $f.off; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.file.pfd.Pwrite(b, off); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
_tmp = n;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.pwrite }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.off = off; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.pwrite = function(b, off) { return this.$val.pwrite(b, off); };
|
|
File.ptr.prototype.seek = function(offset, whence) {
|
|
var _r, _tmp, _tmp$1, _tuple, err, f, offset, ret, whence, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; err = $f.err; f = $f.f; offset = $f.offset; ret = $f.ret; whence = $f.whence; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ret = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
f = this;
|
|
_r = f.file.pfd.Seek(offset, whence); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
ret = _tuple[0];
|
|
err = _tuple[1];
|
|
runtime.KeepAlive(f);
|
|
_tmp = ret;
|
|
_tmp$1 = err;
|
|
ret = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [ret, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.seek }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.offset = offset; $f.ret = ret; $f.whence = whence; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.seek = function(offset, whence) { return this.$val.seek(offset, whence); };
|
|
File.ptr.prototype.readdir = function(n) {
|
|
var _i, _r, _r$1, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, _tuple$1, dirname, err, f, fi, filename, fip, lerr, n, names, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; dirname = $f.dirname; err = $f.err; f = $f.f; fi = $f.fi; filename = $f.filename; fip = $f.fip; lerr = $f.lerr; n = $f.n; names = $f.names; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fi = sliceType$1.nil;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
dirname = f.file.name;
|
|
if (dirname === "") {
|
|
dirname = ".";
|
|
}
|
|
_r = f.Readdirnames(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
names = _tuple[0];
|
|
err = _tuple[1];
|
|
fi = $makeSlice(sliceType$1, 0, names.$length);
|
|
_ref = names;
|
|
_i = 0;
|
|
/* while (true) { */ case 2:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 3; continue; }
|
|
filename = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
_r$1 = lstat(dirname + "/" + filename); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
fip = _tuple$1[0];
|
|
lerr = _tuple$1[1];
|
|
if (IsNotExist(lerr)) {
|
|
_i++;
|
|
/* continue; */ $s = 2; continue;
|
|
}
|
|
if (!($interfaceIsEqual(lerr, $ifaceNil))) {
|
|
_tmp = fi;
|
|
_tmp$1 = lerr;
|
|
fi = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [fi, err];
|
|
}
|
|
fi = $append(fi, fip);
|
|
_i++;
|
|
/* } */ $s = 2; continue; case 3:
|
|
if ((fi.$length === 0) && $interfaceIsEqual(err, $ifaceNil) && n > 0) {
|
|
err = io.EOF;
|
|
}
|
|
_tmp$2 = fi;
|
|
_tmp$3 = err;
|
|
fi = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [fi, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.readdir }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.dirname = dirname; $f.err = err; $f.f = f; $f.fi = fi; $f.filename = filename; $f.fip = fip; $f.lerr = lerr; $f.n = n; $f.names = names; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.readdir = function(n) { return this.$val.readdir(n); };
|
|
basename = function(name) {
|
|
var i, name;
|
|
i = name.length - 1 >> 0;
|
|
while (true) {
|
|
if (!(i > 0 && (name.charCodeAt(i) === 47))) { break; }
|
|
name = $substring(name, 0, i);
|
|
i = i - (1) >> 0;
|
|
}
|
|
i = i - (1) >> 0;
|
|
while (true) {
|
|
if (!(i >= 0)) { break; }
|
|
if (name.charCodeAt(i) === 47) {
|
|
name = $substring(name, (i + 1 >> 0));
|
|
break;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
return name;
|
|
};
|
|
init$1 = function() {
|
|
if (false) {
|
|
return;
|
|
}
|
|
$pkg.Args = runtime_args();
|
|
};
|
|
Exit = function(code) {
|
|
var code;
|
|
if (code === 0) {
|
|
runtime_beforeExit();
|
|
}
|
|
syscall.Exit(code);
|
|
};
|
|
$pkg.Exit = Exit;
|
|
rawConn.ptr.prototype.Control = function(f) {
|
|
var _r, c, err, err$1, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; c = $f.c; err = $f.err; err$1 = $f.err$1; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
err = c.file.checkValid("SyscallConn.Control");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = c.file.file.pfd.RawControl(f); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
runtime.KeepAlive(c.file);
|
|
$s = -1; return err$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rawConn.ptr.prototype.Control }; } $f._r = _r; $f.c = c; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rawConn.prototype.Control = function(f) { return this.$val.Control(f); };
|
|
rawConn.ptr.prototype.Read = function(f) {
|
|
var _r, c, err, err$1, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; c = $f.c; err = $f.err; err$1 = $f.err$1; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
err = c.file.checkValid("SyscallConn.Read");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = c.file.file.pfd.RawRead(f); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
runtime.KeepAlive(c.file);
|
|
$s = -1; return err$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rawConn.ptr.prototype.Read }; } $f._r = _r; $f.c = c; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rawConn.prototype.Read = function(f) { return this.$val.Read(f); };
|
|
rawConn.ptr.prototype.Write = function(f) {
|
|
var _r, c, err, err$1, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; c = $f.c; err = $f.err; err$1 = $f.err$1; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
err = c.file.checkValid("SyscallConn.Write");
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r = c.file.file.pfd.RawWrite(f); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
runtime.KeepAlive(c.file);
|
|
$s = -1; return err$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rawConn.ptr.prototype.Write }; } $f._r = _r; $f.c = c; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
rawConn.prototype.Write = function(f) { return this.$val.Write(f); };
|
|
newRawConn = function(file$1) {
|
|
var file$1;
|
|
return [new rawConn.ptr(file$1), $ifaceNil];
|
|
};
|
|
Stat = function(name) {
|
|
var name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = testlog.Stat(name); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return statNolog(name);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stat }; } $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Stat = Stat;
|
|
Lstat = function(name) {
|
|
var name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = testlog.Stat(name); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return lstatNolog(name);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Lstat }; } $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Lstat = Lstat;
|
|
fillFileStatFromSys = function(fs, name) {
|
|
var _1, fs, name;
|
|
fs.name = basename(name);
|
|
fs.size = fs.sys.Size;
|
|
time.Time.copy(fs.modTime, timespecToTime($clone(fs.sys.Mtim, syscall.Timespec)));
|
|
fs.mode = ((((fs.sys.Mode & 511) >>> 0) >>> 0));
|
|
_1 = (fs.sys.Mode & 61440) >>> 0;
|
|
if (_1 === (24576)) {
|
|
fs.mode = (fs.mode | (67108864)) >>> 0;
|
|
} else if (_1 === (8192)) {
|
|
fs.mode = (fs.mode | (69206016)) >>> 0;
|
|
} else if (_1 === (16384)) {
|
|
fs.mode = (fs.mode | (2147483648)) >>> 0;
|
|
} else if (_1 === (4096)) {
|
|
fs.mode = (fs.mode | (33554432)) >>> 0;
|
|
} else if (_1 === (40960)) {
|
|
fs.mode = (fs.mode | (134217728)) >>> 0;
|
|
} else if (_1 === (32768)) {
|
|
} else if (_1 === (49152)) {
|
|
fs.mode = (fs.mode | (16777216)) >>> 0;
|
|
}
|
|
if (!((((fs.sys.Mode & 1024) >>> 0) === 0))) {
|
|
fs.mode = (fs.mode | (4194304)) >>> 0;
|
|
}
|
|
if (!((((fs.sys.Mode & 2048) >>> 0) === 0))) {
|
|
fs.mode = (fs.mode | (8388608)) >>> 0;
|
|
}
|
|
if (!((((fs.sys.Mode & 512) >>> 0) === 0))) {
|
|
fs.mode = (fs.mode | (1048576)) >>> 0;
|
|
}
|
|
};
|
|
timespecToTime = function(ts) {
|
|
var ts;
|
|
return time.Unix((ts.Sec), (ts.Nsec));
|
|
};
|
|
File.ptr.prototype.Stat = function() {
|
|
var _r, err, f, fs, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; f = $f.f; fs = $f.fs; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fs = [fs];
|
|
f = this;
|
|
if (f === ptrType.nil) {
|
|
$s = -1; return [$ifaceNil, $pkg.ErrInvalid];
|
|
}
|
|
fs[0] = new fileStat.ptr("", new $Int64(0, 0), 0, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil), new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$1.zero()));
|
|
_r = f.file.pfd.Fstat(fs[0].sys); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [$ifaceNil, new PathError.ptr("stat", f.file.name, err)];
|
|
}
|
|
fillFileStatFromSys(fs[0], f.file.name);
|
|
$s = -1; return [fs[0], $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Stat }; } $f._r = _r; $f.err = err; $f.f = f; $f.fs = fs; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
File.prototype.Stat = function() { return this.$val.Stat(); };
|
|
statNolog = function(name) {
|
|
var err, fs, name;
|
|
fs = new fileStat.ptr("", new $Int64(0, 0), 0, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil), new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$1.zero()));
|
|
err = syscall.Stat(name, fs.sys);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [$ifaceNil, new PathError.ptr("stat", name, err)];
|
|
}
|
|
fillFileStatFromSys(fs, name);
|
|
return [fs, $ifaceNil];
|
|
};
|
|
lstatNolog = function(name) {
|
|
var err, fs, name;
|
|
fs = new fileStat.ptr("", new $Int64(0, 0), 0, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil), new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$1.zero()));
|
|
err = syscall.Lstat(name, fs.sys);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [$ifaceNil, new PathError.ptr("lstat", name, err)];
|
|
}
|
|
fillFileStatFromSys(fs, name);
|
|
return [fs, $ifaceNil];
|
|
};
|
|
FileMode.prototype.String = function() {
|
|
var _i, _i$1, _ref, _ref$1, _rune, _rune$1, buf, c, c$1, i, i$1, m, w, y, y$1;
|
|
m = this.$val;
|
|
buf = arrayType$6.zero();
|
|
w = 0;
|
|
_ref = "dalTLDpSugct?";
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i = _i;
|
|
c = _rune[0];
|
|
if (!((((m & (((y = (((31 - i >> 0) >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0) === 0))) {
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = ((c << 24 >>> 24)));
|
|
w = w + (1) >> 0;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
if (w === 0) {
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
|
|
w = w + (1) >> 0;
|
|
}
|
|
_ref$1 = "rwxrwxrwx";
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.length)) { break; }
|
|
_rune$1 = $decodeRune(_ref$1, _i$1);
|
|
i$1 = _i$1;
|
|
c$1 = _rune$1[0];
|
|
if (!((((m & (((y$1 = (((8 - i$1 >> 0) >>> 0)), y$1 < 32 ? (1 << y$1) : 0) >>> 0))) >>> 0) === 0))) {
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = ((c$1 << 24 >>> 24)));
|
|
} else {
|
|
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
|
|
}
|
|
w = w + (1) >> 0;
|
|
_i$1 += _rune$1[1];
|
|
}
|
|
return ($bytesToString($subslice(new sliceType$2(buf), 0, w)));
|
|
};
|
|
$ptrType(FileMode).prototype.String = function() { return new FileMode(this.$get()).String(); };
|
|
FileMode.prototype.IsDir = function() {
|
|
var m;
|
|
m = this.$val;
|
|
return !((((m & 2147483648) >>> 0) === 0));
|
|
};
|
|
$ptrType(FileMode).prototype.IsDir = function() { return new FileMode(this.$get()).IsDir(); };
|
|
FileMode.prototype.IsRegular = function() {
|
|
var m;
|
|
m = this.$val;
|
|
return ((m & 2401763328) >>> 0) === 0;
|
|
};
|
|
$ptrType(FileMode).prototype.IsRegular = function() { return new FileMode(this.$get()).IsRegular(); };
|
|
FileMode.prototype.Perm = function() {
|
|
var m;
|
|
m = this.$val;
|
|
return (m & 511) >>> 0;
|
|
};
|
|
$ptrType(FileMode).prototype.Perm = function() { return new FileMode(this.$get()).Perm(); };
|
|
fileStat.ptr.prototype.Name = function() {
|
|
var fs;
|
|
fs = this;
|
|
return fs.name;
|
|
};
|
|
fileStat.prototype.Name = function() { return this.$val.Name(); };
|
|
fileStat.ptr.prototype.IsDir = function() {
|
|
var fs;
|
|
fs = this;
|
|
return new FileMode(fs.Mode()).IsDir();
|
|
};
|
|
fileStat.prototype.IsDir = function() { return this.$val.IsDir(); };
|
|
fileStat.ptr.prototype.Size = function() {
|
|
var fs;
|
|
fs = this;
|
|
return fs.size;
|
|
};
|
|
fileStat.prototype.Size = function() { return this.$val.Size(); };
|
|
fileStat.ptr.prototype.Mode = function() {
|
|
var fs;
|
|
fs = this;
|
|
return fs.mode;
|
|
};
|
|
fileStat.prototype.Mode = function() { return this.$val.Mode(); };
|
|
fileStat.ptr.prototype.ModTime = function() {
|
|
var fs;
|
|
fs = this;
|
|
return fs.modTime;
|
|
};
|
|
fileStat.prototype.ModTime = function() { return this.$val.ModTime(); };
|
|
fileStat.ptr.prototype.Sys = function() {
|
|
var fs;
|
|
fs = this;
|
|
return fs.sys;
|
|
};
|
|
fileStat.prototype.Sys = function() { return this.$val.Sys(); };
|
|
ptrType$1.methods = [{prop: "close", name: "close", pkg: "os", typ: $funcType([], [], false)}];
|
|
ptrType$2.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$4.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$3.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$13.methods = [{prop: "close", name: "close", pkg: "os", typ: $funcType([], [$error], false)}];
|
|
ptrType$18.methods = [{prop: "Control", name: "Control", pkg: "", typ: $funcType([funcType$2], [$error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([funcType$3], [$error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([funcType$3], [$error], false)}];
|
|
ptrType.methods = [{prop: "Readdir", name: "Readdir", pkg: "", typ: $funcType([$Int], [sliceType$1, $error], false)}, {prop: "Readdirnames", name: "Readdirnames", pkg: "", typ: $funcType([$Int], [sliceType, $error], false)}, {prop: "readdirnames", name: "readdirnames", pkg: "os", typ: $funcType([$Int], [sliceType, $error], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "ReadAt", name: "ReadAt", pkg: "", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "WriteAt", name: "WriteAt", pkg: "", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "Seek", name: "Seek", pkg: "", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [$Int, $error], false)}, {prop: "wrapErr", name: "wrapErr", pkg: "os", typ: $funcType([$String, $error], [$error], false)}, {prop: "Chmod", name: "Chmod", pkg: "", typ: $funcType([FileMode], [$error], false)}, {prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetReadDeadline", name: "SetReadDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetWriteDeadline", name: "SetWriteDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SyscallConn", name: "SyscallConn", pkg: "", typ: $funcType([], [syscall.RawConn, $error], false)}, {prop: "chmod", name: "chmod", pkg: "os", typ: $funcType([FileMode], [$error], false)}, {prop: "Chown", name: "Chown", pkg: "", typ: $funcType([$Int, $Int], [$error], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([$Int64], [$error], false)}, {prop: "Sync", name: "Sync", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Chdir", name: "Chdir", pkg: "", typ: $funcType([], [$error], false)}, {prop: "setDeadline", name: "setDeadline", pkg: "os", typ: $funcType([time.Time], [$error], false)}, {prop: "setReadDeadline", name: "setReadDeadline", pkg: "os", typ: $funcType([time.Time], [$error], false)}, {prop: "setWriteDeadline", name: "setWriteDeadline", pkg: "os", typ: $funcType([time.Time], [$error], false)}, {prop: "checkValid", name: "checkValid", pkg: "os", typ: $funcType([$String], [$error], false)}, {prop: "Fd", name: "Fd", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "read", name: "read", pkg: "os", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "pread", name: "pread", pkg: "os", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "write", name: "write", pkg: "os", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "pwrite", name: "pwrite", pkg: "os", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "seek", name: "seek", pkg: "os", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "readdir", name: "readdir", pkg: "os", typ: $funcType([$Int], [sliceType$1, $error], false)}, {prop: "Stat", name: "Stat", pkg: "", typ: $funcType([], [FileInfo, $error], false)}];
|
|
FileMode.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsRegular", name: "IsRegular", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Perm", name: "Perm", pkg: "", typ: $funcType([], [FileMode], false)}];
|
|
ptrType$16.methods = [{prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Mode", name: "Mode", pkg: "", typ: $funcType([], [FileMode], false)}, {prop: "ModTime", name: "ModTime", pkg: "", typ: $funcType([], [time.Time], false)}, {prop: "Sys", name: "Sys", pkg: "", typ: $funcType([], [$emptyInterface], false)}];
|
|
dirInfo.init("os", [{prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "nbuf", name: "nbuf", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "bufp", name: "bufp", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
timeout.init([{prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}]);
|
|
PathError.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Path", name: "Path", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
SyscallError.init("", [{prop: "Syscall", name: "Syscall", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
LinkError.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Old", name: "Old", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "New", name: "New", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
file.init("os", [{prop: "pfd", name: "pfd", embedded: false, exported: false, typ: poll.FD, tag: ""}, {prop: "name", name: "name", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "dirinfo", name: "dirinfo", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "nonblock", name: "nonblock", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "stdoutOrErr", name: "stdoutOrErr", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
rawConn.init("os", [{prop: "file", name: "file", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
|
File.init("os", [{prop: "file", name: "file", embedded: true, exported: false, typ: ptrType$13, tag: ""}]);
|
|
FileInfo.init([{prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "ModTime", name: "ModTime", pkg: "", typ: $funcType([], [time.Time], false)}, {prop: "Mode", name: "Mode", pkg: "", typ: $funcType([], [FileMode], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Sys", name: "Sys", pkg: "", typ: $funcType([], [$emptyInterface], false)}]);
|
|
fileStat.init("os", [{prop: "name", name: "name", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "size", name: "size", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "mode", name: "mode", embedded: false, exported: false, typ: FileMode, tag: ""}, {prop: "modTime", name: "modTime", embedded: false, exported: false, typ: time.Time, tag: ""}, {prop: "sys", name: "sys", embedded: false, exported: false, typ: syscall.Stat_t, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = poll.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unix.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = testlog.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syscall.$init(); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.Args = sliceType.nil;
|
|
$pkg.ErrInvalid = errors.New("invalid argument");
|
|
$pkg.ErrPermission = errors.New("permission denied");
|
|
$pkg.ErrExist = errors.New("file already exists");
|
|
$pkg.ErrNotExist = errors.New("file does not exist");
|
|
$pkg.ErrClosed = errors.New("file already closed");
|
|
errFinished = errors.New("os: process already finished");
|
|
$pkg.Stdin = NewFile(((syscall.Stdin >>> 0)), "/dev/stdin");
|
|
$pkg.Stdout = NewFile(((syscall.Stdout >>> 0)), "/dev/stdout");
|
|
$pkg.Stderr = NewFile(((syscall.Stderr >>> 0)), "/dev/stderr");
|
|
lstat = Lstat;
|
|
init();
|
|
init$1();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["fmt"] = (function() {
|
|
var $pkg = {}, $init, errors, fmtsort, io, math, os, reflect, strconv, sync, utf8, fmtFlags, fmt, State, Formatter, Stringer, GoStringer, buffer, pp, scanError, ss, ssave, sliceType, ptrType, ptrType$1, arrayType, arrayType$1, sliceType$1, sliceType$2, arrayType$2, ptrType$2, ptrType$5, ptrType$25, funcType, ppFree, space, ssFree, complexError, boolError, newPrinter, Sprintf, Errorf, Sprint, Fprintln, Println, Sprintln, getField, tooLarge, parsenum, intFromArg, parseArgNumber, isSpace, notSpace, indexRune;
|
|
errors = $packages["errors"];
|
|
fmtsort = $packages["internal/fmtsort"];
|
|
io = $packages["io"];
|
|
math = $packages["math"];
|
|
os = $packages["os"];
|
|
reflect = $packages["reflect"];
|
|
strconv = $packages["strconv"];
|
|
sync = $packages["sync"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
fmtFlags = $pkg.fmtFlags = $newType(0, $kindStruct, "fmt.fmtFlags", true, "fmt", false, function(widPresent_, precPresent_, minus_, plus_, sharp_, space_, zero_, plusV_, sharpV_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.widPresent = false;
|
|
this.precPresent = false;
|
|
this.minus = false;
|
|
this.plus = false;
|
|
this.sharp = false;
|
|
this.space = false;
|
|
this.zero = false;
|
|
this.plusV = false;
|
|
this.sharpV = false;
|
|
return;
|
|
}
|
|
this.widPresent = widPresent_;
|
|
this.precPresent = precPresent_;
|
|
this.minus = minus_;
|
|
this.plus = plus_;
|
|
this.sharp = sharp_;
|
|
this.space = space_;
|
|
this.zero = zero_;
|
|
this.plusV = plusV_;
|
|
this.sharpV = sharpV_;
|
|
});
|
|
fmt = $pkg.fmt = $newType(0, $kindStruct, "fmt.fmt", true, "fmt", false, function(buf_, fmtFlags_, wid_, prec_, intbuf_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.buf = ptrType$1.nil;
|
|
this.fmtFlags = new fmtFlags.ptr(false, false, false, false, false, false, false, false, false);
|
|
this.wid = 0;
|
|
this.prec = 0;
|
|
this.intbuf = arrayType.zero();
|
|
return;
|
|
}
|
|
this.buf = buf_;
|
|
this.fmtFlags = fmtFlags_;
|
|
this.wid = wid_;
|
|
this.prec = prec_;
|
|
this.intbuf = intbuf_;
|
|
});
|
|
State = $pkg.State = $newType(8, $kindInterface, "fmt.State", true, "fmt", true, null);
|
|
Formatter = $pkg.Formatter = $newType(8, $kindInterface, "fmt.Formatter", true, "fmt", true, null);
|
|
Stringer = $pkg.Stringer = $newType(8, $kindInterface, "fmt.Stringer", true, "fmt", true, null);
|
|
GoStringer = $pkg.GoStringer = $newType(8, $kindInterface, "fmt.GoStringer", true, "fmt", true, null);
|
|
buffer = $pkg.buffer = $newType(12, $kindSlice, "fmt.buffer", true, "fmt", false, null);
|
|
pp = $pkg.pp = $newType(0, $kindStruct, "fmt.pp", true, "fmt", false, function(buf_, arg_, value_, fmt_, reordered_, goodArgNum_, panicking_, erroring_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.buf = buffer.nil;
|
|
this.arg = $ifaceNil;
|
|
this.value = new reflect.Value.ptr(ptrType.nil, 0, 0);
|
|
this.fmt = new fmt.ptr(ptrType$1.nil, new fmtFlags.ptr(false, false, false, false, false, false, false, false, false), 0, 0, arrayType.zero());
|
|
this.reordered = false;
|
|
this.goodArgNum = false;
|
|
this.panicking = false;
|
|
this.erroring = false;
|
|
return;
|
|
}
|
|
this.buf = buf_;
|
|
this.arg = arg_;
|
|
this.value = value_;
|
|
this.fmt = fmt_;
|
|
this.reordered = reordered_;
|
|
this.goodArgNum = goodArgNum_;
|
|
this.panicking = panicking_;
|
|
this.erroring = erroring_;
|
|
});
|
|
scanError = $pkg.scanError = $newType(0, $kindStruct, "fmt.scanError", true, "fmt", false, function(err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.err = err_;
|
|
});
|
|
ss = $pkg.ss = $newType(0, $kindStruct, "fmt.ss", true, "fmt", false, function(rs_, buf_, count_, atEOF_, ssave_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.rs = $ifaceNil;
|
|
this.buf = buffer.nil;
|
|
this.count = 0;
|
|
this.atEOF = false;
|
|
this.ssave = new ssave.ptr(false, false, false, 0, 0, 0);
|
|
return;
|
|
}
|
|
this.rs = rs_;
|
|
this.buf = buf_;
|
|
this.count = count_;
|
|
this.atEOF = atEOF_;
|
|
this.ssave = ssave_;
|
|
});
|
|
ssave = $pkg.ssave = $newType(0, $kindStruct, "fmt.ssave", true, "fmt", false, function(validSave_, nlIsEnd_, nlIsSpace_, argLimit_, limit_, maxWid_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.validSave = false;
|
|
this.nlIsEnd = false;
|
|
this.nlIsSpace = false;
|
|
this.argLimit = 0;
|
|
this.limit = 0;
|
|
this.maxWid = 0;
|
|
return;
|
|
}
|
|
this.validSave = validSave_;
|
|
this.nlIsEnd = nlIsEnd_;
|
|
this.nlIsSpace = nlIsSpace_;
|
|
this.argLimit = argLimit_;
|
|
this.limit = limit_;
|
|
this.maxWid = maxWid_;
|
|
});
|
|
sliceType = $sliceType($emptyInterface);
|
|
ptrType = $ptrType(reflect.rtype);
|
|
ptrType$1 = $ptrType(buffer);
|
|
arrayType = $arrayType($Uint8, 68);
|
|
arrayType$1 = $arrayType($Uint16, 2);
|
|
sliceType$1 = $sliceType(arrayType$1);
|
|
sliceType$2 = $sliceType($Uint8);
|
|
arrayType$2 = $arrayType($Uint8, 5);
|
|
ptrType$2 = $ptrType(pp);
|
|
ptrType$5 = $ptrType(ss);
|
|
ptrType$25 = $ptrType(fmt);
|
|
funcType = $funcType([$Int32], [$Bool], false);
|
|
fmt.ptr.prototype.clearflags = function() {
|
|
var f;
|
|
f = this;
|
|
fmtFlags.copy(f.fmtFlags, new fmtFlags.ptr(false, false, false, false, false, false, false, false, false));
|
|
};
|
|
fmt.prototype.clearflags = function() { return this.$val.clearflags(); };
|
|
fmt.ptr.prototype.init = function(buf) {
|
|
var buf, f;
|
|
f = this;
|
|
f.buf = buf;
|
|
f.clearflags();
|
|
};
|
|
fmt.prototype.init = function(buf) { return this.$val.init(buf); };
|
|
fmt.ptr.prototype.writePadding = function(n) {
|
|
var _i, _ref, buf, f, i, n, newLen, oldLen, padByte, padding;
|
|
f = this;
|
|
if (n <= 0) {
|
|
return;
|
|
}
|
|
buf = f.buf.$get();
|
|
oldLen = buf.$length;
|
|
newLen = oldLen + n >> 0;
|
|
if (newLen > buf.$capacity) {
|
|
buf = $makeSlice(buffer, (($imul(buf.$capacity, 2)) + n >> 0));
|
|
$copySlice(buf, f.buf.$get());
|
|
}
|
|
padByte = 32;
|
|
if (f.fmtFlags.zero) {
|
|
padByte = 48;
|
|
}
|
|
padding = $subslice(buf, oldLen, newLen);
|
|
_ref = padding;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
((i < 0 || i >= padding.$length) ? ($throwRuntimeError("index out of range"), undefined) : padding.$array[padding.$offset + i] = padByte);
|
|
_i++;
|
|
}
|
|
f.buf.$set($subslice(buf, 0, newLen));
|
|
};
|
|
fmt.prototype.writePadding = function(n) { return this.$val.writePadding(n); };
|
|
fmt.ptr.prototype.pad = function(b) {
|
|
var b, f, width;
|
|
f = this;
|
|
if (!f.fmtFlags.widPresent || (f.wid === 0)) {
|
|
f.buf.Write(b);
|
|
return;
|
|
}
|
|
width = f.wid - utf8.RuneCount(b) >> 0;
|
|
if (!f.fmtFlags.minus) {
|
|
f.writePadding(width);
|
|
f.buf.Write(b);
|
|
} else {
|
|
f.buf.Write(b);
|
|
f.writePadding(width);
|
|
}
|
|
};
|
|
fmt.prototype.pad = function(b) { return this.$val.pad(b); };
|
|
fmt.ptr.prototype.padString = function(s) {
|
|
var f, s, width;
|
|
f = this;
|
|
if (!f.fmtFlags.widPresent || (f.wid === 0)) {
|
|
f.buf.WriteString(s);
|
|
return;
|
|
}
|
|
width = f.wid - utf8.RuneCountInString(s) >> 0;
|
|
if (!f.fmtFlags.minus) {
|
|
f.writePadding(width);
|
|
f.buf.WriteString(s);
|
|
} else {
|
|
f.buf.WriteString(s);
|
|
f.writePadding(width);
|
|
}
|
|
};
|
|
fmt.prototype.padString = function(s) { return this.$val.padString(s); };
|
|
fmt.ptr.prototype.fmtBoolean = function(v) {
|
|
var f, v;
|
|
f = this;
|
|
if (v) {
|
|
f.padString("true");
|
|
} else {
|
|
f.padString("false");
|
|
}
|
|
};
|
|
fmt.prototype.fmtBoolean = function(v) { return this.$val.fmtBoolean(v); };
|
|
fmt.ptr.prototype.fmtUnicode = function(u) {
|
|
var buf, f, i, oldZero, prec, u, width;
|
|
f = this;
|
|
buf = $subslice(new sliceType$2(f.intbuf), 0);
|
|
prec = 4;
|
|
if (f.fmtFlags.precPresent && f.prec > 4) {
|
|
prec = f.prec;
|
|
width = (((2 + prec >> 0) + 2 >> 0) + 4 >> 0) + 1 >> 0;
|
|
if (width > buf.$length) {
|
|
buf = $makeSlice(sliceType$2, width);
|
|
}
|
|
}
|
|
i = buf.$length;
|
|
if (f.fmtFlags.sharp && (u.$high < 0 || (u.$high === 0 && u.$low <= 1114111)) && strconv.IsPrint(((u.$low >> 0)))) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 39);
|
|
i = i - (utf8.RuneLen(((u.$low >> 0)))) >> 0;
|
|
utf8.EncodeRune($subslice(buf, i), ((u.$low >> 0)));
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 39);
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 32);
|
|
}
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 16)))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = "0123456789ABCDEFX".charCodeAt($flatten64(new $Uint64(u.$high & 0, (u.$low & 15) >>> 0))));
|
|
prec = prec - (1) >> 0;
|
|
u = $shiftRightUint64(u, (4));
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = "0123456789ABCDEFX".charCodeAt($flatten64(u)));
|
|
prec = prec - (1) >> 0;
|
|
while (true) {
|
|
if (!(prec > 0)) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 48);
|
|
prec = prec - (1) >> 0;
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 43);
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 85);
|
|
oldZero = f.fmtFlags.zero;
|
|
f.fmtFlags.zero = false;
|
|
f.pad($subslice(buf, i));
|
|
f.fmtFlags.zero = oldZero;
|
|
};
|
|
fmt.prototype.fmtUnicode = function(u) { return this.$val.fmtUnicode(u); };
|
|
fmt.ptr.prototype.fmtInteger = function(u, base, isSigned, digits) {
|
|
var _1, _2, base, buf, digits, f, i, isSigned, negative, next, oldZero, oldZero$1, prec, u, width, x, x$1, x$2, x$3, x$4;
|
|
f = this;
|
|
negative = isSigned && (x = (new $Int64(u.$high, u.$low)), (x.$high < 0 || (x.$high === 0 && x.$low < 0)));
|
|
if (negative) {
|
|
u = new $Uint64(-u.$high, -u.$low);
|
|
}
|
|
buf = $subslice(new sliceType$2(f.intbuf), 0);
|
|
if (f.fmtFlags.widPresent || f.fmtFlags.precPresent) {
|
|
width = (3 + f.wid >> 0) + f.prec >> 0;
|
|
if (width > buf.$length) {
|
|
buf = $makeSlice(sliceType$2, width);
|
|
}
|
|
}
|
|
prec = 0;
|
|
if (f.fmtFlags.precPresent) {
|
|
prec = f.prec;
|
|
if ((prec === 0) && (u.$high === 0 && u.$low === 0)) {
|
|
oldZero = f.fmtFlags.zero;
|
|
f.fmtFlags.zero = false;
|
|
f.writePadding(f.wid);
|
|
f.fmtFlags.zero = oldZero;
|
|
return;
|
|
}
|
|
} else if (f.fmtFlags.zero && f.fmtFlags.widPresent) {
|
|
prec = f.wid;
|
|
if (negative || f.fmtFlags.plus || f.fmtFlags.space) {
|
|
prec = prec - (1) >> 0;
|
|
}
|
|
}
|
|
i = buf.$length;
|
|
_1 = base;
|
|
if (_1 === (10)) {
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 10)))) { break; }
|
|
i = i - (1) >> 0;
|
|
next = $div64(u, new $Uint64(0, 10), false);
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = (((x$1 = new $Uint64(0 + u.$high, 48 + u.$low), x$2 = $mul64(next, new $Uint64(0, 10)), new $Uint64(x$1.$high - x$2.$high, x$1.$low - x$2.$low)).$low << 24 >>> 24)));
|
|
u = next;
|
|
}
|
|
} else if (_1 === (16)) {
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 16)))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = digits.charCodeAt($flatten64(new $Uint64(u.$high & 0, (u.$low & 15) >>> 0))));
|
|
u = $shiftRightUint64(u, (4));
|
|
}
|
|
} else if (_1 === (8)) {
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 8)))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = (((x$3 = new $Uint64(u.$high & 0, (u.$low & 7) >>> 0), new $Uint64(0 + x$3.$high, 48 + x$3.$low)).$low << 24 >>> 24)));
|
|
u = $shiftRightUint64(u, (3));
|
|
}
|
|
} else if (_1 === (2)) {
|
|
while (true) {
|
|
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 2)))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = (((x$4 = new $Uint64(u.$high & 0, (u.$low & 1) >>> 0), new $Uint64(0 + x$4.$high, 48 + x$4.$low)).$low << 24 >>> 24)));
|
|
u = $shiftRightUint64(u, (1));
|
|
}
|
|
} else {
|
|
$panic(new $String("fmt: unknown base; can't happen"));
|
|
}
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = digits.charCodeAt($flatten64(u)));
|
|
while (true) {
|
|
if (!(i > 0 && prec > (buf.$length - i >> 0))) { break; }
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 48);
|
|
}
|
|
if (f.fmtFlags.sharp) {
|
|
_2 = base;
|
|
if (_2 === (8)) {
|
|
if (!((((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i]) === 48))) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 48);
|
|
}
|
|
} else if (_2 === (16)) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = digits.charCodeAt(16));
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 48);
|
|
}
|
|
}
|
|
if (negative) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 45);
|
|
} else if (f.fmtFlags.plus) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 43);
|
|
} else if (f.fmtFlags.space) {
|
|
i = i - (1) >> 0;
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 32);
|
|
}
|
|
oldZero$1 = f.fmtFlags.zero;
|
|
f.fmtFlags.zero = false;
|
|
f.pad($subslice(buf, i));
|
|
f.fmtFlags.zero = oldZero$1;
|
|
};
|
|
fmt.prototype.fmtInteger = function(u, base, isSigned, digits) { return this.$val.fmtInteger(u, base, isSigned, digits); };
|
|
fmt.ptr.prototype.truncateString = function(s) {
|
|
var _i, _ref, _rune, f, i, n, s;
|
|
f = this;
|
|
if (f.fmtFlags.precPresent) {
|
|
n = f.prec;
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i = _i;
|
|
n = n - (1) >> 0;
|
|
if (n < 0) {
|
|
return $substring(s, 0, i);
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
}
|
|
return s;
|
|
};
|
|
fmt.prototype.truncateString = function(s) { return this.$val.truncateString(s); };
|
|
fmt.ptr.prototype.truncate = function(b) {
|
|
var _tuple, b, f, i, n, wid;
|
|
f = this;
|
|
if (f.fmtFlags.precPresent) {
|
|
n = f.prec;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < b.$length)) { break; }
|
|
n = n - (1) >> 0;
|
|
if (n < 0) {
|
|
return $subslice(b, 0, i);
|
|
}
|
|
wid = 1;
|
|
if (((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i]) >= 128) {
|
|
_tuple = utf8.DecodeRune($subslice(b, i));
|
|
wid = _tuple[1];
|
|
}
|
|
i = i + (wid) >> 0;
|
|
}
|
|
}
|
|
return b;
|
|
};
|
|
fmt.prototype.truncate = function(b) { return this.$val.truncate(b); };
|
|
fmt.ptr.prototype.fmtS = function(s) {
|
|
var f, s;
|
|
f = this;
|
|
s = f.truncateString(s);
|
|
f.padString(s);
|
|
};
|
|
fmt.prototype.fmtS = function(s) { return this.$val.fmtS(s); };
|
|
fmt.ptr.prototype.fmtBs = function(b) {
|
|
var b, f;
|
|
f = this;
|
|
b = f.truncate(b);
|
|
f.pad(b);
|
|
};
|
|
fmt.prototype.fmtBs = function(b) { return this.$val.fmtBs(b); };
|
|
fmt.ptr.prototype.fmtSbx = function(s, b, digits) {
|
|
var b, buf, c, digits, f, i, length, s, width;
|
|
f = this;
|
|
length = b.$length;
|
|
if (b === sliceType$2.nil) {
|
|
length = s.length;
|
|
}
|
|
if (f.fmtFlags.precPresent && f.prec < length) {
|
|
length = f.prec;
|
|
}
|
|
width = $imul(2, length);
|
|
if (width > 0) {
|
|
if (f.fmtFlags.space) {
|
|
if (f.fmtFlags.sharp) {
|
|
width = $imul(width, (2));
|
|
}
|
|
width = width + ((length - 1 >> 0)) >> 0;
|
|
} else if (f.fmtFlags.sharp) {
|
|
width = width + (2) >> 0;
|
|
}
|
|
} else {
|
|
if (f.fmtFlags.widPresent) {
|
|
f.writePadding(f.wid);
|
|
}
|
|
return;
|
|
}
|
|
if (f.fmtFlags.widPresent && f.wid > width && !f.fmtFlags.minus) {
|
|
f.writePadding(f.wid - width >> 0);
|
|
}
|
|
buf = f.buf.$get();
|
|
if (f.fmtFlags.sharp) {
|
|
buf = $append(buf, 48, digits.charCodeAt(16));
|
|
}
|
|
c = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < length)) { break; }
|
|
if (f.fmtFlags.space && i > 0) {
|
|
buf = $append(buf, 32);
|
|
if (f.fmtFlags.sharp) {
|
|
buf = $append(buf, 48, digits.charCodeAt(16));
|
|
}
|
|
}
|
|
if (!(b === sliceType$2.nil)) {
|
|
c = ((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i]);
|
|
} else {
|
|
c = s.charCodeAt(i);
|
|
}
|
|
buf = $append(buf, digits.charCodeAt((c >>> 4 << 24 >>> 24)), digits.charCodeAt(((c & 15) >>> 0)));
|
|
i = i + (1) >> 0;
|
|
}
|
|
f.buf.$set(buf);
|
|
if (f.fmtFlags.widPresent && f.wid > width && f.fmtFlags.minus) {
|
|
f.writePadding(f.wid - width >> 0);
|
|
}
|
|
};
|
|
fmt.prototype.fmtSbx = function(s, b, digits) { return this.$val.fmtSbx(s, b, digits); };
|
|
fmt.ptr.prototype.fmtSx = function(s, digits) {
|
|
var digits, f, s;
|
|
f = this;
|
|
f.fmtSbx(s, sliceType$2.nil, digits);
|
|
};
|
|
fmt.prototype.fmtSx = function(s, digits) { return this.$val.fmtSx(s, digits); };
|
|
fmt.ptr.prototype.fmtBx = function(b, digits) {
|
|
var b, digits, f;
|
|
f = this;
|
|
f.fmtSbx("", b, digits);
|
|
};
|
|
fmt.prototype.fmtBx = function(b, digits) { return this.$val.fmtBx(b, digits); };
|
|
fmt.ptr.prototype.fmtQ = function(s) {
|
|
var buf, f, s;
|
|
f = this;
|
|
s = f.truncateString(s);
|
|
if (f.fmtFlags.sharp && strconv.CanBackquote(s)) {
|
|
f.padString("`" + s + "`");
|
|
return;
|
|
}
|
|
buf = $subslice(new sliceType$2(f.intbuf), 0, 0);
|
|
if (f.fmtFlags.plus) {
|
|
f.pad(strconv.AppendQuoteToASCII(buf, s));
|
|
} else {
|
|
f.pad(strconv.AppendQuote(buf, s));
|
|
}
|
|
};
|
|
fmt.prototype.fmtQ = function(s) { return this.$val.fmtQ(s); };
|
|
fmt.ptr.prototype.fmtC = function(c) {
|
|
var buf, c, f, r, w;
|
|
f = this;
|
|
r = ((c.$low >> 0));
|
|
if ((c.$high > 0 || (c.$high === 0 && c.$low > 1114111))) {
|
|
r = 65533;
|
|
}
|
|
buf = $subslice(new sliceType$2(f.intbuf), 0, 0);
|
|
w = utf8.EncodeRune($subslice(buf, 0, 4), r);
|
|
f.pad($subslice(buf, 0, w));
|
|
};
|
|
fmt.prototype.fmtC = function(c) { return this.$val.fmtC(c); };
|
|
fmt.ptr.prototype.fmtQc = function(c) {
|
|
var buf, c, f, r;
|
|
f = this;
|
|
r = ((c.$low >> 0));
|
|
if ((c.$high > 0 || (c.$high === 0 && c.$low > 1114111))) {
|
|
r = 65533;
|
|
}
|
|
buf = $subslice(new sliceType$2(f.intbuf), 0, 0);
|
|
if (f.fmtFlags.plus) {
|
|
f.pad(strconv.AppendQuoteRuneToASCII(buf, r));
|
|
} else {
|
|
f.pad(strconv.AppendQuoteRune(buf, r));
|
|
}
|
|
};
|
|
fmt.prototype.fmtQc = function(c) { return this.$val.fmtQc(c); };
|
|
fmt.ptr.prototype.fmtFloat = function(v, size, verb, prec) {
|
|
var _1, _2, digits, f, hasDecimalPoint, i, num, oldZero, prec, size, tail, tailBuf, v, verb;
|
|
f = this;
|
|
if (f.fmtFlags.precPresent) {
|
|
prec = f.prec;
|
|
}
|
|
num = strconv.AppendFloat($subslice(new sliceType$2(f.intbuf), 0, 1), v, ((verb << 24 >>> 24)), prec, size);
|
|
if (((1 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 1]) === 45) || ((1 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 1]) === 43)) {
|
|
num = $subslice(num, 1);
|
|
} else {
|
|
(0 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 0] = 43);
|
|
}
|
|
if (f.fmtFlags.space && ((0 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 0]) === 43) && !f.fmtFlags.plus) {
|
|
(0 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 0] = 32);
|
|
}
|
|
if (((1 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 1]) === 73) || ((1 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 1]) === 78)) {
|
|
oldZero = f.fmtFlags.zero;
|
|
f.fmtFlags.zero = false;
|
|
if (((1 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 1]) === 78) && !f.fmtFlags.space && !f.fmtFlags.plus) {
|
|
num = $subslice(num, 1);
|
|
}
|
|
f.pad(num);
|
|
f.fmtFlags.zero = oldZero;
|
|
return;
|
|
}
|
|
if (f.fmtFlags.sharp && !((verb === 98))) {
|
|
digits = 0;
|
|
_1 = verb;
|
|
if ((_1 === (118)) || (_1 === (103)) || (_1 === (71))) {
|
|
digits = prec;
|
|
if (digits === -1) {
|
|
digits = 6;
|
|
}
|
|
}
|
|
tailBuf = arrayType$2.zero();
|
|
tail = $subslice(new sliceType$2(tailBuf), 0, 0);
|
|
hasDecimalPoint = false;
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < num.$length)) { break; }
|
|
_2 = ((i < 0 || i >= num.$length) ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + i]);
|
|
if (_2 === (46)) {
|
|
hasDecimalPoint = true;
|
|
} else if ((_2 === (101)) || (_2 === (69))) {
|
|
tail = $appendSlice(tail, $subslice(num, i));
|
|
num = $subslice(num, 0, i);
|
|
} else {
|
|
digits = digits - (1) >> 0;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (!hasDecimalPoint) {
|
|
num = $append(num, 46);
|
|
}
|
|
while (true) {
|
|
if (!(digits > 0)) { break; }
|
|
num = $append(num, 48);
|
|
digits = digits - (1) >> 0;
|
|
}
|
|
num = $appendSlice(num, tail);
|
|
}
|
|
if (f.fmtFlags.plus || !(((0 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 0]) === 43))) {
|
|
if (f.fmtFlags.zero && f.fmtFlags.widPresent && f.wid > num.$length) {
|
|
f.buf.WriteByte((0 >= num.$length ? ($throwRuntimeError("index out of range"), undefined) : num.$array[num.$offset + 0]));
|
|
f.writePadding(f.wid - num.$length >> 0);
|
|
f.buf.Write($subslice(num, 1));
|
|
return;
|
|
}
|
|
f.pad(num);
|
|
return;
|
|
}
|
|
f.pad($subslice(num, 1));
|
|
};
|
|
fmt.prototype.fmtFloat = function(v, size, verb, prec) { return this.$val.fmtFloat(v, size, verb, prec); };
|
|
$ptrType(buffer).prototype.Write = function(p) {
|
|
var b, p;
|
|
b = this;
|
|
b.$set($appendSlice(b.$get(), p));
|
|
};
|
|
$ptrType(buffer).prototype.WriteString = function(s) {
|
|
var b, s;
|
|
b = this;
|
|
b.$set($appendSlice(b.$get(), s));
|
|
};
|
|
$ptrType(buffer).prototype.WriteByte = function(c) {
|
|
var b, c;
|
|
b = this;
|
|
b.$set($append(b.$get(), c));
|
|
};
|
|
$ptrType(buffer).prototype.WriteRune = function(r) {
|
|
var b, bp, n, r, w, x;
|
|
bp = this;
|
|
if (r < 128) {
|
|
bp.$set($append(bp.$get(), ((r << 24 >>> 24))));
|
|
return;
|
|
}
|
|
b = bp.$get();
|
|
n = b.$length;
|
|
while (true) {
|
|
if (!((n + 4 >> 0) > b.$capacity)) { break; }
|
|
b = $append(b, 0);
|
|
}
|
|
w = utf8.EncodeRune((x = $subslice(b, n, (n + 4 >> 0)), $subslice(new sliceType$2(x.$array), x.$offset, x.$offset + x.$length)), r);
|
|
bp.$set($subslice(b, 0, (n + w >> 0)));
|
|
};
|
|
newPrinter = function() {
|
|
var _r, p, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = ppFree.Get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = $assertType(_r, ptrType$2);
|
|
p.panicking = false;
|
|
p.erroring = false;
|
|
p.fmt.init((p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))));
|
|
$s = -1; return p;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: newPrinter }; } $f._r = _r; $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.ptr.prototype.free = function() {
|
|
var p;
|
|
p = this;
|
|
if (p.buf.$capacity > 65536) {
|
|
return;
|
|
}
|
|
p.buf = $subslice(p.buf, 0, 0);
|
|
p.arg = $ifaceNil;
|
|
p.value = new reflect.Value.ptr(ptrType.nil, 0, 0);
|
|
ppFree.Put(p);
|
|
};
|
|
pp.prototype.free = function() { return this.$val.free(); };
|
|
pp.ptr.prototype.Width = function() {
|
|
var _tmp, _tmp$1, ok, p, wid;
|
|
wid = 0;
|
|
ok = false;
|
|
p = this;
|
|
_tmp = p.fmt.wid;
|
|
_tmp$1 = p.fmt.fmtFlags.widPresent;
|
|
wid = _tmp;
|
|
ok = _tmp$1;
|
|
return [wid, ok];
|
|
};
|
|
pp.prototype.Width = function() { return this.$val.Width(); };
|
|
pp.ptr.prototype.Precision = function() {
|
|
var _tmp, _tmp$1, ok, p, prec;
|
|
prec = 0;
|
|
ok = false;
|
|
p = this;
|
|
_tmp = p.fmt.prec;
|
|
_tmp$1 = p.fmt.fmtFlags.precPresent;
|
|
prec = _tmp;
|
|
ok = _tmp$1;
|
|
return [prec, ok];
|
|
};
|
|
pp.prototype.Precision = function() { return this.$val.Precision(); };
|
|
pp.ptr.prototype.Flag = function(b) {
|
|
var _1, b, p;
|
|
p = this;
|
|
_1 = b;
|
|
if (_1 === (45)) {
|
|
return p.fmt.fmtFlags.minus;
|
|
} else if (_1 === (43)) {
|
|
return p.fmt.fmtFlags.plus || p.fmt.fmtFlags.plusV;
|
|
} else if (_1 === (35)) {
|
|
return p.fmt.fmtFlags.sharp || p.fmt.fmtFlags.sharpV;
|
|
} else if (_1 === (32)) {
|
|
return p.fmt.fmtFlags.space;
|
|
} else if (_1 === (48)) {
|
|
return p.fmt.fmtFlags.zero;
|
|
}
|
|
return false;
|
|
};
|
|
pp.prototype.Flag = function(b) { return this.$val.Flag(b); };
|
|
pp.ptr.prototype.Write = function(b) {
|
|
var _tmp, _tmp$1, b, err, p, ret;
|
|
ret = 0;
|
|
err = $ifaceNil;
|
|
p = this;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).Write(b);
|
|
_tmp = b.$length;
|
|
_tmp$1 = $ifaceNil;
|
|
ret = _tmp;
|
|
err = _tmp$1;
|
|
return [ret, err];
|
|
};
|
|
pp.prototype.Write = function(b) { return this.$val.Write(b); };
|
|
pp.ptr.prototype.WriteString = function(s) {
|
|
var _tmp, _tmp$1, err, p, ret, s;
|
|
ret = 0;
|
|
err = $ifaceNil;
|
|
p = this;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(s);
|
|
_tmp = s.length;
|
|
_tmp$1 = $ifaceNil;
|
|
ret = _tmp;
|
|
err = _tmp$1;
|
|
return [ret, err];
|
|
};
|
|
pp.prototype.WriteString = function(s) { return this.$val.WriteString(s); };
|
|
Sprintf = function(format, a) {
|
|
var _r, a, format, p, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; format = $f.format; p = $f.p; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = newPrinter(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = _r;
|
|
$r = p.doPrintf(format, a); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
s = ($bytesToString(p.buf));
|
|
p.free();
|
|
$s = -1; return s;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sprintf }; } $f._r = _r; $f.a = a; $f.format = format; $f.p = p; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sprintf = Sprintf;
|
|
Errorf = function(format, a) {
|
|
var _r, _r$1, a, format, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; a = $f.a; format = $f.format; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = Sprintf(format, a); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = errors.New(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Errorf }; } $f._r = _r; $f._r$1 = _r$1; $f.a = a; $f.format = format; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Errorf = Errorf;
|
|
Sprint = function(a) {
|
|
var _r, a, p, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; p = $f.p; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = newPrinter(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = _r;
|
|
$r = p.doPrint(a); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
s = ($bytesToString(p.buf));
|
|
p.free();
|
|
$s = -1; return s;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sprint }; } $f._r = _r; $f.a = a; $f.p = p; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sprint = Sprint;
|
|
Fprintln = function(w, a) {
|
|
var _r, _r$1, _tuple, a, err, n, p, w, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; a = $f.a; err = $f.err; n = $f.n; p = $f.p; w = $f.w; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_r = newPrinter(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = _r;
|
|
$r = p.doPrintln(a); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r$1 = w.Write((x = p.buf, $subslice(new sliceType$2(x.$array), x.$offset, x.$offset + x.$length))); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
p.free();
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fprintln }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.a = a; $f.err = err; $f.n = n; $f.p = p; $f.w = w; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Fprintln = Fprintln;
|
|
Println = function(a) {
|
|
var _r, _tuple, a, err, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; a = $f.a; err = $f.err; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
_r = Fprintln(os.Stdout, a); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Println }; } $f._r = _r; $f._tuple = _tuple; $f.a = a; $f.err = err; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Println = Println;
|
|
Sprintln = function(a) {
|
|
var _r, a, p, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; p = $f.p; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = newPrinter(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = _r;
|
|
$r = p.doPrintln(a); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
s = ($bytesToString(p.buf));
|
|
p.free();
|
|
$s = -1; return s;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Sprintln }; } $f._r = _r; $f.a = a; $f.p = p; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Sprintln = Sprintln;
|
|
getField = function(v, i) {
|
|
var _r, _r$1, i, v, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; i = $f.i; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = $clone(v, reflect.Value).Field(i); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
val = _r;
|
|
/* */ if (($clone(val, reflect.Value).Kind() === 20) && !$clone(val, reflect.Value).IsNil()) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (($clone(val, reflect.Value).Kind() === 20) && !$clone(val, reflect.Value).IsNil()) { */ case 2:
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ case 3:
|
|
$s = -1; return val;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: getField }; } $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
tooLarge = function(x) {
|
|
var x;
|
|
return x > 1000000 || x < -1000000;
|
|
};
|
|
parsenum = function(s, start, end) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, end, isnum, newi, num, s, start;
|
|
num = 0;
|
|
isnum = false;
|
|
newi = 0;
|
|
if (start >= end) {
|
|
_tmp = 0;
|
|
_tmp$1 = false;
|
|
_tmp$2 = end;
|
|
num = _tmp;
|
|
isnum = _tmp$1;
|
|
newi = _tmp$2;
|
|
return [num, isnum, newi];
|
|
}
|
|
newi = start;
|
|
while (true) {
|
|
if (!(newi < end && 48 <= s.charCodeAt(newi) && s.charCodeAt(newi) <= 57)) { break; }
|
|
if (tooLarge(num)) {
|
|
_tmp$3 = 0;
|
|
_tmp$4 = false;
|
|
_tmp$5 = end;
|
|
num = _tmp$3;
|
|
isnum = _tmp$4;
|
|
newi = _tmp$5;
|
|
return [num, isnum, newi];
|
|
}
|
|
num = ($imul(num, 10)) + (((s.charCodeAt(newi) - 48 << 24 >>> 24) >> 0)) >> 0;
|
|
isnum = true;
|
|
newi = newi + (1) >> 0;
|
|
}
|
|
return [num, isnum, newi];
|
|
};
|
|
pp.ptr.prototype.unknownType = function(v) {
|
|
var _r, p, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
if (!$clone(v, reflect.Value).IsValid()) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
$s = -1; return;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(63);
|
|
_r = $clone(v, reflect.Value).Type().String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(63);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.unknownType }; } $f._r = _r; $f.p = p; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.unknownType = function(v) { return this.$val.unknownType(v); };
|
|
pp.ptr.prototype.badVerb = function(verb) {
|
|
var _r, _r$1, p, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; p = $f.p; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
p.erroring = true;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!");
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteRune(verb);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(40);
|
|
/* */ if (!($interfaceIsEqual(p.arg, $ifaceNil))) { $s = 2; continue; }
|
|
/* */ if ($clone(p.value, reflect.Value).IsValid()) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!($interfaceIsEqual(p.arg, $ifaceNil))) { */ case 2:
|
|
_r = reflect.TypeOf(p.arg).String(); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(61);
|
|
$r = p.printArg(p.arg, 118); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 5; continue;
|
|
/* } else if ($clone(p.value, reflect.Value).IsValid()) { */ case 3:
|
|
_r$1 = $clone(p.value, reflect.Value).Type().String(); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$1); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(61);
|
|
$r = p.printValue($clone(p.value, reflect.Value), 118, 0); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 5; continue;
|
|
/* } else { */ case 4:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
/* } */ case 5:
|
|
case 1:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(41);
|
|
p.erroring = false;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.badVerb }; } $f._r = _r; $f._r$1 = _r$1; $f.p = p; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.badVerb = function(verb) { return this.$val.badVerb(verb); };
|
|
pp.ptr.prototype.fmtBool = function(v, verb) {
|
|
var _1, p, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; p = $f.p; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if ((_1 === (116)) || (_1 === (118))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if ((_1 === (116)) || (_1 === (118))) { */ case 2:
|
|
p.fmt.fmtBoolean(v);
|
|
$s = 4; continue;
|
|
/* } else { */ case 3:
|
|
$r = p.badVerb(verb); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 4:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtBool }; } $f._1 = _1; $f.p = p; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtBool = function(v, verb) { return this.$val.fmtBool(v, verb); };
|
|
pp.ptr.prototype.fmt0x64 = function(v, leading0x) {
|
|
var leading0x, p, sharp, v;
|
|
p = this;
|
|
sharp = p.fmt.fmtFlags.sharp;
|
|
p.fmt.fmtFlags.sharp = leading0x;
|
|
p.fmt.fmtInteger(v, 16, false, "0123456789abcdefx");
|
|
p.fmt.fmtFlags.sharp = sharp;
|
|
};
|
|
pp.prototype.fmt0x64 = function(v, leading0x) { return this.$val.fmt0x64(v, leading0x); };
|
|
pp.ptr.prototype.fmtInteger = function(v, isSigned, verb) {
|
|
var _1, isSigned, p, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; isSigned = $f.isSigned; p = $f.p; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if (_1 === (118)) { $s = 2; continue; }
|
|
/* */ if (_1 === (100)) { $s = 3; continue; }
|
|
/* */ if (_1 === (98)) { $s = 4; continue; }
|
|
/* */ if (_1 === (111)) { $s = 5; continue; }
|
|
/* */ if (_1 === (120)) { $s = 6; continue; }
|
|
/* */ if (_1 === (88)) { $s = 7; continue; }
|
|
/* */ if (_1 === (99)) { $s = 8; continue; }
|
|
/* */ if (_1 === (113)) { $s = 9; continue; }
|
|
/* */ if (_1 === (85)) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_1 === (118)) { */ case 2:
|
|
if (p.fmt.fmtFlags.sharpV && !isSigned) {
|
|
p.fmt0x64(v, true);
|
|
} else {
|
|
p.fmt.fmtInteger(v, 10, isSigned, "0123456789abcdefx");
|
|
}
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (100)) { */ case 3:
|
|
p.fmt.fmtInteger(v, 10, isSigned, "0123456789abcdefx");
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (98)) { */ case 4:
|
|
p.fmt.fmtInteger(v, 2, isSigned, "0123456789abcdefx");
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (111)) { */ case 5:
|
|
p.fmt.fmtInteger(v, 8, isSigned, "0123456789abcdefx");
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (120)) { */ case 6:
|
|
p.fmt.fmtInteger(v, 16, isSigned, "0123456789abcdefx");
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (88)) { */ case 7:
|
|
p.fmt.fmtInteger(v, 16, isSigned, "0123456789ABCDEFX");
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (99)) { */ case 8:
|
|
p.fmt.fmtC(v);
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (113)) { */ case 9:
|
|
/* */ if ((v.$high < 0 || (v.$high === 0 && v.$low <= 1114111))) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if ((v.$high < 0 || (v.$high === 0 && v.$low <= 1114111))) { */ case 13:
|
|
p.fmt.fmtQc(v);
|
|
$s = 15; continue;
|
|
/* } else { */ case 14:
|
|
$r = p.badVerb(verb); /* */ $s = 16; case 16: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 15:
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (85)) { */ case 10:
|
|
p.fmt.fmtUnicode(v);
|
|
$s = 12; continue;
|
|
/* } else { */ case 11:
|
|
$r = p.badVerb(verb); /* */ $s = 17; case 17: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 12:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtInteger }; } $f._1 = _1; $f.isSigned = isSigned; $f.p = p; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtInteger = function(v, isSigned, verb) { return this.$val.fmtInteger(v, isSigned, verb); };
|
|
pp.ptr.prototype.fmtFloat = function(v, size, verb) {
|
|
var _1, p, size, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; p = $f.p; size = $f.size; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if (_1 === (118)) { $s = 2; continue; }
|
|
/* */ if ((_1 === (98)) || (_1 === (103)) || (_1 === (71))) { $s = 3; continue; }
|
|
/* */ if ((_1 === (102)) || (_1 === (101)) || (_1 === (69))) { $s = 4; continue; }
|
|
/* */ if (_1 === (70)) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_1 === (118)) { */ case 2:
|
|
p.fmt.fmtFloat(v, size, 103, -1);
|
|
$s = 7; continue;
|
|
/* } else if ((_1 === (98)) || (_1 === (103)) || (_1 === (71))) { */ case 3:
|
|
p.fmt.fmtFloat(v, size, verb, -1);
|
|
$s = 7; continue;
|
|
/* } else if ((_1 === (102)) || (_1 === (101)) || (_1 === (69))) { */ case 4:
|
|
p.fmt.fmtFloat(v, size, verb, 6);
|
|
$s = 7; continue;
|
|
/* } else if (_1 === (70)) { */ case 5:
|
|
p.fmt.fmtFloat(v, size, 102, 6);
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
$r = p.badVerb(verb); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 7:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtFloat }; } $f._1 = _1; $f.p = p; $f.size = size; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtFloat = function(v, size, verb) { return this.$val.fmtFloat(v, size, verb); };
|
|
pp.ptr.prototype.fmtComplex = function(v, size, verb) {
|
|
var _1, _q, _q$1, oldPlus, p, size, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _q = $f._q; _q$1 = $f._q$1; oldPlus = $f.oldPlus; p = $f.p; size = $f.size; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if ((_1 === (118)) || (_1 === (98)) || (_1 === (103)) || (_1 === (71)) || (_1 === (102)) || (_1 === (70)) || (_1 === (101)) || (_1 === (69))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if ((_1 === (118)) || (_1 === (98)) || (_1 === (103)) || (_1 === (71)) || (_1 === (102)) || (_1 === (70)) || (_1 === (101)) || (_1 === (69))) { */ case 2:
|
|
oldPlus = p.fmt.fmtFlags.plus;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(40);
|
|
$r = p.fmtFloat(v.$real, (_q = size / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")), verb); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
p.fmt.fmtFlags.plus = true;
|
|
$r = p.fmtFloat(v.$imag, (_q$1 = size / 2, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero")), verb); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("i)");
|
|
p.fmt.fmtFlags.plus = oldPlus;
|
|
$s = 4; continue;
|
|
/* } else { */ case 3:
|
|
$r = p.badVerb(verb); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 4:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtComplex }; } $f._1 = _1; $f._q = _q; $f._q$1 = _q$1; $f.oldPlus = oldPlus; $f.p = p; $f.size = size; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtComplex = function(v, size, verb) { return this.$val.fmtComplex(v, size, verb); };
|
|
pp.ptr.prototype.fmtString = function(v, verb) {
|
|
var _1, p, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; p = $f.p; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if (_1 === (118)) { $s = 2; continue; }
|
|
/* */ if (_1 === (115)) { $s = 3; continue; }
|
|
/* */ if (_1 === (120)) { $s = 4; continue; }
|
|
/* */ if (_1 === (88)) { $s = 5; continue; }
|
|
/* */ if (_1 === (113)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (_1 === (118)) { */ case 2:
|
|
if (p.fmt.fmtFlags.sharpV) {
|
|
p.fmt.fmtQ(v);
|
|
} else {
|
|
p.fmt.fmtS(v);
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (115)) { */ case 3:
|
|
p.fmt.fmtS(v);
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (120)) { */ case 4:
|
|
p.fmt.fmtSx(v, "0123456789abcdefx");
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (88)) { */ case 5:
|
|
p.fmt.fmtSx(v, "0123456789ABCDEFX");
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (113)) { */ case 6:
|
|
p.fmt.fmtQ(v);
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
$r = p.badVerb(verb); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 8:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtString }; } $f._1 = _1; $f.p = p; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtString = function(v, verb) { return this.$val.fmtString(v, verb); };
|
|
pp.ptr.prototype.fmtBytes = function(v, verb, typeString) {
|
|
var _1, _i, _i$1, _r, _ref, _ref$1, c, c$1, i, i$1, p, typeString, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _ref = $f._ref; _ref$1 = $f._ref$1; c = $f.c; c$1 = $f.c$1; i = $f.i; i$1 = $f.i$1; p = $f.p; typeString = $f.typeString; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_1 = verb;
|
|
/* */ if ((_1 === (118)) || (_1 === (100))) { $s = 2; continue; }
|
|
/* */ if (_1 === (115)) { $s = 3; continue; }
|
|
/* */ if (_1 === (120)) { $s = 4; continue; }
|
|
/* */ if (_1 === (88)) { $s = 5; continue; }
|
|
/* */ if (_1 === (113)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if ((_1 === (118)) || (_1 === (100))) { */ case 2:
|
|
if (p.fmt.fmtFlags.sharpV) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(typeString);
|
|
if (v === sliceType$2.nil) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(nil)");
|
|
$s = -1; return;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(123);
|
|
_ref = v;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (i > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(", ");
|
|
}
|
|
p.fmt0x64((new $Uint64(0, c)), true);
|
|
_i++;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(125);
|
|
} else {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(91);
|
|
_ref$1 = v;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
c$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
if (i$1 > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
p.fmt.fmtInteger((new $Uint64(0, c$1)), 10, false, "0123456789abcdefx");
|
|
_i$1++;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(93);
|
|
}
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (115)) { */ case 3:
|
|
p.fmt.fmtBs(v);
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (120)) { */ case 4:
|
|
p.fmt.fmtBx(v, "0123456789abcdefx");
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (88)) { */ case 5:
|
|
p.fmt.fmtBx(v, "0123456789ABCDEFX");
|
|
$s = 8; continue;
|
|
/* } else if (_1 === (113)) { */ case 6:
|
|
p.fmt.fmtQ(($bytesToString(v)));
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
_r = reflect.ValueOf(v); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = p.printValue($clone(_r, reflect.Value), verb, 0); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 8:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtBytes }; } $f._1 = _1; $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._ref = _ref; $f._ref$1 = _ref$1; $f.c = c; $f.c$1 = c$1; $f.i = i; $f.i$1 = i$1; $f.p = p; $f.typeString = typeString; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtBytes = function(v, verb, typeString) { return this.$val.fmtBytes(v, verb, typeString); };
|
|
pp.ptr.prototype.fmtPointer = function(value, verb) {
|
|
var _1, _2, _r, p, u, value, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _r = $f._r; p = $f.p; u = $f.u; value = $f.value; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
u = 0;
|
|
_1 = $clone(value, reflect.Value).Kind();
|
|
/* */ if ((_1 === (18)) || (_1 === (19)) || (_1 === (21)) || (_1 === (22)) || (_1 === (23)) || (_1 === (26))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if ((_1 === (18)) || (_1 === (19)) || (_1 === (21)) || (_1 === (22)) || (_1 === (23)) || (_1 === (26))) { */ case 2:
|
|
u = $clone(value, reflect.Value).Pointer();
|
|
$s = 4; continue;
|
|
/* } else { */ case 3:
|
|
$r = p.badVerb(verb); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 4:
|
|
case 1:
|
|
_2 = verb;
|
|
/* */ if (_2 === (118)) { $s = 7; continue; }
|
|
/* */ if (_2 === (112)) { $s = 8; continue; }
|
|
/* */ if ((_2 === (98)) || (_2 === (111)) || (_2 === (100)) || (_2 === (120)) || (_2 === (88))) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_2 === (118)) { */ case 7:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 12:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(40);
|
|
_r = $clone(value, reflect.Value).Type().String(); /* */ $s = 15; case 15: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r); /* */ $s = 16; case 16: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(")(");
|
|
if (u === 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("nil");
|
|
} else {
|
|
p.fmt0x64((new $Uint64(0, u.constructor === Number ? u : 1)), true);
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(41);
|
|
$s = 14; continue;
|
|
/* } else { */ case 13:
|
|
if (u === 0) {
|
|
p.fmt.padString("<nil>");
|
|
} else {
|
|
p.fmt0x64((new $Uint64(0, u.constructor === Number ? u : 1)), !p.fmt.fmtFlags.sharp);
|
|
}
|
|
/* } */ case 14:
|
|
$s = 11; continue;
|
|
/* } else if (_2 === (112)) { */ case 8:
|
|
p.fmt0x64((new $Uint64(0, u.constructor === Number ? u : 1)), !p.fmt.fmtFlags.sharp);
|
|
$s = 11; continue;
|
|
/* } else if ((_2 === (98)) || (_2 === (111)) || (_2 === (100)) || (_2 === (120)) || (_2 === (88))) { */ case 9:
|
|
$r = p.fmtInteger((new $Uint64(0, u.constructor === Number ? u : 1)), false, verb); /* */ $s = 17; case 17: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 11; continue;
|
|
/* } else { */ case 10:
|
|
$r = p.badVerb(verb); /* */ $s = 18; case 18: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 11:
|
|
case 6:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.fmtPointer }; } $f._1 = _1; $f._2 = _2; $f._r = _r; $f.p = p; $f.u = u; $f.value = value; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.fmtPointer = function(value, verb) { return this.$val.fmtPointer(value, verb); };
|
|
pp.ptr.prototype.catchPanic = function(arg, verb, method) {
|
|
var _r, arg, err, method, oldFlags, p, v, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; arg = $f.arg; err = $f.err; method = $f.method; oldFlags = $f.oldFlags; p = $f.p; v = $f.v; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
err = $recover();
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 1:
|
|
_r = reflect.ValueOf(arg); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
if (($clone(v, reflect.Value).Kind() === 22) && $clone(v, reflect.Value).IsNil()) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
$s = -1; return;
|
|
}
|
|
if (p.panicking) {
|
|
$panic(err);
|
|
}
|
|
oldFlags = $clone(p.fmt.fmtFlags, fmtFlags);
|
|
p.fmt.clearflags();
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!");
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteRune(verb);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(PANIC=");
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(method);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(" method: ");
|
|
p.panicking = true;
|
|
$r = p.printArg(err, 118); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
p.panicking = false;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(41);
|
|
fmtFlags.copy(p.fmt.fmtFlags, oldFlags);
|
|
/* } */ case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.catchPanic }; } $f._r = _r; $f.arg = arg; $f.err = err; $f.method = method; $f.oldFlags = oldFlags; $f.p = p; $f.v = v; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.catchPanic = function(arg, verb, method) { return this.$val.catchPanic(arg, verb, method); };
|
|
pp.ptr.prototype.handleMethods = function(verb) {
|
|
var _1, _r, _r$1, _r$2, _ref, _tuple, _tuple$1, formatter, handled, ok, ok$1, p, stringer, v, v$1, verb, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _ref = $f._ref; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; formatter = $f.formatter; handled = $f.handled; ok = $f.ok; ok$1 = $f.ok$1; p = $f.p; stringer = $f.stringer; v = $f.v; v$1 = $f.v$1; verb = $f.verb; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
handled = false;
|
|
p = this;
|
|
if (p.erroring) {
|
|
$s = -1; return handled;
|
|
}
|
|
_tuple = $assertType(p.arg, Formatter, true);
|
|
formatter = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
handled = true;
|
|
$deferred.push([$methodVal(p, "catchPanic"), [p.arg, verb, "Format"]]);
|
|
$r = formatter.Format(p, verb); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return handled;
|
|
/* } */ case 2:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 4:
|
|
_tuple$1 = $assertType(p.arg, GoStringer, true);
|
|
stringer = _tuple$1[0];
|
|
ok$1 = _tuple$1[1];
|
|
/* */ if (ok$1) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (ok$1) { */ case 7:
|
|
handled = true;
|
|
$deferred.push([$methodVal(p, "catchPanic"), [p.arg, verb, "GoString"]]);
|
|
_r = stringer.GoString(); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = p.fmt.fmtS(_r); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return handled;
|
|
/* } */ case 8:
|
|
$s = 6; continue;
|
|
/* } else { */ case 5:
|
|
_1 = verb;
|
|
/* */ if ((_1 === (118)) || (_1 === (115)) || (_1 === (120)) || (_1 === (88)) || (_1 === (113))) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if ((_1 === (118)) || (_1 === (115)) || (_1 === (120)) || (_1 === (88)) || (_1 === (113))) { */ case 12:
|
|
_ref = p.arg;
|
|
/* */ if ($assertType(_ref, $error, true)[1]) { $s = 14; continue; }
|
|
/* */ if ($assertType(_ref, Stringer, true)[1]) { $s = 15; continue; }
|
|
/* */ $s = 16; continue;
|
|
/* if ($assertType(_ref, $error, true)[1]) { */ case 14:
|
|
v = _ref;
|
|
handled = true;
|
|
$deferred.push([$methodVal(p, "catchPanic"), [p.arg, verb, "Error"]]);
|
|
_r$1 = v.Error(); /* */ $s = 17; case 17: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$r = p.fmtString(_r$1, verb); /* */ $s = 18; case 18: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return handled;
|
|
/* } else if ($assertType(_ref, Stringer, true)[1]) { */ case 15:
|
|
v$1 = _ref;
|
|
handled = true;
|
|
$deferred.push([$methodVal(p, "catchPanic"), [p.arg, verb, "String"]]);
|
|
_r$2 = v$1.String(); /* */ $s = 19; case 19: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$r = p.fmtString(_r$2, verb); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return handled;
|
|
/* } */ case 16:
|
|
/* } */ case 13:
|
|
case 11:
|
|
/* } */ case 6:
|
|
handled = false;
|
|
$s = -1; return handled;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return handled; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: pp.ptr.prototype.handleMethods }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._ref = _ref; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.formatter = formatter; $f.handled = handled; $f.ok = ok; $f.ok$1 = ok$1; $f.p = p; $f.stringer = stringer; $f.v = v; $f.v$1 = v$1; $f.verb = verb; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
pp.prototype.handleMethods = function(verb) { return this.$val.handleMethods(verb); };
|
|
pp.ptr.prototype.printArg = function(arg, verb) {
|
|
var _1, _2, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _ref, arg, f, f$1, f$10, f$11, f$12, f$13, f$14, f$15, f$16, f$17, f$18, f$19, f$2, f$3, f$4, f$5, f$6, f$7, f$8, f$9, p, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _ref = $f._ref; arg = $f.arg; f = $f.f; f$1 = $f.f$1; f$10 = $f.f$10; f$11 = $f.f$11; f$12 = $f.f$12; f$13 = $f.f$13; f$14 = $f.f$14; f$15 = $f.f$15; f$16 = $f.f$16; f$17 = $f.f$17; f$18 = $f.f$18; f$19 = $f.f$19; f$2 = $f.f$2; f$3 = $f.f$3; f$4 = $f.f$4; f$5 = $f.f$5; f$6 = $f.f$6; f$7 = $f.f$7; f$8 = $f.f$8; f$9 = $f.f$9; p = $f.p; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
p.arg = arg;
|
|
p.value = new reflect.Value.ptr(ptrType.nil, 0, 0);
|
|
/* */ if ($interfaceIsEqual(arg, $ifaceNil)) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ($interfaceIsEqual(arg, $ifaceNil)) { */ case 1:
|
|
_1 = verb;
|
|
/* */ if ((_1 === (84)) || (_1 === (118))) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ((_1 === (84)) || (_1 === (118))) { */ case 4:
|
|
p.fmt.padString("<nil>");
|
|
$s = 6; continue;
|
|
/* } else { */ case 5:
|
|
$r = p.badVerb(verb); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 6:
|
|
case 3:
|
|
$s = -1; return;
|
|
/* } */ case 2:
|
|
_2 = verb;
|
|
/* */ if (_2 === (84)) { $s = 9; continue; }
|
|
/* */ if (_2 === (112)) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_2 === (84)) { */ case 9:
|
|
_r = reflect.TypeOf(arg).String(); /* */ $s = 12; case 12: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = p.fmt.fmtS(_r); /* */ $s = 13; case 13: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } else if (_2 === (112)) { */ case 10:
|
|
_r$1 = reflect.ValueOf(arg); /* */ $s = 14; case 14: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$r = p.fmtPointer($clone(_r$1, reflect.Value), 112); /* */ $s = 15; case 15: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 11:
|
|
case 8:
|
|
_ref = arg;
|
|
/* */ if ($assertType(_ref, $Bool, true)[1]) { $s = 16; continue; }
|
|
/* */ if ($assertType(_ref, $Float32, true)[1]) { $s = 17; continue; }
|
|
/* */ if ($assertType(_ref, $Float64, true)[1]) { $s = 18; continue; }
|
|
/* */ if ($assertType(_ref, $Complex64, true)[1]) { $s = 19; continue; }
|
|
/* */ if ($assertType(_ref, $Complex128, true)[1]) { $s = 20; continue; }
|
|
/* */ if ($assertType(_ref, $Int, true)[1]) { $s = 21; continue; }
|
|
/* */ if ($assertType(_ref, $Int8, true)[1]) { $s = 22; continue; }
|
|
/* */ if ($assertType(_ref, $Int16, true)[1]) { $s = 23; continue; }
|
|
/* */ if ($assertType(_ref, $Int32, true)[1]) { $s = 24; continue; }
|
|
/* */ if ($assertType(_ref, $Int64, true)[1]) { $s = 25; continue; }
|
|
/* */ if ($assertType(_ref, $Uint, true)[1]) { $s = 26; continue; }
|
|
/* */ if ($assertType(_ref, $Uint8, true)[1]) { $s = 27; continue; }
|
|
/* */ if ($assertType(_ref, $Uint16, true)[1]) { $s = 28; continue; }
|
|
/* */ if ($assertType(_ref, $Uint32, true)[1]) { $s = 29; continue; }
|
|
/* */ if ($assertType(_ref, $Uint64, true)[1]) { $s = 30; continue; }
|
|
/* */ if ($assertType(_ref, $Uintptr, true)[1]) { $s = 31; continue; }
|
|
/* */ if ($assertType(_ref, $String, true)[1]) { $s = 32; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$2, true)[1]) { $s = 33; continue; }
|
|
/* */ if ($assertType(_ref, reflect.Value, true)[1]) { $s = 34; continue; }
|
|
/* */ $s = 35; continue;
|
|
/* if ($assertType(_ref, $Bool, true)[1]) { */ case 16:
|
|
f = _ref.$val;
|
|
$r = p.fmtBool(f, verb); /* */ $s = 37; case 37: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Float32, true)[1]) { */ case 17:
|
|
f$1 = _ref.$val;
|
|
$r = p.fmtFloat((f$1), 32, verb); /* */ $s = 38; case 38: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Float64, true)[1]) { */ case 18:
|
|
f$2 = _ref.$val;
|
|
$r = p.fmtFloat(f$2, 64, verb); /* */ $s = 39; case 39: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Complex64, true)[1]) { */ case 19:
|
|
f$3 = _ref.$val;
|
|
$r = p.fmtComplex((new $Complex128(f$3.$real, f$3.$imag)), 64, verb); /* */ $s = 40; case 40: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Complex128, true)[1]) { */ case 20:
|
|
f$4 = _ref.$val;
|
|
$r = p.fmtComplex(f$4, 128, verb); /* */ $s = 41; case 41: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Int, true)[1]) { */ case 21:
|
|
f$5 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$5)), true, verb); /* */ $s = 42; case 42: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Int8, true)[1]) { */ case 22:
|
|
f$6 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$6)), true, verb); /* */ $s = 43; case 43: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Int16, true)[1]) { */ case 23:
|
|
f$7 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$7)), true, verb); /* */ $s = 44; case 44: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Int32, true)[1]) { */ case 24:
|
|
f$8 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$8)), true, verb); /* */ $s = 45; case 45: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Int64, true)[1]) { */ case 25:
|
|
f$9 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(f$9.$high, f$9.$low)), true, verb); /* */ $s = 46; case 46: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uint, true)[1]) { */ case 26:
|
|
f$10 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$10)), false, verb); /* */ $s = 47; case 47: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uint8, true)[1]) { */ case 27:
|
|
f$11 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$11)), false, verb); /* */ $s = 48; case 48: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uint16, true)[1]) { */ case 28:
|
|
f$12 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$12)), false, verb); /* */ $s = 49; case 49: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uint32, true)[1]) { */ case 29:
|
|
f$13 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$13)), false, verb); /* */ $s = 50; case 50: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uint64, true)[1]) { */ case 30:
|
|
f$14 = _ref.$val;
|
|
$r = p.fmtInteger(f$14, false, verb); /* */ $s = 51; case 51: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $Uintptr, true)[1]) { */ case 31:
|
|
f$15 = _ref.$val;
|
|
$r = p.fmtInteger((new $Uint64(0, f$15.constructor === Number ? f$15 : 1)), false, verb); /* */ $s = 52; case 52: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, $String, true)[1]) { */ case 32:
|
|
f$16 = _ref.$val;
|
|
$r = p.fmtString(f$16, verb); /* */ $s = 53; case 53: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, sliceType$2, true)[1]) { */ case 33:
|
|
f$17 = _ref.$val;
|
|
$r = p.fmtBytes(f$17, verb, "[]byte"); /* */ $s = 54; case 54: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else if ($assertType(_ref, reflect.Value, true)[1]) { */ case 34:
|
|
f$18 = _ref.$val;
|
|
/* */ if ($clone(f$18, reflect.Value).IsValid() && $clone(f$18, reflect.Value).CanInterface()) { $s = 55; continue; }
|
|
/* */ $s = 56; continue;
|
|
/* if ($clone(f$18, reflect.Value).IsValid() && $clone(f$18, reflect.Value).CanInterface()) { */ case 55:
|
|
_r$2 = $clone(f$18, reflect.Value).Interface(); /* */ $s = 57; case 57: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
p.arg = _r$2;
|
|
_r$3 = p.handleMethods(verb); /* */ $s = 60; case 60: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (_r$3) { $s = 58; continue; }
|
|
/* */ $s = 59; continue;
|
|
/* if (_r$3) { */ case 58:
|
|
$s = -1; return;
|
|
/* } */ case 59:
|
|
/* } */ case 56:
|
|
$r = p.printValue($clone(f$18, reflect.Value), verb, 0); /* */ $s = 61; case 61: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 36; continue;
|
|
/* } else { */ case 35:
|
|
f$19 = _ref;
|
|
_r$4 = p.handleMethods(verb); /* */ $s = 64; case 64: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$4) { $s = 62; continue; }
|
|
/* */ $s = 63; continue;
|
|
/* if (!_r$4) { */ case 62:
|
|
_r$5 = reflect.ValueOf(f$19); /* */ $s = 65; case 65: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$r = p.printValue($clone(_r$5, reflect.Value), verb, 0); /* */ $s = 66; case 66: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 63:
|
|
/* } */ case 36:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.printArg }; } $f._1 = _1; $f._2 = _2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._ref = _ref; $f.arg = arg; $f.f = f; $f.f$1 = f$1; $f.f$10 = f$10; $f.f$11 = f$11; $f.f$12 = f$12; $f.f$13 = f$13; $f.f$14 = f$14; $f.f$15 = f$15; $f.f$16 = f$16; $f.f$17 = f$17; $f.f$18 = f$18; $f.f$19 = f$19; $f.f$2 = f$2; $f.f$3 = f$3; $f.f$4 = f$4; $f.f$5 = f$5; $f.f$6 = f$6; $f.f$7 = f$7; $f.f$8 = f$8; $f.f$9 = f$9; $f.p = p; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.printArg = function(arg, verb) { return this.$val.printArg(arg, verb); };
|
|
pp.ptr.prototype.printValue = function(value, verb, depth) {
|
|
var _1, _2, _3, _4, _arg, _arg$1, _arg$2, _i, _i$1, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$16, _r$17, _r$18, _r$19, _r$2, _r$20, _r$21, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _ref$1, a, bytes, depth, f, i, i$1, i$2, i$3, i$4, key, name, p, sorted, t, value, value$1, verb, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$16 = $f._r$16; _r$17 = $f._r$17; _r$18 = $f._r$18; _r$19 = $f._r$19; _r$2 = $f._r$2; _r$20 = $f._r$20; _r$21 = $f._r$21; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _ref$1 = $f._ref$1; a = $f.a; bytes = $f.bytes; depth = $f.depth; f = $f.f; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; i$4 = $f.i$4; key = $f.key; name = $f.name; p = $f.p; sorted = $f.sorted; t = $f.t; value = $f.value; value$1 = $f.value$1; verb = $f.verb; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
/* */ if (depth > 0 && $clone(value, reflect.Value).IsValid() && $clone(value, reflect.Value).CanInterface()) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (depth > 0 && $clone(value, reflect.Value).IsValid() && $clone(value, reflect.Value).CanInterface()) { */ case 1:
|
|
_r = $clone(value, reflect.Value).Interface(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p.arg = _r;
|
|
_r$1 = p.handleMethods(verb); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_r$1) { */ case 4:
|
|
$s = -1; return;
|
|
/* } */ case 5:
|
|
/* } */ case 2:
|
|
p.arg = $ifaceNil;
|
|
p.value = value;
|
|
f = value;
|
|
_1 = $clone(value, reflect.Value).Kind();
|
|
/* */ if (_1 === (0)) { $s = 8; continue; }
|
|
/* */ if (_1 === (1)) { $s = 9; continue; }
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 10; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { $s = 11; continue; }
|
|
/* */ if (_1 === (13)) { $s = 12; continue; }
|
|
/* */ if (_1 === (14)) { $s = 13; continue; }
|
|
/* */ if (_1 === (15)) { $s = 14; continue; }
|
|
/* */ if (_1 === (16)) { $s = 15; continue; }
|
|
/* */ if (_1 === (24)) { $s = 16; continue; }
|
|
/* */ if (_1 === (21)) { $s = 17; continue; }
|
|
/* */ if (_1 === (25)) { $s = 18; continue; }
|
|
/* */ if (_1 === (20)) { $s = 19; continue; }
|
|
/* */ if ((_1 === (17)) || (_1 === (23))) { $s = 20; continue; }
|
|
/* */ if (_1 === (22)) { $s = 21; continue; }
|
|
/* */ if ((_1 === (18)) || (_1 === (19)) || (_1 === (26))) { $s = 22; continue; }
|
|
/* */ $s = 23; continue;
|
|
/* if (_1 === (0)) { */ case 8:
|
|
/* */ if (depth === 0) { $s = 25; continue; }
|
|
/* */ $s = 26; continue;
|
|
/* if (depth === 0) { */ case 25:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<invalid reflect.Value>");
|
|
$s = 27; continue;
|
|
/* } else { */ case 26:
|
|
_2 = verb;
|
|
/* */ if (_2 === (118)) { $s = 29; continue; }
|
|
/* */ $s = 30; continue;
|
|
/* if (_2 === (118)) { */ case 29:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
$s = 31; continue;
|
|
/* } else { */ case 30:
|
|
$r = p.badVerb(verb); /* */ $s = 32; case 32: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 31:
|
|
case 28:
|
|
/* } */ case 27:
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (1)) { */ case 9:
|
|
$r = p.fmtBool($clone(f, reflect.Value).Bool(), verb); /* */ $s = 33; case 33: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 10:
|
|
$r = p.fmtInteger(((x = $clone(f, reflect.Value).Int(), new $Uint64(x.$high, x.$low))), true, verb); /* */ $s = 34; case 34: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { */ case 11:
|
|
$r = p.fmtInteger($clone(f, reflect.Value).Uint(), false, verb); /* */ $s = 35; case 35: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (13)) { */ case 12:
|
|
$r = p.fmtFloat($clone(f, reflect.Value).Float(), 32, verb); /* */ $s = 36; case 36: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (14)) { */ case 13:
|
|
$r = p.fmtFloat($clone(f, reflect.Value).Float(), 64, verb); /* */ $s = 37; case 37: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (15)) { */ case 14:
|
|
$r = p.fmtComplex($clone(f, reflect.Value).Complex(), 64, verb); /* */ $s = 38; case 38: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (16)) { */ case 15:
|
|
$r = p.fmtComplex($clone(f, reflect.Value).Complex(), 128, verb); /* */ $s = 39; case 39: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (24)) { */ case 16:
|
|
_r$2 = $clone(f, reflect.Value).String(); /* */ $s = 40; case 40: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$r = p.fmtString(_r$2, verb); /* */ $s = 41; case 41: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (21)) { */ case 17:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 42; continue; }
|
|
/* */ $s = 43; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 42:
|
|
_r$3 = $clone(f, reflect.Value).Type().String(); /* */ $s = 45; case 45: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$3); /* */ $s = 46; case 46: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if ($clone(f, reflect.Value).IsNil()) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(nil)");
|
|
$s = -1; return;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(123);
|
|
$s = 44; continue;
|
|
/* } else { */ case 43:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("map[");
|
|
/* } */ case 44:
|
|
_r$4 = fmtsort.Sort($clone(f, reflect.Value)); /* */ $s = 47; case 47: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
sorted = _r$4;
|
|
_ref = sorted.Key;
|
|
_i = 0;
|
|
/* while (true) { */ case 48:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 49; continue; }
|
|
i = _i;
|
|
key = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (i > 0) {
|
|
if (p.fmt.fmtFlags.sharpV) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(", ");
|
|
} else {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
}
|
|
$r = p.printValue($clone(key, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 50; case 50: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(58);
|
|
$r = p.printValue($clone((x$1 = sorted.Value, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])), reflect.Value), verb, depth + 1 >> 0); /* */ $s = 51; case 51: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i++;
|
|
/* } */ $s = 48; continue; case 49:
|
|
if (p.fmt.fmtFlags.sharpV) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(125);
|
|
} else {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(93);
|
|
}
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (25)) { */ case 18:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 52; continue; }
|
|
/* */ $s = 53; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 52:
|
|
_r$5 = $clone(f, reflect.Value).Type().String(); /* */ $s = 54; case 54: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$5); /* */ $s = 55; case 55: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 53:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(123);
|
|
i$1 = 0;
|
|
/* while (true) { */ case 56:
|
|
/* if (!(i$1 < $clone(f, reflect.Value).NumField())) { break; } */ if(!(i$1 < $clone(f, reflect.Value).NumField())) { $s = 57; continue; }
|
|
if (i$1 > 0) {
|
|
if (p.fmt.fmtFlags.sharpV) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(", ");
|
|
} else {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
}
|
|
/* */ if (p.fmt.fmtFlags.plusV || p.fmt.fmtFlags.sharpV) { $s = 58; continue; }
|
|
/* */ $s = 59; continue;
|
|
/* if (p.fmt.fmtFlags.plusV || p.fmt.fmtFlags.sharpV) { */ case 58:
|
|
_r$6 = $clone(f, reflect.Value).Type().Field(i$1); /* */ $s = 60; case 60: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
name = _r$6.Name;
|
|
if (!(name === "")) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(name);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(58);
|
|
}
|
|
/* } */ case 59:
|
|
_r$7 = getField($clone(f, reflect.Value), i$1); /* */ $s = 61; case 61: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$r = p.printValue($clone(_r$7, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 62; case 62: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 56; continue; case 57:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(125);
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (20)) { */ case 19:
|
|
_r$8 = $clone(f, reflect.Value).Elem(); /* */ $s = 63; case 63: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
value$1 = _r$8;
|
|
/* */ if (!$clone(value$1, reflect.Value).IsValid()) { $s = 64; continue; }
|
|
/* */ $s = 65; continue;
|
|
/* if (!$clone(value$1, reflect.Value).IsValid()) { */ case 64:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 67; continue; }
|
|
/* */ $s = 68; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 67:
|
|
_r$9 = $clone(f, reflect.Value).Type().String(); /* */ $s = 70; case 70: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$9); /* */ $s = 71; case 71: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(nil)");
|
|
$s = 69; continue;
|
|
/* } else { */ case 68:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
/* } */ case 69:
|
|
$s = 66; continue;
|
|
/* } else { */ case 65:
|
|
$r = p.printValue($clone(value$1, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 72; case 72: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 66:
|
|
$s = 24; continue;
|
|
/* } else if ((_1 === (17)) || (_1 === (23))) { */ case 20:
|
|
_3 = verb;
|
|
/* */ if ((_3 === (115)) || (_3 === (113)) || (_3 === (120)) || (_3 === (88))) { $s = 74; continue; }
|
|
/* */ $s = 75; continue;
|
|
/* if ((_3 === (115)) || (_3 === (113)) || (_3 === (120)) || (_3 === (88))) { */ case 74:
|
|
t = $clone(f, reflect.Value).Type();
|
|
_r$10 = t.Elem(); /* */ $s = 78; case 78: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_r$11 = _r$10.Kind(); /* */ $s = 79; case 79: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
/* */ if (_r$11 === 8) { $s = 76; continue; }
|
|
/* */ $s = 77; continue;
|
|
/* if (_r$11 === 8) { */ case 76:
|
|
bytes = sliceType$2.nil;
|
|
/* */ if ($clone(f, reflect.Value).Kind() === 23) { $s = 80; continue; }
|
|
/* */ if ($clone(f, reflect.Value).CanAddr()) { $s = 81; continue; }
|
|
/* */ $s = 82; continue;
|
|
/* if ($clone(f, reflect.Value).Kind() === 23) { */ case 80:
|
|
_r$12 = $clone(f, reflect.Value).Bytes(); /* */ $s = 84; case 84: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
bytes = _r$12;
|
|
$s = 83; continue;
|
|
/* } else if ($clone(f, reflect.Value).CanAddr()) { */ case 81:
|
|
_r$13 = $clone(f, reflect.Value).Slice(0, $clone(f, reflect.Value).Len()); /* */ $s = 85; case 85: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
_r$14 = $clone(_r$13, reflect.Value).Bytes(); /* */ $s = 86; case 86: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
bytes = _r$14;
|
|
$s = 83; continue;
|
|
/* } else { */ case 82:
|
|
bytes = $makeSlice(sliceType$2, $clone(f, reflect.Value).Len());
|
|
_ref$1 = bytes;
|
|
_i$1 = 0;
|
|
/* while (true) { */ case 87:
|
|
/* if (!(_i$1 < _ref$1.$length)) { break; } */ if(!(_i$1 < _ref$1.$length)) { $s = 88; continue; }
|
|
i$2 = _i$1;
|
|
_r$15 = $clone(f, reflect.Value).Index(i$2); /* */ $s = 89; case 89: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
_r$16 = $clone(_r$15, reflect.Value).Uint(); /* */ $s = 90; case 90: if($c) { $c = false; _r$16 = _r$16.$blk(); } if (_r$16 && _r$16.$blk !== undefined) { break s; }
|
|
((i$2 < 0 || i$2 >= bytes.$length) ? ($throwRuntimeError("index out of range"), undefined) : bytes.$array[bytes.$offset + i$2] = ((_r$16.$low << 24 >>> 24)));
|
|
_i$1++;
|
|
/* } */ $s = 87; continue; case 88:
|
|
/* } */ case 83:
|
|
_arg = bytes;
|
|
_arg$1 = verb;
|
|
_r$17 = t.String(); /* */ $s = 91; case 91: if($c) { $c = false; _r$17 = _r$17.$blk(); } if (_r$17 && _r$17.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$17;
|
|
$r = p.fmtBytes(_arg, _arg$1, _arg$2); /* */ $s = 92; case 92: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 77:
|
|
/* } */ case 75:
|
|
case 73:
|
|
/* */ if (p.fmt.fmtFlags.sharpV) { $s = 93; continue; }
|
|
/* */ $s = 94; continue;
|
|
/* if (p.fmt.fmtFlags.sharpV) { */ case 93:
|
|
_r$18 = $clone(f, reflect.Value).Type().String(); /* */ $s = 96; case 96: if($c) { $c = false; _r$18 = _r$18.$blk(); } if (_r$18 && _r$18.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$18); /* */ $s = 97; case 97: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (($clone(f, reflect.Value).Kind() === 23) && $clone(f, reflect.Value).IsNil()) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(nil)");
|
|
$s = -1; return;
|
|
}
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(123);
|
|
i$3 = 0;
|
|
/* while (true) { */ case 98:
|
|
/* if (!(i$3 < $clone(f, reflect.Value).Len())) { break; } */ if(!(i$3 < $clone(f, reflect.Value).Len())) { $s = 99; continue; }
|
|
if (i$3 > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(", ");
|
|
}
|
|
_r$19 = $clone(f, reflect.Value).Index(i$3); /* */ $s = 100; case 100: if($c) { $c = false; _r$19 = _r$19.$blk(); } if (_r$19 && _r$19.$blk !== undefined) { break s; }
|
|
$r = p.printValue($clone(_r$19, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 101; case 101: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$3 = i$3 + (1) >> 0;
|
|
/* } */ $s = 98; continue; case 99:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(125);
|
|
$s = 95; continue;
|
|
/* } else { */ case 94:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(91);
|
|
i$4 = 0;
|
|
/* while (true) { */ case 102:
|
|
/* if (!(i$4 < $clone(f, reflect.Value).Len())) { break; } */ if(!(i$4 < $clone(f, reflect.Value).Len())) { $s = 103; continue; }
|
|
if (i$4 > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
_r$20 = $clone(f, reflect.Value).Index(i$4); /* */ $s = 104; case 104: if($c) { $c = false; _r$20 = _r$20.$blk(); } if (_r$20 && _r$20.$blk !== undefined) { break s; }
|
|
$r = p.printValue($clone(_r$20, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 105; case 105: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$4 = i$4 + (1) >> 0;
|
|
/* } */ $s = 102; continue; case 103:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(93);
|
|
/* } */ case 95:
|
|
$s = 24; continue;
|
|
/* } else if (_1 === (22)) { */ case 21:
|
|
/* */ if ((depth === 0) && !(($clone(f, reflect.Value).Pointer() === 0))) { $s = 106; continue; }
|
|
/* */ $s = 107; continue;
|
|
/* if ((depth === 0) && !(($clone(f, reflect.Value).Pointer() === 0))) { */ case 106:
|
|
_r$21 = $clone(f, reflect.Value).Elem(); /* */ $s = 109; case 109: if($c) { $c = false; _r$21 = _r$21.$blk(); } if (_r$21 && _r$21.$blk !== undefined) { break s; }
|
|
a = _r$21;
|
|
_4 = $clone(a, reflect.Value).Kind();
|
|
/* */ if ((_4 === (17)) || (_4 === (23)) || (_4 === (25)) || (_4 === (21))) { $s = 110; continue; }
|
|
/* */ $s = 111; continue;
|
|
/* if ((_4 === (17)) || (_4 === (23)) || (_4 === (25)) || (_4 === (21))) { */ case 110:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(38);
|
|
$r = p.printValue($clone(a, reflect.Value), verb, depth + 1 >> 0); /* */ $s = 112; case 112: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 111:
|
|
case 108:
|
|
/* } */ case 107:
|
|
$r = p.fmtPointer($clone(f, reflect.Value), verb); /* */ $s = 113; case 113: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else if ((_1 === (18)) || (_1 === (19)) || (_1 === (26))) { */ case 22:
|
|
$r = p.fmtPointer($clone(f, reflect.Value), verb); /* */ $s = 114; case 114: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 24; continue;
|
|
/* } else { */ case 23:
|
|
$r = p.unknownType($clone(f, reflect.Value)); /* */ $s = 115; case 115: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 24:
|
|
case 7:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.printValue }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$16 = _r$16; $f._r$17 = _r$17; $f._r$18 = _r$18; $f._r$19 = _r$19; $f._r$2 = _r$2; $f._r$20 = _r$20; $f._r$21 = _r$21; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._ref$1 = _ref$1; $f.a = a; $f.bytes = bytes; $f.depth = depth; $f.f = f; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.i$4 = i$4; $f.key = key; $f.name = name; $f.p = p; $f.sorted = sorted; $f.t = t; $f.value = value; $f.value$1 = value$1; $f.verb = verb; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.printValue = function(value, verb, depth) { return this.$val.printValue(value, verb, depth); };
|
|
intFromArg = function(a, argNum) {
|
|
var _1, _r, _tuple, a, argNum, isInt, n, n$1, newArgNum, num, v, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _tuple = $f._tuple; a = $f.a; argNum = $f.argNum; isInt = $f.isInt; n = $f.n; n$1 = $f.n$1; newArgNum = $f.newArgNum; num = $f.num; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
num = 0;
|
|
isInt = false;
|
|
newArgNum = 0;
|
|
newArgNum = argNum;
|
|
/* */ if (argNum < a.$length) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (argNum < a.$length) { */ case 1:
|
|
_tuple = $assertType(((argNum < 0 || argNum >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + argNum]), $Int, true);
|
|
num = _tuple[0];
|
|
isInt = _tuple[1];
|
|
/* */ if (!isInt) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!isInt) { */ case 3:
|
|
_r = reflect.ValueOf(((argNum < 0 || argNum >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + argNum])); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
_1 = $clone(v, reflect.Value).Kind();
|
|
if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) {
|
|
n = $clone(v, reflect.Value).Int();
|
|
if ((x = (new $Int64(0, (((n.$low + ((n.$high >> 31) * 4294967296)) >> 0)))), (x.$high === n.$high && x.$low === n.$low))) {
|
|
num = (((n.$low + ((n.$high >> 31) * 4294967296)) >> 0));
|
|
isInt = true;
|
|
}
|
|
} else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) {
|
|
n$1 = $clone(v, reflect.Value).Uint();
|
|
if ((x$1 = (new $Int64(n$1.$high, n$1.$low)), (x$1.$high > 0 || (x$1.$high === 0 && x$1.$low >= 0))) && (x$2 = (new $Uint64(0, ((n$1.$low >> 0)))), (x$2.$high === n$1.$high && x$2.$low === n$1.$low))) {
|
|
num = ((n$1.$low >> 0));
|
|
isInt = true;
|
|
}
|
|
}
|
|
case 5:
|
|
/* } */ case 4:
|
|
newArgNum = argNum + 1 >> 0;
|
|
if (tooLarge(num)) {
|
|
num = 0;
|
|
isInt = false;
|
|
}
|
|
/* } */ case 2:
|
|
$s = -1; return [num, isInt, newArgNum];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: intFromArg }; } $f._1 = _1; $f._r = _r; $f._tuple = _tuple; $f.a = a; $f.argNum = argNum; $f.isInt = isInt; $f.n = n; $f.n$1 = n$1; $f.newArgNum = newArgNum; $f.num = num; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseArgNumber = function(format) {
|
|
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, format, i, index, newi, ok, ok$1, wid, width;
|
|
index = 0;
|
|
wid = 0;
|
|
ok = false;
|
|
if (format.length < 3) {
|
|
_tmp = 0;
|
|
_tmp$1 = 1;
|
|
_tmp$2 = false;
|
|
index = _tmp;
|
|
wid = _tmp$1;
|
|
ok = _tmp$2;
|
|
return [index, wid, ok];
|
|
}
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < format.length)) { break; }
|
|
if (format.charCodeAt(i) === 93) {
|
|
_tuple = parsenum(format, 1, i);
|
|
width = _tuple[0];
|
|
ok$1 = _tuple[1];
|
|
newi = _tuple[2];
|
|
if (!ok$1 || !((newi === i))) {
|
|
_tmp$3 = 0;
|
|
_tmp$4 = i + 1 >> 0;
|
|
_tmp$5 = false;
|
|
index = _tmp$3;
|
|
wid = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [index, wid, ok];
|
|
}
|
|
_tmp$6 = width - 1 >> 0;
|
|
_tmp$7 = i + 1 >> 0;
|
|
_tmp$8 = true;
|
|
index = _tmp$6;
|
|
wid = _tmp$7;
|
|
ok = _tmp$8;
|
|
return [index, wid, ok];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$9 = 0;
|
|
_tmp$10 = 1;
|
|
_tmp$11 = false;
|
|
index = _tmp$9;
|
|
wid = _tmp$10;
|
|
ok = _tmp$11;
|
|
return [index, wid, ok];
|
|
};
|
|
pp.ptr.prototype.argNumber = function(argNum, format, i, numArgs) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tuple, argNum, format, found, i, index, newArgNum, newi, numArgs, ok, p, wid;
|
|
newArgNum = 0;
|
|
newi = 0;
|
|
found = false;
|
|
p = this;
|
|
if (format.length <= i || !((format.charCodeAt(i) === 91))) {
|
|
_tmp = argNum;
|
|
_tmp$1 = i;
|
|
_tmp$2 = false;
|
|
newArgNum = _tmp;
|
|
newi = _tmp$1;
|
|
found = _tmp$2;
|
|
return [newArgNum, newi, found];
|
|
}
|
|
p.reordered = true;
|
|
_tuple = parseArgNumber($substring(format, i));
|
|
index = _tuple[0];
|
|
wid = _tuple[1];
|
|
ok = _tuple[2];
|
|
if (ok && 0 <= index && index < numArgs) {
|
|
_tmp$3 = index;
|
|
_tmp$4 = i + wid >> 0;
|
|
_tmp$5 = true;
|
|
newArgNum = _tmp$3;
|
|
newi = _tmp$4;
|
|
found = _tmp$5;
|
|
return [newArgNum, newi, found];
|
|
}
|
|
p.goodArgNum = false;
|
|
_tmp$6 = argNum;
|
|
_tmp$7 = i + wid >> 0;
|
|
_tmp$8 = ok;
|
|
newArgNum = _tmp$6;
|
|
newi = _tmp$7;
|
|
found = _tmp$8;
|
|
return [newArgNum, newi, found];
|
|
};
|
|
pp.prototype.argNumber = function(argNum, format, i, numArgs) { return this.$val.argNumber(argNum, format, i, numArgs); };
|
|
pp.ptr.prototype.badArgNum = function(verb) {
|
|
var p, verb;
|
|
p = this;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!");
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteRune(verb);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(BADINDEX)");
|
|
};
|
|
pp.prototype.badArgNum = function(verb) { return this.$val.badArgNum(verb); };
|
|
pp.ptr.prototype.missingArg = function(verb) {
|
|
var p, verb;
|
|
p = this;
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!");
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteRune(verb);
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("(MISSING)");
|
|
};
|
|
pp.prototype.missingArg = function(verb) { return this.$val.missingArg(verb); };
|
|
pp.ptr.prototype.doPrintf = function(format, a) {
|
|
var _1, _i, _r, _r$1, _r$2, _ref, _tmp, _tmp$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, a, afterIndex, arg, argNum, c, end, format, i, i$1, lasti, p, size, verb, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; a = $f.a; afterIndex = $f.afterIndex; arg = $f.arg; argNum = $f.argNum; c = $f.c; end = $f.end; format = $f.format; i = $f.i; i$1 = $f.i$1; lasti = $f.lasti; p = $f.p; size = $f.size; verb = $f.verb; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
end = format.length;
|
|
argNum = 0;
|
|
afterIndex = false;
|
|
p.reordered = false;
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < end)) { break; } */ if(!(i < end)) { $s = 2; continue; }
|
|
p.goodArgNum = true;
|
|
lasti = i;
|
|
while (true) {
|
|
if (!(i < end && !((format.charCodeAt(i) === 37)))) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (i > lasti) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString($substring(format, lasti, i));
|
|
}
|
|
if (i >= end) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
i = i + (1) >> 0;
|
|
p.fmt.clearflags();
|
|
/* while (true) { */ case 3:
|
|
/* if (!(i < end)) { break; } */ if(!(i < end)) { $s = 4; continue; }
|
|
c = format.charCodeAt(i);
|
|
_1 = c;
|
|
/* */ if (_1 === (35)) { $s = 6; continue; }
|
|
/* */ if (_1 === (48)) { $s = 7; continue; }
|
|
/* */ if (_1 === (43)) { $s = 8; continue; }
|
|
/* */ if (_1 === (45)) { $s = 9; continue; }
|
|
/* */ if (_1 === (32)) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_1 === (35)) { */ case 6:
|
|
p.fmt.fmtFlags.sharp = true;
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (48)) { */ case 7:
|
|
p.fmt.fmtFlags.zero = !p.fmt.fmtFlags.minus;
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (43)) { */ case 8:
|
|
p.fmt.fmtFlags.plus = true;
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (45)) { */ case 9:
|
|
p.fmt.fmtFlags.minus = true;
|
|
p.fmt.fmtFlags.zero = false;
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (32)) { */ case 10:
|
|
p.fmt.fmtFlags.space = true;
|
|
$s = 12; continue;
|
|
/* } else { */ case 11:
|
|
/* */ if (97 <= c && c <= 122 && argNum < a.$length) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (97 <= c && c <= 122 && argNum < a.$length) { */ case 13:
|
|
if (c === 118) {
|
|
p.fmt.fmtFlags.sharpV = p.fmt.fmtFlags.sharp;
|
|
p.fmt.fmtFlags.sharp = false;
|
|
p.fmt.fmtFlags.plusV = p.fmt.fmtFlags.plus;
|
|
p.fmt.fmtFlags.plus = false;
|
|
}
|
|
$r = p.printArg(((argNum < 0 || argNum >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + argNum]), ((c >> 0))); /* */ $s = 15; case 15: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
argNum = argNum + (1) >> 0;
|
|
i = i + (1) >> 0;
|
|
/* continue formatLoop; */ $s = 1; continue s;
|
|
/* } */ case 14:
|
|
/* break simpleFormat; */ $s = 4; continue s;
|
|
/* } */ case 12:
|
|
case 5:
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 3; continue; case 4:
|
|
_tuple = p.argNumber(argNum, format, i, a.$length);
|
|
argNum = _tuple[0];
|
|
i = _tuple[1];
|
|
afterIndex = _tuple[2];
|
|
/* */ if (i < end && (format.charCodeAt(i) === 42)) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if (i < end && (format.charCodeAt(i) === 42)) { */ case 16:
|
|
i = i + (1) >> 0;
|
|
_r = intFromArg(a, argNum); /* */ $s = 19; case 19: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
p.fmt.wid = _tuple$1[0];
|
|
p.fmt.fmtFlags.widPresent = _tuple$1[1];
|
|
argNum = _tuple$1[2];
|
|
if (!p.fmt.fmtFlags.widPresent) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!(BADWIDTH)");
|
|
}
|
|
if (p.fmt.wid < 0) {
|
|
p.fmt.wid = -p.fmt.wid;
|
|
p.fmt.fmtFlags.minus = true;
|
|
p.fmt.fmtFlags.zero = false;
|
|
}
|
|
afterIndex = false;
|
|
$s = 18; continue;
|
|
/* } else { */ case 17:
|
|
_tuple$2 = parsenum(format, i, end);
|
|
p.fmt.wid = _tuple$2[0];
|
|
p.fmt.fmtFlags.widPresent = _tuple$2[1];
|
|
i = _tuple$2[2];
|
|
if (afterIndex && p.fmt.fmtFlags.widPresent) {
|
|
p.goodArgNum = false;
|
|
}
|
|
/* } */ case 18:
|
|
/* */ if ((i + 1 >> 0) < end && (format.charCodeAt(i) === 46)) { $s = 20; continue; }
|
|
/* */ $s = 21; continue;
|
|
/* if ((i + 1 >> 0) < end && (format.charCodeAt(i) === 46)) { */ case 20:
|
|
i = i + (1) >> 0;
|
|
if (afterIndex) {
|
|
p.goodArgNum = false;
|
|
}
|
|
_tuple$3 = p.argNumber(argNum, format, i, a.$length);
|
|
argNum = _tuple$3[0];
|
|
i = _tuple$3[1];
|
|
afterIndex = _tuple$3[2];
|
|
/* */ if (i < end && (format.charCodeAt(i) === 42)) { $s = 22; continue; }
|
|
/* */ $s = 23; continue;
|
|
/* if (i < end && (format.charCodeAt(i) === 42)) { */ case 22:
|
|
i = i + (1) >> 0;
|
|
_r$1 = intFromArg(a, argNum); /* */ $s = 25; case 25: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$1;
|
|
p.fmt.prec = _tuple$4[0];
|
|
p.fmt.fmtFlags.precPresent = _tuple$4[1];
|
|
argNum = _tuple$4[2];
|
|
if (p.fmt.prec < 0) {
|
|
p.fmt.prec = 0;
|
|
p.fmt.fmtFlags.precPresent = false;
|
|
}
|
|
if (!p.fmt.fmtFlags.precPresent) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!(BADPREC)");
|
|
}
|
|
afterIndex = false;
|
|
$s = 24; continue;
|
|
/* } else { */ case 23:
|
|
_tuple$5 = parsenum(format, i, end);
|
|
p.fmt.prec = _tuple$5[0];
|
|
p.fmt.fmtFlags.precPresent = _tuple$5[1];
|
|
i = _tuple$5[2];
|
|
if (!p.fmt.fmtFlags.precPresent) {
|
|
p.fmt.prec = 0;
|
|
p.fmt.fmtFlags.precPresent = true;
|
|
}
|
|
/* } */ case 24:
|
|
/* } */ case 21:
|
|
if (!afterIndex) {
|
|
_tuple$6 = p.argNumber(argNum, format, i, a.$length);
|
|
argNum = _tuple$6[0];
|
|
i = _tuple$6[1];
|
|
afterIndex = _tuple$6[2];
|
|
}
|
|
if (i >= end) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!(NOVERB)");
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
_tmp = ((format.charCodeAt(i) >> 0));
|
|
_tmp$1 = 1;
|
|
verb = _tmp;
|
|
size = _tmp$1;
|
|
if (verb >= 128) {
|
|
_tuple$7 = utf8.DecodeRuneInString($substring(format, i));
|
|
verb = _tuple$7[0];
|
|
size = _tuple$7[1];
|
|
}
|
|
i = i + (size) >> 0;
|
|
/* */ if ((verb === 37)) { $s = 27; continue; }
|
|
/* */ if (!p.goodArgNum) { $s = 28; continue; }
|
|
/* */ if (argNum >= a.$length) { $s = 29; continue; }
|
|
/* */ if ((verb === 118)) { $s = 30; continue; }
|
|
/* */ $s = 31; continue;
|
|
/* if ((verb === 37)) { */ case 27:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(37);
|
|
$s = 32; continue;
|
|
/* } else if (!p.goodArgNum) { */ case 28:
|
|
p.badArgNum(verb);
|
|
$s = 32; continue;
|
|
/* } else if (argNum >= a.$length) { */ case 29:
|
|
p.missingArg(verb);
|
|
$s = 32; continue;
|
|
/* } else if ((verb === 118)) { */ case 30:
|
|
p.fmt.fmtFlags.sharpV = p.fmt.fmtFlags.sharp;
|
|
p.fmt.fmtFlags.sharp = false;
|
|
p.fmt.fmtFlags.plusV = p.fmt.fmtFlags.plus;
|
|
p.fmt.fmtFlags.plus = false;
|
|
$r = p.printArg(((argNum < 0 || argNum >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + argNum]), verb); /* */ $s = 33; case 33: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
argNum = argNum + (1) >> 0;
|
|
$s = 32; continue;
|
|
/* } else { */ case 31:
|
|
$r = p.printArg(((argNum < 0 || argNum >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + argNum]), verb); /* */ $s = 34; case 34: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
argNum = argNum + (1) >> 0;
|
|
/* } */ case 32:
|
|
case 26:
|
|
/* } */ $s = 1; continue; case 2:
|
|
/* */ if (!p.reordered && argNum < a.$length) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if (!p.reordered && argNum < a.$length) { */ case 35:
|
|
p.fmt.clearflags();
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("%!(EXTRA ");
|
|
_ref = $subslice(a, argNum);
|
|
_i = 0;
|
|
/* while (true) { */ case 37:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 38; continue; }
|
|
i$1 = _i;
|
|
arg = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (i$1 > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(", ");
|
|
}
|
|
/* */ if ($interfaceIsEqual(arg, $ifaceNil)) { $s = 39; continue; }
|
|
/* */ $s = 40; continue;
|
|
/* if ($interfaceIsEqual(arg, $ifaceNil)) { */ case 39:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString("<nil>");
|
|
$s = 41; continue;
|
|
/* } else { */ case 40:
|
|
_r$2 = reflect.TypeOf(arg).String(); /* */ $s = 42; case 42: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$r = (p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteString(_r$2); /* */ $s = 43; case 43: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(61);
|
|
$r = p.printArg(arg, 118); /* */ $s = 44; case 44: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 41:
|
|
_i++;
|
|
/* } */ $s = 37; continue; case 38:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(41);
|
|
/* } */ case 36:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.doPrintf }; } $f._1 = _1; $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f.a = a; $f.afterIndex = afterIndex; $f.arg = arg; $f.argNum = argNum; $f.c = c; $f.end = end; $f.format = format; $f.i = i; $f.i$1 = i$1; $f.lasti = lasti; $f.p = p; $f.size = size; $f.verb = verb; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.doPrintf = function(format, a) { return this.$val.doPrintf(format, a); };
|
|
pp.ptr.prototype.doPrint = function(a) {
|
|
var _i, _r, _ref, _v, a, arg, argNum, isString, p, prevString, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _v = $f._v; a = $f.a; arg = $f.arg; argNum = $f.argNum; isString = $f.isString; p = $f.p; prevString = $f.prevString; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
prevString = false;
|
|
_ref = a;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
argNum = _i;
|
|
arg = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!(!($interfaceIsEqual(arg, $ifaceNil)))) { _v = false; $s = 3; continue s; }
|
|
_r = reflect.TypeOf(arg).Kind(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r === 24; case 3:
|
|
isString = _v;
|
|
if (argNum > 0 && !isString && !prevString) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
$r = p.printArg(arg, 118); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
prevString = isString;
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.doPrint }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._v = _v; $f.a = a; $f.arg = arg; $f.argNum = argNum; $f.isString = isString; $f.p = p; $f.prevString = prevString; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.doPrint = function(a) { return this.$val.doPrint(a); };
|
|
pp.ptr.prototype.doPrintln = function(a) {
|
|
var _i, _ref, a, arg, argNum, p, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _ref = $f._ref; a = $f.a; arg = $f.arg; argNum = $f.argNum; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_ref = a;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
argNum = _i;
|
|
arg = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (argNum > 0) {
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(32);
|
|
}
|
|
$r = p.printArg(arg, 118); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).WriteByte(10);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: pp.ptr.prototype.doPrintln }; } $f._i = _i; $f._ref = _ref; $f.a = a; $f.arg = arg; $f.argNum = argNum; $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
pp.prototype.doPrintln = function(a) { return this.$val.doPrintln(a); };
|
|
ss.ptr.prototype.Read = function(buf) {
|
|
var _tmp, _tmp$1, buf, err, n, s;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
_tmp = 0;
|
|
_tmp$1 = errors.New("ScanState's Read should not be called. Use ReadRune");
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
return [n, err];
|
|
};
|
|
ss.prototype.Read = function(buf) { return this.$val.Read(buf); };
|
|
ss.ptr.prototype.ReadRune = function() {
|
|
var _r, _tuple, err, r, s, size, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; r = $f.r; s = $f.s; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = 0;
|
|
size = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
if (s.atEOF || s.count >= s.ssave.argLimit) {
|
|
err = io.EOF;
|
|
$s = -1; return [r, size, err];
|
|
}
|
|
_r = s.rs.ReadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
size = _tuple[1];
|
|
err = _tuple[2];
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
s.count = s.count + (1) >> 0;
|
|
if (s.ssave.nlIsEnd && (r === 10)) {
|
|
s.atEOF = true;
|
|
}
|
|
} else if ($interfaceIsEqual(err, io.EOF)) {
|
|
s.atEOF = true;
|
|
}
|
|
$s = -1; return [r, size, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.ReadRune }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.r = r; $f.s = s; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.ReadRune = function() { return this.$val.ReadRune(); };
|
|
ss.ptr.prototype.Width = function() {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, ok, s, wid;
|
|
wid = 0;
|
|
ok = false;
|
|
s = this;
|
|
if (s.ssave.maxWid === 1073741824) {
|
|
_tmp = 0;
|
|
_tmp$1 = false;
|
|
wid = _tmp;
|
|
ok = _tmp$1;
|
|
return [wid, ok];
|
|
}
|
|
_tmp$2 = s.ssave.maxWid;
|
|
_tmp$3 = true;
|
|
wid = _tmp$2;
|
|
ok = _tmp$3;
|
|
return [wid, ok];
|
|
};
|
|
ss.prototype.Width = function() { return this.$val.Width(); };
|
|
ss.ptr.prototype.getRune = function() {
|
|
var _r, _tuple, err, r, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; r = $f.r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = 0;
|
|
s = this;
|
|
_r = s.ReadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
if ($interfaceIsEqual(err, io.EOF)) {
|
|
r = -1;
|
|
$s = -1; return r;
|
|
}
|
|
s.error(err);
|
|
}
|
|
$s = -1; return r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.getRune }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.r = r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.getRune = function() { return this.$val.getRune(); };
|
|
ss.ptr.prototype.UnreadRune = function() {
|
|
var _r, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_r = s.rs.UnreadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
s.atEOF = false;
|
|
s.count = s.count - (1) >> 0;
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.UnreadRune }; } $f._r = _r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.UnreadRune = function() { return this.$val.UnreadRune(); };
|
|
ss.ptr.prototype.error = function(err) {
|
|
var err, s, x;
|
|
s = this;
|
|
$panic((x = new scanError.ptr(err), new x.constructor.elem(x)));
|
|
};
|
|
ss.prototype.error = function(err) { return this.$val.error(err); };
|
|
ss.ptr.prototype.errorString = function(err) {
|
|
var err, s, x;
|
|
s = this;
|
|
$panic((x = new scanError.ptr(errors.New(err)), new x.constructor.elem(x)));
|
|
};
|
|
ss.prototype.errorString = function(err) { return this.$val.errorString(err); };
|
|
ss.ptr.prototype.Token = function(skipSpace, f) {
|
|
var _r, err, f, s, skipSpace, tok, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; f = $f.f; s = $f.s; skipSpace = $f.skipSpace; tok = $f.tok; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
err = [err];
|
|
tok = sliceType$2.nil;
|
|
err[0] = $ifaceNil;
|
|
s = this;
|
|
$deferred.push([(function(err) { return function() {
|
|
var _tuple, e, ok, se;
|
|
e = $recover();
|
|
if (!($interfaceIsEqual(e, $ifaceNil))) {
|
|
_tuple = $assertType(e, scanError, true);
|
|
se = $clone(_tuple[0], scanError);
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
err[0] = se.err;
|
|
} else {
|
|
$panic(e);
|
|
}
|
|
}
|
|
}; })(err), []]);
|
|
if (f === $throwNilPointerError) {
|
|
f = notSpace;
|
|
}
|
|
s.buf = $subslice(s.buf, 0, 0);
|
|
_r = s.token(skipSpace, f); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
tok = _r;
|
|
$s = -1; return [tok, err[0]];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [tok, err[0]]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: ss.ptr.prototype.Token }; } $f._r = _r; $f.err = err; $f.f = f; $f.s = s; $f.skipSpace = skipSpace; $f.tok = tok; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
ss.prototype.Token = function(skipSpace, f) { return this.$val.Token(skipSpace, f); };
|
|
isSpace = function(r) {
|
|
var _i, _ref, r, rng, rx;
|
|
if (r >= 65536) {
|
|
return false;
|
|
}
|
|
rx = ((r << 16 >>> 16));
|
|
_ref = space;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
rng = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), arrayType$1);
|
|
if (rx < rng[0]) {
|
|
return false;
|
|
}
|
|
if (rx <= rng[1]) {
|
|
return true;
|
|
}
|
|
_i++;
|
|
}
|
|
return false;
|
|
};
|
|
notSpace = function(r) {
|
|
var r;
|
|
return !isSpace(r);
|
|
};
|
|
ss.ptr.prototype.free = function(old) {
|
|
var old, s;
|
|
s = this;
|
|
if (old.validSave) {
|
|
ssave.copy(s.ssave, old);
|
|
return;
|
|
}
|
|
if (s.buf.$capacity > 1024) {
|
|
return;
|
|
}
|
|
s.buf = $subslice(s.buf, 0, 0);
|
|
s.rs = $ifaceNil;
|
|
ssFree.Put(s);
|
|
};
|
|
ss.prototype.free = function(old) { return this.$val.free(old); };
|
|
ss.ptr.prototype.SkipSpace = function() {
|
|
var _r, _r$1, _r$2, _v, r, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _v = $f._v; r = $f.r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
/* while (true) { */ case 1:
|
|
_r = s.getRune(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
r = _r;
|
|
if (r === -1) {
|
|
$s = -1; return;
|
|
}
|
|
if (!(r === 13)) { _v = false; $s = 6; continue s; }
|
|
_r$1 = s.peek("\n"); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v = _r$1; case 6:
|
|
/* */ if (_v) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (_v) { */ case 4:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 5:
|
|
/* */ if (r === 10) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (r === 10) { */ case 8:
|
|
if (s.ssave.nlIsSpace) {
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
s.errorString("unexpected newline");
|
|
$s = -1; return;
|
|
/* } */ case 9:
|
|
/* */ if (!isSpace(r)) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (!isSpace(r)) { */ case 10:
|
|
_r$2 = s.UnreadRune(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$2;
|
|
/* break; */ $s = 2; continue;
|
|
/* } */ case 11:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.SkipSpace }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._v = _v; $f.r = r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.SkipSpace = function() { return this.$val.SkipSpace(); };
|
|
ss.ptr.prototype.token = function(skipSpace, f) {
|
|
var _r, _r$1, _r$2, f, r, s, skipSpace, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; f = $f.f; r = $f.r; s = $f.s; skipSpace = $f.skipSpace; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
/* */ if (skipSpace) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (skipSpace) { */ case 1:
|
|
$r = s.SkipSpace(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
/* while (true) { */ case 4:
|
|
_r = s.getRune(); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
r = _r;
|
|
if (r === -1) {
|
|
/* break; */ $s = 5; continue;
|
|
}
|
|
_r$1 = f(r); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!_r$1) { */ case 7:
|
|
_r$2 = s.UnreadRune(); /* */ $s = 10; case 10: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$2;
|
|
/* break; */ $s = 5; continue;
|
|
/* } */ case 8:
|
|
(s.$ptr_buf || (s.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, s))).WriteRune(r);
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return (x = s.buf, $subslice(new sliceType$2(x.$array), x.$offset, x.$offset + x.$length));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.token }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.f = f; $f.r = r; $f.s = s; $f.skipSpace = skipSpace; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.token = function(skipSpace, f) { return this.$val.token(skipSpace, f); };
|
|
indexRune = function(s, r) {
|
|
var _i, _ref, _rune, c, i, r, s;
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i = _i;
|
|
c = _rune[0];
|
|
if (c === r) {
|
|
return i;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return -1;
|
|
};
|
|
ss.ptr.prototype.peek = function(ok) {
|
|
var _r, _r$1, ok, r, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; ok = $f.ok; r = $f.r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_r = s.getRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
r = _r;
|
|
/* */ if (!((r === -1))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((r === -1))) { */ case 2:
|
|
_r$1 = s.UnreadRune(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
/* } */ case 3:
|
|
$s = -1; return indexRune(ok, r) >= 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.peek }; } $f._r = _r; $f._r$1 = _r$1; $f.ok = ok; $f.r = r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
ss.prototype.peek = function(ok) { return this.$val.peek(ok); };
|
|
ptrType$25.methods = [{prop: "clearflags", name: "clearflags", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "init", name: "init", pkg: "fmt", typ: $funcType([ptrType$1], [], false)}, {prop: "writePadding", name: "writePadding", pkg: "fmt", typ: $funcType([$Int], [], false)}, {prop: "pad", name: "pad", pkg: "fmt", typ: $funcType([sliceType$2], [], false)}, {prop: "padString", name: "padString", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmtBoolean", name: "fmtBoolean", pkg: "fmt", typ: $funcType([$Bool], [], false)}, {prop: "fmtUnicode", name: "fmtUnicode", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmtInteger", name: "fmtInteger", pkg: "fmt", typ: $funcType([$Uint64, $Int, $Bool, $String], [], false)}, {prop: "truncateString", name: "truncateString", pkg: "fmt", typ: $funcType([$String], [$String], false)}, {prop: "truncate", name: "truncate", pkg: "fmt", typ: $funcType([sliceType$2], [sliceType$2], false)}, {prop: "fmtS", name: "fmtS", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmtBs", name: "fmtBs", pkg: "fmt", typ: $funcType([sliceType$2], [], false)}, {prop: "fmtSbx", name: "fmtSbx", pkg: "fmt", typ: $funcType([$String, sliceType$2, $String], [], false)}, {prop: "fmtSx", name: "fmtSx", pkg: "fmt", typ: $funcType([$String, $String], [], false)}, {prop: "fmtBx", name: "fmtBx", pkg: "fmt", typ: $funcType([sliceType$2, $String], [], false)}, {prop: "fmtQ", name: "fmtQ", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmtC", name: "fmtC", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmtQc", name: "fmtQc", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmtFloat", name: "fmtFloat", pkg: "fmt", typ: $funcType([$Float64, $Int, $Int32, $Int], [], false)}];
|
|
ptrType$1.methods = [{prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [], false)}, {prop: "WriteByte", name: "WriteByte", pkg: "", typ: $funcType([$Uint8], [], false)}, {prop: "WriteRune", name: "WriteRune", pkg: "", typ: $funcType([$Int32], [], false)}];
|
|
ptrType$2.methods = [{prop: "free", name: "free", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "Width", name: "Width", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Precision", name: "Precision", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Flag", name: "Flag", pkg: "", typ: $funcType([$Int], [$Bool], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [$Int, $error], false)}, {prop: "unknownType", name: "unknownType", pkg: "fmt", typ: $funcType([reflect.Value], [], false)}, {prop: "badVerb", name: "badVerb", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "fmtBool", name: "fmtBool", pkg: "fmt", typ: $funcType([$Bool, $Int32], [], false)}, {prop: "fmt0x64", name: "fmt0x64", pkg: "fmt", typ: $funcType([$Uint64, $Bool], [], false)}, {prop: "fmtInteger", name: "fmtInteger", pkg: "fmt", typ: $funcType([$Uint64, $Bool, $Int32], [], false)}, {prop: "fmtFloat", name: "fmtFloat", pkg: "fmt", typ: $funcType([$Float64, $Int, $Int32], [], false)}, {prop: "fmtComplex", name: "fmtComplex", pkg: "fmt", typ: $funcType([$Complex128, $Int, $Int32], [], false)}, {prop: "fmtString", name: "fmtString", pkg: "fmt", typ: $funcType([$String, $Int32], [], false)}, {prop: "fmtBytes", name: "fmtBytes", pkg: "fmt", typ: $funcType([sliceType$2, $Int32, $String], [], false)}, {prop: "fmtPointer", name: "fmtPointer", pkg: "fmt", typ: $funcType([reflect.Value, $Int32], [], false)}, {prop: "catchPanic", name: "catchPanic", pkg: "fmt", typ: $funcType([$emptyInterface, $Int32, $String], [], false)}, {prop: "handleMethods", name: "handleMethods", pkg: "fmt", typ: $funcType([$Int32], [$Bool], false)}, {prop: "printArg", name: "printArg", pkg: "fmt", typ: $funcType([$emptyInterface, $Int32], [], false)}, {prop: "printValue", name: "printValue", pkg: "fmt", typ: $funcType([reflect.Value, $Int32, $Int], [], false)}, {prop: "argNumber", name: "argNumber", pkg: "fmt", typ: $funcType([$Int, $String, $Int, $Int], [$Int, $Int, $Bool], false)}, {prop: "badArgNum", name: "badArgNum", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "missingArg", name: "missingArg", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "doPrintf", name: "doPrintf", pkg: "fmt", typ: $funcType([$String, sliceType], [], false)}, {prop: "doPrint", name: "doPrint", pkg: "fmt", typ: $funcType([sliceType], [], false)}, {prop: "doPrintln", name: "doPrintln", pkg: "fmt", typ: $funcType([sliceType], [], false)}];
|
|
ptrType$5.methods = [{prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}, {prop: "Width", name: "Width", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "getRune", name: "getRune", pkg: "fmt", typ: $funcType([], [$Int32], false)}, {prop: "mustReadRune", name: "mustReadRune", pkg: "fmt", typ: $funcType([], [$Int32], false)}, {prop: "UnreadRune", name: "UnreadRune", pkg: "", typ: $funcType([], [$error], false)}, {prop: "error", name: "error", pkg: "fmt", typ: $funcType([$error], [], false)}, {prop: "errorString", name: "errorString", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "Token", name: "Token", pkg: "", typ: $funcType([$Bool, funcType], [sliceType$2, $error], false)}, {prop: "free", name: "free", pkg: "fmt", typ: $funcType([ssave], [], false)}, {prop: "SkipSpace", name: "SkipSpace", pkg: "", typ: $funcType([], [], false)}, {prop: "token", name: "token", pkg: "fmt", typ: $funcType([$Bool, funcType], [sliceType$2], false)}, {prop: "consume", name: "consume", pkg: "fmt", typ: $funcType([$String, $Bool], [$Bool], false)}, {prop: "peek", name: "peek", pkg: "fmt", typ: $funcType([$String], [$Bool], false)}, {prop: "notEOF", name: "notEOF", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "accept", name: "accept", pkg: "fmt", typ: $funcType([$String], [$Bool], false)}, {prop: "okVerb", name: "okVerb", pkg: "fmt", typ: $funcType([$Int32, $String, $String], [$Bool], false)}, {prop: "scanBool", name: "scanBool", pkg: "fmt", typ: $funcType([$Int32], [$Bool], false)}, {prop: "getBase", name: "getBase", pkg: "fmt", typ: $funcType([$Int32], [$Int, $String], false)}, {prop: "scanNumber", name: "scanNumber", pkg: "fmt", typ: $funcType([$String, $Bool], [$String], false)}, {prop: "scanRune", name: "scanRune", pkg: "fmt", typ: $funcType([$Int], [$Int64], false)}, {prop: "scanBasePrefix", name: "scanBasePrefix", pkg: "fmt", typ: $funcType([], [$Int, $String, $Bool], false)}, {prop: "scanInt", name: "scanInt", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Int64], false)}, {prop: "scanUint", name: "scanUint", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Uint64], false)}, {prop: "floatToken", name: "floatToken", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "complexTokens", name: "complexTokens", pkg: "fmt", typ: $funcType([], [$String, $String], false)}, {prop: "convertFloat", name: "convertFloat", pkg: "fmt", typ: $funcType([$String, $Int], [$Float64], false)}, {prop: "scanComplex", name: "scanComplex", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Complex128], false)}, {prop: "convertString", name: "convertString", pkg: "fmt", typ: $funcType([$Int32], [$String], false)}, {prop: "quotedString", name: "quotedString", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "hexByte", name: "hexByte", pkg: "fmt", typ: $funcType([], [$Uint8, $Bool], false)}, {prop: "hexString", name: "hexString", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "scanOne", name: "scanOne", pkg: "fmt", typ: $funcType([$Int32, $emptyInterface], [], false)}, {prop: "doScan", name: "doScan", pkg: "fmt", typ: $funcType([sliceType], [$Int, $error], false)}, {prop: "advance", name: "advance", pkg: "fmt", typ: $funcType([$String], [$Int], false)}, {prop: "doScanf", name: "doScanf", pkg: "fmt", typ: $funcType([$String, sliceType], [$Int, $error], false)}];
|
|
fmtFlags.init("fmt", [{prop: "widPresent", name: "widPresent", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "precPresent", name: "precPresent", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "minus", name: "minus", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "plus", name: "plus", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "sharp", name: "sharp", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "space", name: "space", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "zero", name: "zero", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "plusV", name: "plusV", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "sharpV", name: "sharpV", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
fmt.init("fmt", [{prop: "buf", name: "buf", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "fmtFlags", name: "fmtFlags", embedded: true, exported: false, typ: fmtFlags, tag: ""}, {prop: "wid", name: "wid", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "prec", name: "prec", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "intbuf", name: "intbuf", embedded: false, exported: false, typ: arrayType, tag: ""}]);
|
|
State.init([{prop: "Flag", name: "Flag", pkg: "", typ: $funcType([$Int], [$Bool], false)}, {prop: "Precision", name: "Precision", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Width", name: "Width", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}]);
|
|
Formatter.init([{prop: "Format", name: "Format", pkg: "", typ: $funcType([State, $Int32], [], false)}]);
|
|
Stringer.init([{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}]);
|
|
GoStringer.init([{prop: "GoString", name: "GoString", pkg: "", typ: $funcType([], [$String], false)}]);
|
|
buffer.init($Uint8);
|
|
pp.init("fmt", [{prop: "buf", name: "buf", embedded: false, exported: false, typ: buffer, tag: ""}, {prop: "arg", name: "arg", embedded: false, exported: false, typ: $emptyInterface, tag: ""}, {prop: "value", name: "value", embedded: false, exported: false, typ: reflect.Value, tag: ""}, {prop: "fmt", name: "fmt", embedded: false, exported: false, typ: fmt, tag: ""}, {prop: "reordered", name: "reordered", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "goodArgNum", name: "goodArgNum", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "panicking", name: "panicking", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "erroring", name: "erroring", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
scanError.init("fmt", [{prop: "err", name: "err", embedded: false, exported: false, typ: $error, tag: ""}]);
|
|
ss.init("fmt", [{prop: "rs", name: "rs", embedded: false, exported: false, typ: io.RuneScanner, tag: ""}, {prop: "buf", name: "buf", embedded: false, exported: false, typ: buffer, tag: ""}, {prop: "count", name: "count", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "atEOF", name: "atEOF", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "ssave", name: "ssave", embedded: true, exported: false, typ: ssave, tag: ""}]);
|
|
ssave.init("fmt", [{prop: "validSave", name: "validSave", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "nlIsEnd", name: "nlIsEnd", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "nlIsSpace", name: "nlIsSpace", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "argLimit", name: "argLimit", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "limit", name: "limit", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "maxWid", name: "maxWid", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmtsort.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = os.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = reflect.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
ppFree = new sync.Pool.ptr(0, 0, sliceType.nil, (function() {
|
|
return new pp.ptr(buffer.nil, $ifaceNil, new reflect.Value.ptr(ptrType.nil, 0, 0), new fmt.ptr(ptrType$1.nil, new fmtFlags.ptr(false, false, false, false, false, false, false, false, false), 0, 0, arrayType.zero()), false, false, false, false);
|
|
}));
|
|
space = new sliceType$1([$toNativeArray($kindUint16, [9, 13]), $toNativeArray($kindUint16, [32, 32]), $toNativeArray($kindUint16, [133, 133]), $toNativeArray($kindUint16, [160, 160]), $toNativeArray($kindUint16, [5760, 5760]), $toNativeArray($kindUint16, [8192, 8202]), $toNativeArray($kindUint16, [8232, 8233]), $toNativeArray($kindUint16, [8239, 8239]), $toNativeArray($kindUint16, [8287, 8287]), $toNativeArray($kindUint16, [12288, 12288])]);
|
|
ssFree = new sync.Pool.ptr(0, 0, sliceType.nil, (function() {
|
|
return new ss.ptr($ifaceNil, buffer.nil, 0, false, new ssave.ptr(false, false, false, 0, 0, 0));
|
|
}));
|
|
complexError = errors.New("syntax error scanning complex number");
|
|
boolError = errors.New("syntax error scanning boolean");
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["bytes"] = (function() {
|
|
var $pkg = {}, $init, errors, bytealg, io, unicode, utf8, Reader, sliceType, ptrType$2, errNegativeRead, IndexByte, Equal, HasPrefix, Repeat, Index, indexRabinKarp, hashStr, NewReader;
|
|
errors = $packages["errors"];
|
|
bytealg = $packages["internal/bytealg"];
|
|
io = $packages["io"];
|
|
unicode = $packages["unicode"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
Reader = $pkg.Reader = $newType(0, $kindStruct, "bytes.Reader", true, "bytes", true, function(s_, i_, prevRune_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.s = sliceType.nil;
|
|
this.i = new $Int64(0, 0);
|
|
this.prevRune = 0;
|
|
return;
|
|
}
|
|
this.s = s_;
|
|
this.i = i_;
|
|
this.prevRune = prevRune_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
ptrType$2 = $ptrType(Reader);
|
|
IndexByte = function(s, c) {
|
|
var _i, _ref, b, c, i, s;
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (b === c) {
|
|
return i;
|
|
}
|
|
_i++;
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.IndexByte = IndexByte;
|
|
Equal = function(a, b) {
|
|
var _i, _ref, a, b, c, i;
|
|
if (!((a.$length === b.$length))) {
|
|
return false;
|
|
}
|
|
_ref = a;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!((c === ((i < 0 || i >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + i])))) {
|
|
return false;
|
|
}
|
|
_i++;
|
|
}
|
|
return true;
|
|
};
|
|
$pkg.Equal = Equal;
|
|
HasPrefix = function(s, prefix) {
|
|
var prefix, s;
|
|
return s.$length >= prefix.$length && Equal($subslice(s, 0, prefix.$length), prefix);
|
|
};
|
|
$pkg.HasPrefix = HasPrefix;
|
|
Repeat = function(b, count) {
|
|
var _q, b, bp, count, nb;
|
|
if (count < 0) {
|
|
$panic(new $String("bytes: negative Repeat count"));
|
|
} else if (count > 0 && !(((_q = ($imul(b.$length, count)) / count, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) === b.$length))) {
|
|
$panic(new $String("bytes: Repeat count causes overflow"));
|
|
}
|
|
nb = $makeSlice(sliceType, ($imul(b.$length, count)));
|
|
bp = $copySlice(nb, b);
|
|
while (true) {
|
|
if (!(bp < nb.$length)) { break; }
|
|
$copySlice($subslice(nb, bp), $subslice(nb, 0, bp));
|
|
bp = $imul(bp, (2));
|
|
}
|
|
return nb;
|
|
};
|
|
$pkg.Repeat = Repeat;
|
|
Index = function(s, sep) {
|
|
var c0, c0$1, c1, c1$1, fails, fails$1, i, i$1, j, n, o, o$1, r, s, sep, t, t$1, x, x$1;
|
|
n = sep.$length;
|
|
if ((n === 0)) {
|
|
return 0;
|
|
} else if ((n === 1)) {
|
|
return IndexByte(s, (0 >= sep.$length ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + 0]));
|
|
} else if ((n === s.$length)) {
|
|
if (Equal(sep, s)) {
|
|
return 0;
|
|
}
|
|
return -1;
|
|
} else if (n > s.$length) {
|
|
return -1;
|
|
} else if (n <= bytealg.MaxLen) {
|
|
if (s.$length <= 0) {
|
|
return bytealg.Index(s, sep);
|
|
}
|
|
c0 = (0 >= sep.$length ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + 0]);
|
|
c1 = (1 >= sep.$length ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + 1]);
|
|
i = 0;
|
|
t = (s.$length - n >> 0) + 1 >> 0;
|
|
fails = 0;
|
|
while (true) {
|
|
if (!(i < t)) { break; }
|
|
if (!((((i < 0 || i >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i]) === c0))) {
|
|
o = IndexByte($subslice(s, i, t), c0);
|
|
if (o < 0) {
|
|
return -1;
|
|
}
|
|
i = i + (o) >> 0;
|
|
}
|
|
if (((x = i + 1 >> 0, ((x < 0 || x >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + x])) === c1) && Equal($subslice(s, i, (i + n >> 0)), sep)) {
|
|
return i;
|
|
}
|
|
fails = fails + (1) >> 0;
|
|
i = i + (1) >> 0;
|
|
if (fails > bytealg.Cutover(i)) {
|
|
r = bytealg.Index($subslice(s, i), sep);
|
|
if (r >= 0) {
|
|
return r + i >> 0;
|
|
}
|
|
return -1;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
c0$1 = (0 >= sep.$length ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + 0]);
|
|
c1$1 = (1 >= sep.$length ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + 1]);
|
|
i$1 = 0;
|
|
fails$1 = 0;
|
|
t$1 = (s.$length - n >> 0) + 1 >> 0;
|
|
while (true) {
|
|
if (!(i$1 < t$1)) { break; }
|
|
if (!((((i$1 < 0 || i$1 >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i$1]) === c0$1))) {
|
|
o$1 = IndexByte($subslice(s, i$1, t$1), c0$1);
|
|
if (o$1 < 0) {
|
|
break;
|
|
}
|
|
i$1 = i$1 + (o$1) >> 0;
|
|
}
|
|
if (((x$1 = i$1 + 1 >> 0, ((x$1 < 0 || x$1 >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + x$1])) === c1$1) && Equal($subslice(s, i$1, (i$1 + n >> 0)), sep)) {
|
|
return i$1;
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
fails$1 = fails$1 + (1) >> 0;
|
|
if (fails$1 >= (4 + (i$1 >> 4 >> 0) >> 0) && i$1 < t$1) {
|
|
j = indexRabinKarp($subslice(s, i$1), sep);
|
|
if (j < 0) {
|
|
return -1;
|
|
}
|
|
return i$1 + j >> 0;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.Index = Index;
|
|
indexRabinKarp = function(s, sep) {
|
|
var _tuple, h, hashsep, i, i$1, n, pow, s, sep, x;
|
|
_tuple = hashStr(sep);
|
|
hashsep = _tuple[0];
|
|
pow = _tuple[1];
|
|
n = sep.$length;
|
|
h = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < n)) { break; }
|
|
h = ($imul(h, 16777619) >>> 0) + ((((i < 0 || i >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i]) >>> 0)) >>> 0;
|
|
i = i + (1) >> 0;
|
|
}
|
|
if ((h === hashsep) && Equal($subslice(s, 0, n), sep)) {
|
|
return 0;
|
|
}
|
|
i$1 = n;
|
|
while (true) {
|
|
if (!(i$1 < s.$length)) { break; }
|
|
h = $imul(h, (16777619)) >>> 0;
|
|
h = h + (((((i$1 < 0 || i$1 >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i$1]) >>> 0))) >>> 0;
|
|
h = h - (($imul(pow, (((x = i$1 - n >> 0, ((x < 0 || x >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + x])) >>> 0))) >>> 0)) >>> 0;
|
|
i$1 = i$1 + (1) >> 0;
|
|
if ((h === hashsep) && Equal($subslice(s, (i$1 - n >> 0), i$1), sep)) {
|
|
return i$1 - n >> 0;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
hashStr = function(sep) {
|
|
var _tmp, _tmp$1, hash, i, i$1, pow, sep, sq;
|
|
hash = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < sep.$length)) { break; }
|
|
hash = ($imul(hash, 16777619) >>> 0) + ((((i < 0 || i >= sep.$length) ? ($throwRuntimeError("index out of range"), undefined) : sep.$array[sep.$offset + i]) >>> 0)) >>> 0;
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp = 1;
|
|
_tmp$1 = 16777619;
|
|
pow = _tmp;
|
|
sq = _tmp$1;
|
|
i$1 = sep.$length;
|
|
while (true) {
|
|
if (!(i$1 > 0)) { break; }
|
|
if (!(((i$1 & 1) === 0))) {
|
|
pow = $imul(pow, (sq)) >>> 0;
|
|
}
|
|
sq = $imul(sq, (sq)) >>> 0;
|
|
i$1 = (i$1 >> $min((1), 31)) >> 0;
|
|
}
|
|
return [hash, pow];
|
|
};
|
|
Reader.ptr.prototype.Len = function() {
|
|
var r, x, x$1, x$2, x$3, x$4;
|
|
r = this;
|
|
if ((x = r.i, x$1 = (new $Int64(0, r.s.$length)), (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low >= x$1.$low)))) {
|
|
return 0;
|
|
}
|
|
return (((x$2 = (x$3 = (new $Int64(0, r.s.$length)), x$4 = r.i, new $Int64(x$3.$high - x$4.$high, x$3.$low - x$4.$low)), x$2.$low + ((x$2.$high >> 31) * 4294967296)) >> 0));
|
|
};
|
|
Reader.prototype.Len = function() { return this.$val.Len(); };
|
|
Reader.ptr.prototype.Size = function() {
|
|
var r;
|
|
r = this;
|
|
return (new $Int64(0, r.s.$length));
|
|
};
|
|
Reader.prototype.Size = function() { return this.$val.Size(); };
|
|
Reader.ptr.prototype.Read = function(b) {
|
|
var _tmp, _tmp$1, b, err, n, r, x, x$1, x$2, x$3;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
r = this;
|
|
if ((x = r.i, x$1 = (new $Int64(0, r.s.$length)), (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low >= x$1.$low)))) {
|
|
_tmp = 0;
|
|
_tmp$1 = io.EOF;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
return [n, err];
|
|
}
|
|
r.prevRune = -1;
|
|
n = $copySlice(b, $subslice(r.s, $flatten64(r.i)));
|
|
r.i = (x$2 = r.i, x$3 = (new $Int64(0, n)), new $Int64(x$2.$high + x$3.$high, x$2.$low + x$3.$low));
|
|
return [n, err];
|
|
};
|
|
Reader.prototype.Read = function(b) { return this.$val.Read(b); };
|
|
Reader.ptr.prototype.ReadAt = function(b, off) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, b, err, n, off, r, x;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
r = this;
|
|
if ((off.$high < 0 || (off.$high === 0 && off.$low < 0))) {
|
|
_tmp = 0;
|
|
_tmp$1 = errors.New("bytes.Reader.ReadAt: negative offset");
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
return [n, err];
|
|
}
|
|
if ((x = (new $Int64(0, r.s.$length)), (off.$high > x.$high || (off.$high === x.$high && off.$low >= x.$low)))) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = io.EOF;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
return [n, err];
|
|
}
|
|
n = $copySlice(b, $subslice(r.s, $flatten64(off)));
|
|
if (n < b.$length) {
|
|
err = io.EOF;
|
|
}
|
|
return [n, err];
|
|
};
|
|
Reader.prototype.ReadAt = function(b, off) { return this.$val.ReadAt(b, off); };
|
|
Reader.ptr.prototype.ReadByte = function() {
|
|
var b, r, x, x$1, x$2, x$3, x$4, x$5;
|
|
r = this;
|
|
r.prevRune = -1;
|
|
if ((x = r.i, x$1 = (new $Int64(0, r.s.$length)), (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low >= x$1.$low)))) {
|
|
return [0, io.EOF];
|
|
}
|
|
b = (x$2 = r.s, x$3 = r.i, (($flatten64(x$3) < 0 || $flatten64(x$3) >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + $flatten64(x$3)]));
|
|
r.i = (x$4 = r.i, x$5 = new $Int64(0, 1), new $Int64(x$4.$high + x$5.$high, x$4.$low + x$5.$low));
|
|
return [b, $ifaceNil];
|
|
};
|
|
Reader.prototype.ReadByte = function() { return this.$val.ReadByte(); };
|
|
Reader.ptr.prototype.UnreadByte = function() {
|
|
var r, x, x$1, x$2;
|
|
r = this;
|
|
if ((x = r.i, (x.$high < 0 || (x.$high === 0 && x.$low <= 0)))) {
|
|
return errors.New("bytes.Reader.UnreadByte: at beginning of slice");
|
|
}
|
|
r.prevRune = -1;
|
|
r.i = (x$1 = r.i, x$2 = new $Int64(0, 1), new $Int64(x$1.$high - x$2.$high, x$1.$low - x$2.$low));
|
|
return $ifaceNil;
|
|
};
|
|
Reader.prototype.UnreadByte = function() { return this.$val.UnreadByte(); };
|
|
Reader.ptr.prototype.ReadRune = function() {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, c, ch, err, r, size, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
|
|
ch = 0;
|
|
size = 0;
|
|
err = $ifaceNil;
|
|
r = this;
|
|
if ((x = r.i, x$1 = (new $Int64(0, r.s.$length)), (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low >= x$1.$low)))) {
|
|
r.prevRune = -1;
|
|
_tmp = 0;
|
|
_tmp$1 = 0;
|
|
_tmp$2 = io.EOF;
|
|
ch = _tmp;
|
|
size = _tmp$1;
|
|
err = _tmp$2;
|
|
return [ch, size, err];
|
|
}
|
|
r.prevRune = (((x$2 = r.i, x$2.$low + ((x$2.$high >> 31) * 4294967296)) >> 0));
|
|
c = (x$3 = r.s, x$4 = r.i, (($flatten64(x$4) < 0 || $flatten64(x$4) >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + $flatten64(x$4)]));
|
|
if (c < 128) {
|
|
r.i = (x$5 = r.i, x$6 = new $Int64(0, 1), new $Int64(x$5.$high + x$6.$high, x$5.$low + x$6.$low));
|
|
_tmp$3 = ((c >> 0));
|
|
_tmp$4 = 1;
|
|
_tmp$5 = $ifaceNil;
|
|
ch = _tmp$3;
|
|
size = _tmp$4;
|
|
err = _tmp$5;
|
|
return [ch, size, err];
|
|
}
|
|
_tuple = utf8.DecodeRune($subslice(r.s, $flatten64(r.i)));
|
|
ch = _tuple[0];
|
|
size = _tuple[1];
|
|
r.i = (x$7 = r.i, x$8 = (new $Int64(0, size)), new $Int64(x$7.$high + x$8.$high, x$7.$low + x$8.$low));
|
|
return [ch, size, err];
|
|
};
|
|
Reader.prototype.ReadRune = function() { return this.$val.ReadRune(); };
|
|
Reader.ptr.prototype.UnreadRune = function() {
|
|
var r, x;
|
|
r = this;
|
|
if ((x = r.i, (x.$high < 0 || (x.$high === 0 && x.$low <= 0)))) {
|
|
return errors.New("bytes.Reader.UnreadRune: at beginning of slice");
|
|
}
|
|
if (r.prevRune < 0) {
|
|
return errors.New("bytes.Reader.UnreadRune: previous operation was not ReadRune");
|
|
}
|
|
r.i = (new $Int64(0, r.prevRune));
|
|
r.prevRune = -1;
|
|
return $ifaceNil;
|
|
};
|
|
Reader.prototype.UnreadRune = function() { return this.$val.UnreadRune(); };
|
|
Reader.ptr.prototype.Seek = function(offset, whence) {
|
|
var _1, abs, offset, r, whence, x, x$1;
|
|
r = this;
|
|
r.prevRune = -1;
|
|
abs = new $Int64(0, 0);
|
|
_1 = whence;
|
|
if (_1 === (0)) {
|
|
abs = offset;
|
|
} else if (_1 === (1)) {
|
|
abs = (x = r.i, new $Int64(x.$high + offset.$high, x.$low + offset.$low));
|
|
} else if (_1 === (2)) {
|
|
abs = (x$1 = (new $Int64(0, r.s.$length)), new $Int64(x$1.$high + offset.$high, x$1.$low + offset.$low));
|
|
} else {
|
|
return [new $Int64(0, 0), errors.New("bytes.Reader.Seek: invalid whence")];
|
|
}
|
|
if ((abs.$high < 0 || (abs.$high === 0 && abs.$low < 0))) {
|
|
return [new $Int64(0, 0), errors.New("bytes.Reader.Seek: negative position")];
|
|
}
|
|
r.i = abs;
|
|
return [abs, $ifaceNil];
|
|
};
|
|
Reader.prototype.Seek = function(offset, whence) { return this.$val.Seek(offset, whence); };
|
|
Reader.ptr.prototype.WriteTo = function(w) {
|
|
var _r, _tmp, _tmp$1, _tuple, b, err, m, n, r, w, x, x$1, x$2, x$3, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; m = $f.m; n = $f.n; r = $f.r; w = $f.w; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
r = this;
|
|
r.prevRune = -1;
|
|
if ((x = r.i, x$1 = (new $Int64(0, r.s.$length)), (x.$high > x$1.$high || (x.$high === x$1.$high && x.$low >= x$1.$low)))) {
|
|
_tmp = new $Int64(0, 0);
|
|
_tmp$1 = $ifaceNil;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
b = $subslice(r.s, $flatten64(r.i));
|
|
_r = w.Write(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
m = _tuple[0];
|
|
err = _tuple[1];
|
|
if (m > b.$length) {
|
|
$panic(new $String("bytes.Reader.WriteTo: invalid Write count"));
|
|
}
|
|
r.i = (x$2 = r.i, x$3 = (new $Int64(0, m)), new $Int64(x$2.$high + x$3.$high, x$2.$low + x$3.$low));
|
|
n = (new $Int64(0, m));
|
|
if (!((m === b.$length)) && $interfaceIsEqual(err, $ifaceNil)) {
|
|
err = io.ErrShortWrite;
|
|
}
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Reader.ptr.prototype.WriteTo }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.m = m; $f.n = n; $f.r = r; $f.w = w; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Reader.prototype.WriteTo = function(w) { return this.$val.WriteTo(w); };
|
|
Reader.ptr.prototype.Reset = function(b) {
|
|
var b, r;
|
|
r = this;
|
|
Reader.copy(r, new Reader.ptr(b, new $Int64(0, 0), -1));
|
|
};
|
|
Reader.prototype.Reset = function(b) { return this.$val.Reset(b); };
|
|
NewReader = function(b) {
|
|
var b;
|
|
return new Reader.ptr(b, new $Int64(0, 0), -1);
|
|
};
|
|
$pkg.NewReader = NewReader;
|
|
ptrType$2.methods = [{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}, {prop: "ReadAt", name: "ReadAt", pkg: "", typ: $funcType([sliceType, $Int64], [$Int, $error], false)}, {prop: "ReadByte", name: "ReadByte", pkg: "", typ: $funcType([], [$Uint8, $error], false)}, {prop: "UnreadByte", name: "UnreadByte", pkg: "", typ: $funcType([], [$error], false)}, {prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}, {prop: "UnreadRune", name: "UnreadRune", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Seek", name: "Seek", pkg: "", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "WriteTo", name: "WriteTo", pkg: "", typ: $funcType([io.Writer], [$Int64, $error], false)}, {prop: "Reset", name: "Reset", pkg: "", typ: $funcType([sliceType], [], false)}];
|
|
Reader.init("bytes", [{prop: "s", name: "s", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "i", name: "i", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "prevRune", name: "prevRune", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bytealg.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unicode.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.ErrTooLarge = errors.New("bytes.Buffer: too large");
|
|
errNegativeRead = errors.New("bytes.Buffer: reader returned negative count from Read");
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["encoding/binary"] = (function() {
|
|
var $pkg = {}, $init, errors, io, math, reflect, ByteOrder, littleEndian, bigEndian, decoder, encoder, sliceType, ptrType, ptrType$1, ptrType$2, ptrType$3, ptrType$4, ptrType$5, ptrType$6, ptrType$7, ptrType$8, sliceType$1, sliceType$2, sliceType$3, sliceType$4, sliceType$5, sliceType$6, sliceType$7, sliceType$8, ptrType$9, ptrType$10, overflow, Read, Write, Size, dataSize, sizeof, intDataSize;
|
|
errors = $packages["errors"];
|
|
io = $packages["io"];
|
|
math = $packages["math"];
|
|
reflect = $packages["reflect"];
|
|
ByteOrder = $pkg.ByteOrder = $newType(8, $kindInterface, "binary.ByteOrder", true, "encoding/binary", true, null);
|
|
littleEndian = $pkg.littleEndian = $newType(0, $kindStruct, "binary.littleEndian", true, "encoding/binary", false, function() {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
return;
|
|
}
|
|
});
|
|
bigEndian = $pkg.bigEndian = $newType(0, $kindStruct, "binary.bigEndian", true, "encoding/binary", false, function() {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
return;
|
|
}
|
|
});
|
|
decoder = $pkg.decoder = $newType(0, $kindStruct, "binary.decoder", true, "encoding/binary", false, function(order_, buf_, offset_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.order = $ifaceNil;
|
|
this.buf = sliceType.nil;
|
|
this.offset = 0;
|
|
return;
|
|
}
|
|
this.order = order_;
|
|
this.buf = buf_;
|
|
this.offset = offset_;
|
|
});
|
|
encoder = $pkg.encoder = $newType(0, $kindStruct, "binary.encoder", true, "encoding/binary", false, function(order_, buf_, offset_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.order = $ifaceNil;
|
|
this.buf = sliceType.nil;
|
|
this.offset = 0;
|
|
return;
|
|
}
|
|
this.order = order_;
|
|
this.buf = buf_;
|
|
this.offset = offset_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
ptrType = $ptrType($Bool);
|
|
ptrType$1 = $ptrType($Int8);
|
|
ptrType$2 = $ptrType($Uint8);
|
|
ptrType$3 = $ptrType($Int16);
|
|
ptrType$4 = $ptrType($Uint16);
|
|
ptrType$5 = $ptrType($Int32);
|
|
ptrType$6 = $ptrType($Uint32);
|
|
ptrType$7 = $ptrType($Int64);
|
|
ptrType$8 = $ptrType($Uint64);
|
|
sliceType$1 = $sliceType($Bool);
|
|
sliceType$2 = $sliceType($Int8);
|
|
sliceType$3 = $sliceType($Int16);
|
|
sliceType$4 = $sliceType($Uint16);
|
|
sliceType$5 = $sliceType($Int32);
|
|
sliceType$6 = $sliceType($Uint32);
|
|
sliceType$7 = $sliceType($Int64);
|
|
sliceType$8 = $sliceType($Uint64);
|
|
ptrType$9 = $ptrType(decoder);
|
|
ptrType$10 = $ptrType(encoder);
|
|
littleEndian.ptr.prototype.Uint16 = function(b) {
|
|
var b;
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
return ((((0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]) << 16 >>> 16)) | ((((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]) << 16 >>> 16)) << 8 << 16 >>> 16)) >>> 0;
|
|
};
|
|
littleEndian.prototype.Uint16 = function(b) { return this.$val.Uint16(b); };
|
|
littleEndian.ptr.prototype.PutUint16 = function(b, v) {
|
|
var b, v;
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = ((v << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = (((v >>> 8 << 16 >>> 16) << 24 >>> 24)));
|
|
};
|
|
littleEndian.prototype.PutUint16 = function(b, v) { return this.$val.PutUint16(b, v); };
|
|
littleEndian.ptr.prototype.Uint32 = function(b) {
|
|
var b;
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
return ((((((((0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]) >>> 0)) | ((((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]) >>> 0)) << 8 >>> 0)) >>> 0) | ((((2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]) >>> 0)) << 16 >>> 0)) >>> 0) | ((((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]) >>> 0)) << 24 >>> 0)) >>> 0;
|
|
};
|
|
littleEndian.prototype.Uint32 = function(b) { return this.$val.Uint32(b); };
|
|
littleEndian.ptr.prototype.PutUint32 = function(b, v) {
|
|
var b, v;
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = ((v << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = (((v >>> 8 >>> 0) << 24 >>> 24)));
|
|
(2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2] = (((v >>> 16 >>> 0) << 24 >>> 24)));
|
|
(3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3] = (((v >>> 24 >>> 0) << 24 >>> 24)));
|
|
};
|
|
littleEndian.prototype.PutUint32 = function(b, v) { return this.$val.PutUint32(b, v); };
|
|
littleEndian.ptr.prototype.Uint64 = function(b) {
|
|
var b, x, x$1, x$10, x$11, x$12, x$13, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
return (x = (x$1 = (x$2 = (x$3 = (x$4 = (x$5 = (x$6 = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$7 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x$6.$high | x$7.$high, (x$6.$low | x$7.$low) >>> 0)), x$8 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 16), new $Uint64(x$5.$high | x$8.$high, (x$5.$low | x$8.$low) >>> 0)), x$9 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 24), new $Uint64(x$4.$high | x$9.$high, (x$4.$low | x$9.$low) >>> 0)), x$10 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 32), new $Uint64(x$3.$high | x$10.$high, (x$3.$low | x$10.$low) >>> 0)), x$11 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 40), new $Uint64(x$2.$high | x$11.$high, (x$2.$low | x$11.$low) >>> 0)), x$12 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 48), new $Uint64(x$1.$high | x$12.$high, (x$1.$low | x$12.$low) >>> 0)), x$13 = $shiftLeft64((new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), 56), new $Uint64(x.$high | x$13.$high, (x.$low | x$13.$low) >>> 0));
|
|
};
|
|
littleEndian.prototype.Uint64 = function(b) { return this.$val.Uint64(b); };
|
|
littleEndian.ptr.prototype.PutUint64 = function(b, v) {
|
|
var b, v;
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = ((v.$low << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = (($shiftRightUint64(v, 8).$low << 24 >>> 24)));
|
|
(2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2] = (($shiftRightUint64(v, 16).$low << 24 >>> 24)));
|
|
(3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3] = (($shiftRightUint64(v, 24).$low << 24 >>> 24)));
|
|
(4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4] = (($shiftRightUint64(v, 32).$low << 24 >>> 24)));
|
|
(5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5] = (($shiftRightUint64(v, 40).$low << 24 >>> 24)));
|
|
(6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6] = (($shiftRightUint64(v, 48).$low << 24 >>> 24)));
|
|
(7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7] = (($shiftRightUint64(v, 56).$low << 24 >>> 24)));
|
|
};
|
|
littleEndian.prototype.PutUint64 = function(b, v) { return this.$val.PutUint64(b, v); };
|
|
littleEndian.ptr.prototype.String = function() {
|
|
return "LittleEndian";
|
|
};
|
|
littleEndian.prototype.String = function() { return this.$val.String(); };
|
|
littleEndian.ptr.prototype.GoString = function() {
|
|
return "binary.LittleEndian";
|
|
};
|
|
littleEndian.prototype.GoString = function() { return this.$val.GoString(); };
|
|
bigEndian.ptr.prototype.Uint16 = function(b) {
|
|
var b;
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
return ((((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]) << 16 >>> 16)) | ((((0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]) << 16 >>> 16)) << 8 << 16 >>> 16)) >>> 0;
|
|
};
|
|
bigEndian.prototype.Uint16 = function(b) { return this.$val.Uint16(b); };
|
|
bigEndian.ptr.prototype.PutUint16 = function(b, v) {
|
|
var b, v;
|
|
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = (((v >>> 8 << 16 >>> 16) << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = ((v << 24 >>> 24)));
|
|
};
|
|
bigEndian.prototype.PutUint16 = function(b, v) { return this.$val.PutUint16(b, v); };
|
|
bigEndian.ptr.prototype.Uint32 = function(b) {
|
|
var b;
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
return ((((((((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]) >>> 0)) | ((((2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]) >>> 0)) << 8 >>> 0)) >>> 0) | ((((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]) >>> 0)) << 16 >>> 0)) >>> 0) | ((((0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]) >>> 0)) << 24 >>> 0)) >>> 0;
|
|
};
|
|
bigEndian.prototype.Uint32 = function(b) { return this.$val.Uint32(b); };
|
|
bigEndian.ptr.prototype.PutUint32 = function(b, v) {
|
|
var b, v;
|
|
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = (((v >>> 24 >>> 0) << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = (((v >>> 16 >>> 0) << 24 >>> 24)));
|
|
(2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2] = (((v >>> 8 >>> 0) << 24 >>> 24)));
|
|
(3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3] = ((v << 24 >>> 24)));
|
|
};
|
|
bigEndian.prototype.PutUint32 = function(b, v) { return this.$val.PutUint32(b, v); };
|
|
bigEndian.ptr.prototype.Uint64 = function(b) {
|
|
var b, x, x$1, x$10, x$11, x$12, x$13, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
return (x = (x$1 = (x$2 = (x$3 = (x$4 = (x$5 = (x$6 = (new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), x$7 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 8), new $Uint64(x$6.$high | x$7.$high, (x$6.$low | x$7.$low) >>> 0)), x$8 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 16), new $Uint64(x$5.$high | x$8.$high, (x$5.$low | x$8.$low) >>> 0)), x$9 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 24), new $Uint64(x$4.$high | x$9.$high, (x$4.$low | x$9.$low) >>> 0)), x$10 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 32), new $Uint64(x$3.$high | x$10.$high, (x$3.$low | x$10.$low) >>> 0)), x$11 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 40), new $Uint64(x$2.$high | x$11.$high, (x$2.$low | x$11.$low) >>> 0)), x$12 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 48), new $Uint64(x$1.$high | x$12.$high, (x$1.$low | x$12.$low) >>> 0)), x$13 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 56), new $Uint64(x.$high | x$13.$high, (x.$low | x$13.$low) >>> 0));
|
|
};
|
|
bigEndian.prototype.Uint64 = function(b) { return this.$val.Uint64(b); };
|
|
bigEndian.ptr.prototype.PutUint64 = function(b, v) {
|
|
var b, v;
|
|
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
|
|
(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0] = (($shiftRightUint64(v, 56).$low << 24 >>> 24)));
|
|
(1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1] = (($shiftRightUint64(v, 48).$low << 24 >>> 24)));
|
|
(2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2] = (($shiftRightUint64(v, 40).$low << 24 >>> 24)));
|
|
(3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3] = (($shiftRightUint64(v, 32).$low << 24 >>> 24)));
|
|
(4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4] = (($shiftRightUint64(v, 24).$low << 24 >>> 24)));
|
|
(5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5] = (($shiftRightUint64(v, 16).$low << 24 >>> 24)));
|
|
(6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6] = (($shiftRightUint64(v, 8).$low << 24 >>> 24)));
|
|
(7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7] = ((v.$low << 24 >>> 24)));
|
|
};
|
|
bigEndian.prototype.PutUint64 = function(b, v) { return this.$val.PutUint64(b, v); };
|
|
bigEndian.ptr.prototype.String = function() {
|
|
return "BigEndian";
|
|
};
|
|
bigEndian.prototype.String = function() { return this.$val.String(); };
|
|
bigEndian.ptr.prototype.GoString = function() {
|
|
return "binary.BigEndian";
|
|
};
|
|
bigEndian.prototype.GoString = function() { return this.$val.GoString(); };
|
|
Read = function(r, order, data) {
|
|
var _1, _i, _i$1, _i$2, _i$3, _i$4, _i$5, _i$6, _i$7, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$16, _r$17, _r$18, _r$19, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _ref$1, _ref$2, _ref$3, _ref$4, _ref$5, _ref$6, _ref$7, _ref$8, _tuple, _tuple$1, bs, d, data, data$1, data$10, data$11, data$12, data$13, data$14, data$15, data$16, data$17, data$18, data$2, data$3, data$4, data$5, data$6, data$7, data$8, data$9, err, err$1, i, i$1, i$2, i$3, i$4, i$5, i$6, i$7, n, order, r, size, v, x, x$1, x$2, x$3, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _i$3 = $f._i$3; _i$4 = $f._i$4; _i$5 = $f._i$5; _i$6 = $f._i$6; _i$7 = $f._i$7; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$16 = $f._r$16; _r$17 = $f._r$17; _r$18 = $f._r$18; _r$19 = $f._r$19; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; _ref$3 = $f._ref$3; _ref$4 = $f._ref$4; _ref$5 = $f._ref$5; _ref$6 = $f._ref$6; _ref$7 = $f._ref$7; _ref$8 = $f._ref$8; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; bs = $f.bs; d = $f.d; data = $f.data; data$1 = $f.data$1; data$10 = $f.data$10; data$11 = $f.data$11; data$12 = $f.data$12; data$13 = $f.data$13; data$14 = $f.data$14; data$15 = $f.data$15; data$16 = $f.data$16; data$17 = $f.data$17; data$18 = $f.data$18; data$2 = $f.data$2; data$3 = $f.data$3; data$4 = $f.data$4; data$5 = $f.data$5; data$6 = $f.data$6; data$7 = $f.data$7; data$8 = $f.data$8; data$9 = $f.data$9; err = $f.err; err$1 = $f.err$1; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; i$4 = $f.i$4; i$5 = $f.i$5; i$6 = $f.i$6; i$7 = $f.i$7; n = $f.n; order = $f.order; r = $f.r; size = $f.size; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = intDataSize(data);
|
|
/* */ if (!((n === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((n === 0))) { */ case 1:
|
|
bs = $makeSlice(sliceType, n);
|
|
_r = io.ReadFull(r, bs); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_ref = data;
|
|
/* */ if ($assertType(_ref, ptrType, true)[1]) { $s = 4; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$1, true)[1]) { $s = 5; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$2, true)[1]) { $s = 6; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$3, true)[1]) { $s = 7; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$4, true)[1]) { $s = 8; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$5, true)[1]) { $s = 9; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$6, true)[1]) { $s = 10; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$7, true)[1]) { $s = 11; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$8, true)[1]) { $s = 12; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$1, true)[1]) { $s = 13; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$2, true)[1]) { $s = 14; continue; }
|
|
/* */ if ($assertType(_ref, sliceType, true)[1]) { $s = 15; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$3, true)[1]) { $s = 16; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$4, true)[1]) { $s = 17; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$5, true)[1]) { $s = 18; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$6, true)[1]) { $s = 19; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$7, true)[1]) { $s = 20; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$8, true)[1]) { $s = 21; continue; }
|
|
/* */ $s = 22; continue;
|
|
/* if ($assertType(_ref, ptrType, true)[1]) { */ case 4:
|
|
data$1 = _ref.$val;
|
|
data$1.$set(!(((0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0]) === 0)));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$1, true)[1]) { */ case 5:
|
|
data$2 = _ref.$val;
|
|
data$2.$set((((0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0]) << 24 >> 24)));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$2, true)[1]) { */ case 6:
|
|
data$3 = _ref.$val;
|
|
data$3.$set((0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0]));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$3, true)[1]) { */ case 7:
|
|
data$4 = _ref.$val;
|
|
_r$1 = order.Uint16(bs); /* */ $s = 23; case 23: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
data$4.$set(((_r$1 << 16 >> 16)));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$4, true)[1]) { */ case 8:
|
|
data$5 = _ref.$val;
|
|
_r$2 = order.Uint16(bs); /* */ $s = 24; case 24: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
data$5.$set(_r$2);
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$5, true)[1]) { */ case 9:
|
|
data$6 = _ref.$val;
|
|
_r$3 = order.Uint32(bs); /* */ $s = 25; case 25: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
data$6.$set(((_r$3 >> 0)));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$6, true)[1]) { */ case 10:
|
|
data$7 = _ref.$val;
|
|
_r$4 = order.Uint32(bs); /* */ $s = 26; case 26: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
data$7.$set(_r$4);
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$7, true)[1]) { */ case 11:
|
|
data$8 = _ref.$val;
|
|
_r$5 = order.Uint64(bs); /* */ $s = 27; case 27: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
data$8.$set(((x = _r$5, new $Int64(x.$high, x.$low))));
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, ptrType$8, true)[1]) { */ case 12:
|
|
data$9 = _ref.$val;
|
|
_r$6 = order.Uint64(bs); /* */ $s = 28; case 28: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
data$9.$set(_r$6);
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$1, true)[1]) { */ case 13:
|
|
data$10 = _ref.$val;
|
|
_ref$1 = bs;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref$1.$length)) { break; }
|
|
i = _i;
|
|
x$1 = ((_i < 0 || _i >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i]);
|
|
((i < 0 || i >= data$10.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$10.$array[data$10.$offset + i] = !((x$1 === 0)));
|
|
_i++;
|
|
}
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$2, true)[1]) { */ case 14:
|
|
data$11 = _ref.$val;
|
|
_ref$2 = bs;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$2.$length)) { break; }
|
|
i$1 = _i$1;
|
|
x$2 = ((_i$1 < 0 || _i$1 >= _ref$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$2.$array[_ref$2.$offset + _i$1]);
|
|
((i$1 < 0 || i$1 >= data$11.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$11.$array[data$11.$offset + i$1] = ((x$2 << 24 >> 24)));
|
|
_i$1++;
|
|
}
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType, true)[1]) { */ case 15:
|
|
data$12 = _ref.$val;
|
|
$copySlice(data$12, bs);
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$3, true)[1]) { */ case 16:
|
|
data$13 = _ref.$val;
|
|
_ref$3 = data$13;
|
|
_i$2 = 0;
|
|
/* while (true) { */ case 29:
|
|
/* if (!(_i$2 < _ref$3.$length)) { break; } */ if(!(_i$2 < _ref$3.$length)) { $s = 30; continue; }
|
|
i$2 = _i$2;
|
|
_r$7 = order.Uint16($subslice(bs, ($imul(2, i$2)))); /* */ $s = 31; case 31: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
((i$2 < 0 || i$2 >= data$13.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$13.$array[data$13.$offset + i$2] = ((_r$7 << 16 >> 16)));
|
|
_i$2++;
|
|
/* } */ $s = 29; continue; case 30:
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$4, true)[1]) { */ case 17:
|
|
data$14 = _ref.$val;
|
|
_ref$4 = data$14;
|
|
_i$3 = 0;
|
|
/* while (true) { */ case 32:
|
|
/* if (!(_i$3 < _ref$4.$length)) { break; } */ if(!(_i$3 < _ref$4.$length)) { $s = 33; continue; }
|
|
i$3 = _i$3;
|
|
_r$8 = order.Uint16($subslice(bs, ($imul(2, i$3)))); /* */ $s = 34; case 34: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
((i$3 < 0 || i$3 >= data$14.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$14.$array[data$14.$offset + i$3] = _r$8);
|
|
_i$3++;
|
|
/* } */ $s = 32; continue; case 33:
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$5, true)[1]) { */ case 18:
|
|
data$15 = _ref.$val;
|
|
_ref$5 = data$15;
|
|
_i$4 = 0;
|
|
/* while (true) { */ case 35:
|
|
/* if (!(_i$4 < _ref$5.$length)) { break; } */ if(!(_i$4 < _ref$5.$length)) { $s = 36; continue; }
|
|
i$4 = _i$4;
|
|
_r$9 = order.Uint32($subslice(bs, ($imul(4, i$4)))); /* */ $s = 37; case 37: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
((i$4 < 0 || i$4 >= data$15.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$15.$array[data$15.$offset + i$4] = ((_r$9 >> 0)));
|
|
_i$4++;
|
|
/* } */ $s = 35; continue; case 36:
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$6, true)[1]) { */ case 19:
|
|
data$16 = _ref.$val;
|
|
_ref$6 = data$16;
|
|
_i$5 = 0;
|
|
/* while (true) { */ case 38:
|
|
/* if (!(_i$5 < _ref$6.$length)) { break; } */ if(!(_i$5 < _ref$6.$length)) { $s = 39; continue; }
|
|
i$5 = _i$5;
|
|
_r$10 = order.Uint32($subslice(bs, ($imul(4, i$5)))); /* */ $s = 40; case 40: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
((i$5 < 0 || i$5 >= data$16.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$16.$array[data$16.$offset + i$5] = _r$10);
|
|
_i$5++;
|
|
/* } */ $s = 38; continue; case 39:
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$7, true)[1]) { */ case 20:
|
|
data$17 = _ref.$val;
|
|
_ref$7 = data$17;
|
|
_i$6 = 0;
|
|
/* while (true) { */ case 41:
|
|
/* if (!(_i$6 < _ref$7.$length)) { break; } */ if(!(_i$6 < _ref$7.$length)) { $s = 42; continue; }
|
|
i$6 = _i$6;
|
|
_r$11 = order.Uint64($subslice(bs, ($imul(8, i$6)))); /* */ $s = 43; case 43: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
((i$6 < 0 || i$6 >= data$17.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$17.$array[data$17.$offset + i$6] = ((x$3 = _r$11, new $Int64(x$3.$high, x$3.$low))));
|
|
_i$6++;
|
|
/* } */ $s = 41; continue; case 42:
|
|
$s = 22; continue;
|
|
/* } else if ($assertType(_ref, sliceType$8, true)[1]) { */ case 21:
|
|
data$18 = _ref.$val;
|
|
_ref$8 = data$18;
|
|
_i$7 = 0;
|
|
/* while (true) { */ case 44:
|
|
/* if (!(_i$7 < _ref$8.$length)) { break; } */ if(!(_i$7 < _ref$8.$length)) { $s = 45; continue; }
|
|
i$7 = _i$7;
|
|
_r$12 = order.Uint64($subslice(bs, ($imul(8, i$7)))); /* */ $s = 46; case 46: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
((i$7 < 0 || i$7 >= data$18.$length) ? ($throwRuntimeError("index out of range"), undefined) : data$18.$array[data$18.$offset + i$7] = _r$12);
|
|
_i$7++;
|
|
/* } */ $s = 44; continue; case 45:
|
|
/* } */ case 22:
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 2:
|
|
_r$13 = reflect.ValueOf(data); /* */ $s = 47; case 47: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
v = _r$13;
|
|
size = -1;
|
|
_1 = $clone(v, reflect.Value).Kind();
|
|
/* */ if (_1 === (22)) { $s = 49; continue; }
|
|
/* */ if (_1 === (23)) { $s = 50; continue; }
|
|
/* */ $s = 51; continue;
|
|
/* if (_1 === (22)) { */ case 49:
|
|
_r$14 = $clone(v, reflect.Value).Elem(); /* */ $s = 52; case 52: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
v = _r$14;
|
|
_r$15 = dataSize($clone(v, reflect.Value)); /* */ $s = 53; case 53: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
size = _r$15;
|
|
$s = 51; continue;
|
|
/* } else if (_1 === (23)) { */ case 50:
|
|
_r$16 = dataSize($clone(v, reflect.Value)); /* */ $s = 54; case 54: if($c) { $c = false; _r$16 = _r$16.$blk(); } if (_r$16 && _r$16.$blk !== undefined) { break s; }
|
|
size = _r$16;
|
|
/* } */ case 51:
|
|
case 48:
|
|
/* */ if (size < 0) { $s = 55; continue; }
|
|
/* */ $s = 56; continue;
|
|
/* if (size < 0) { */ case 55:
|
|
_r$17 = reflect.TypeOf(data).String(); /* */ $s = 57; case 57: if($c) { $c = false; _r$17 = _r$17.$blk(); } if (_r$17 && _r$17.$blk !== undefined) { break s; }
|
|
_r$18 = errors.New("binary.Read: invalid type " + _r$17); /* */ $s = 58; case 58: if($c) { $c = false; _r$18 = _r$18.$blk(); } if (_r$18 && _r$18.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$18;
|
|
/* } */ case 56:
|
|
d = new decoder.ptr(order, $makeSlice(sliceType, size), 0);
|
|
_r$19 = io.ReadFull(r, d.buf); /* */ $s = 59; case 59: if($c) { $c = false; _r$19 = _r$19.$blk(); } if (_r$19 && _r$19.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$19;
|
|
err$1 = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return err$1;
|
|
}
|
|
$r = d.value($clone(v, reflect.Value)); /* */ $s = 60; case 60: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Read }; } $f._1 = _1; $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._i$3 = _i$3; $f._i$4 = _i$4; $f._i$5 = _i$5; $f._i$6 = _i$6; $f._i$7 = _i$7; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$16 = _r$16; $f._r$17 = _r$17; $f._r$18 = _r$18; $f._r$19 = _r$19; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f._ref$3 = _ref$3; $f._ref$4 = _ref$4; $f._ref$5 = _ref$5; $f._ref$6 = _ref$6; $f._ref$7 = _ref$7; $f._ref$8 = _ref$8; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.bs = bs; $f.d = d; $f.data = data; $f.data$1 = data$1; $f.data$10 = data$10; $f.data$11 = data$11; $f.data$12 = data$12; $f.data$13 = data$13; $f.data$14 = data$14; $f.data$15 = data$15; $f.data$16 = data$16; $f.data$17 = data$17; $f.data$18 = data$18; $f.data$2 = data$2; $f.data$3 = data$3; $f.data$4 = data$4; $f.data$5 = data$5; $f.data$6 = data$6; $f.data$7 = data$7; $f.data$8 = data$8; $f.data$9 = data$9; $f.err = err; $f.err$1 = err$1; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.i$4 = i$4; $f.i$5 = i$5; $f.i$6 = i$6; $f.i$7 = i$7; $f.n = n; $f.order = order; $f.r = r; $f.size = size; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Read = Read;
|
|
Write = function(w, order, data) {
|
|
var _i, _i$1, _i$2, _i$3, _i$4, _i$5, _i$6, _i$7, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _ref, _ref$1, _ref$2, _ref$3, _ref$4, _ref$5, _ref$6, _ref$7, _ref$8, _tuple, _tuple$1, bs, buf, data, e, err, err$1, i, i$1, i$2, i$3, i$4, i$5, i$6, i$7, n, order, size, v, v$1, v$10, v$11, v$12, v$13, v$14, v$15, v$16, v$17, v$18, v$19, v$2, v$20, v$21, v$22, v$23, v$24, v$25, v$26, v$27, v$3, v$4, v$5, v$6, v$7, v$8, v$9, w, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _i$3 = $f._i$3; _i$4 = $f._i$4; _i$5 = $f._i$5; _i$6 = $f._i$6; _i$7 = $f._i$7; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; _ref$3 = $f._ref$3; _ref$4 = $f._ref$4; _ref$5 = $f._ref$5; _ref$6 = $f._ref$6; _ref$7 = $f._ref$7; _ref$8 = $f._ref$8; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; bs = $f.bs; buf = $f.buf; data = $f.data; e = $f.e; err = $f.err; err$1 = $f.err$1; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; i$4 = $f.i$4; i$5 = $f.i$5; i$6 = $f.i$6; i$7 = $f.i$7; n = $f.n; order = $f.order; size = $f.size; v = $f.v; v$1 = $f.v$1; v$10 = $f.v$10; v$11 = $f.v$11; v$12 = $f.v$12; v$13 = $f.v$13; v$14 = $f.v$14; v$15 = $f.v$15; v$16 = $f.v$16; v$17 = $f.v$17; v$18 = $f.v$18; v$19 = $f.v$19; v$2 = $f.v$2; v$20 = $f.v$20; v$21 = $f.v$21; v$22 = $f.v$22; v$23 = $f.v$23; v$24 = $f.v$24; v$25 = $f.v$25; v$26 = $f.v$26; v$27 = $f.v$27; v$3 = $f.v$3; v$4 = $f.v$4; v$5 = $f.v$5; v$6 = $f.v$6; v$7 = $f.v$7; v$8 = $f.v$8; v$9 = $f.v$9; w = $f.w; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = intDataSize(data);
|
|
/* */ if (!((n === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!((n === 0))) { */ case 1:
|
|
bs = $makeSlice(sliceType, n);
|
|
_ref = data;
|
|
/* */ if ($assertType(_ref, ptrType, true)[1]) { $s = 3; continue; }
|
|
/* */ if ($assertType(_ref, $Bool, true)[1]) { $s = 4; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$1, true)[1]) { $s = 5; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$1, true)[1]) { $s = 6; continue; }
|
|
/* */ if ($assertType(_ref, $Int8, true)[1]) { $s = 7; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$2, true)[1]) { $s = 8; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$2, true)[1]) { $s = 9; continue; }
|
|
/* */ if ($assertType(_ref, $Uint8, true)[1]) { $s = 10; continue; }
|
|
/* */ if ($assertType(_ref, sliceType, true)[1]) { $s = 11; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$3, true)[1]) { $s = 12; continue; }
|
|
/* */ if ($assertType(_ref, $Int16, true)[1]) { $s = 13; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$3, true)[1]) { $s = 14; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$4, true)[1]) { $s = 15; continue; }
|
|
/* */ if ($assertType(_ref, $Uint16, true)[1]) { $s = 16; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$4, true)[1]) { $s = 17; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$5, true)[1]) { $s = 18; continue; }
|
|
/* */ if ($assertType(_ref, $Int32, true)[1]) { $s = 19; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$5, true)[1]) { $s = 20; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$6, true)[1]) { $s = 21; continue; }
|
|
/* */ if ($assertType(_ref, $Uint32, true)[1]) { $s = 22; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$6, true)[1]) { $s = 23; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$7, true)[1]) { $s = 24; continue; }
|
|
/* */ if ($assertType(_ref, $Int64, true)[1]) { $s = 25; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$7, true)[1]) { $s = 26; continue; }
|
|
/* */ if ($assertType(_ref, ptrType$8, true)[1]) { $s = 27; continue; }
|
|
/* */ if ($assertType(_ref, $Uint64, true)[1]) { $s = 28; continue; }
|
|
/* */ if ($assertType(_ref, sliceType$8, true)[1]) { $s = 29; continue; }
|
|
/* */ $s = 30; continue;
|
|
/* if ($assertType(_ref, ptrType, true)[1]) { */ case 3:
|
|
v = _ref.$val;
|
|
if (v.$get()) {
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = 1);
|
|
} else {
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = 0);
|
|
}
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Bool, true)[1]) { */ case 4:
|
|
v$1 = _ref.$val;
|
|
if (v$1) {
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = 1);
|
|
} else {
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = 0);
|
|
}
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$1, true)[1]) { */ case 5:
|
|
v$2 = _ref.$val;
|
|
_ref$1 = v$2;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref$1.$length)) { break; }
|
|
i = _i;
|
|
x = ((_i < 0 || _i >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i]);
|
|
if (x) {
|
|
((i < 0 || i >= bs.$length) ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + i] = 1);
|
|
} else {
|
|
((i < 0 || i >= bs.$length) ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + i] = 0);
|
|
}
|
|
_i++;
|
|
}
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$1, true)[1]) { */ case 6:
|
|
v$3 = _ref.$val;
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = ((v$3.$get() << 24 >>> 24)));
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Int8, true)[1]) { */ case 7:
|
|
v$4 = _ref.$val;
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = ((v$4 << 24 >>> 24)));
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$2, true)[1]) { */ case 8:
|
|
v$5 = _ref.$val;
|
|
_ref$2 = v$5;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$2.$length)) { break; }
|
|
i$1 = _i$1;
|
|
x$1 = ((_i$1 < 0 || _i$1 >= _ref$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$2.$array[_ref$2.$offset + _i$1]);
|
|
((i$1 < 0 || i$1 >= bs.$length) ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + i$1] = ((x$1 << 24 >>> 24)));
|
|
_i$1++;
|
|
}
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$2, true)[1]) { */ case 9:
|
|
v$6 = _ref.$val;
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = v$6.$get());
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Uint8, true)[1]) { */ case 10:
|
|
v$7 = _ref.$val;
|
|
(0 >= bs.$length ? ($throwRuntimeError("index out of range"), undefined) : bs.$array[bs.$offset + 0] = v$7);
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType, true)[1]) { */ case 11:
|
|
v$8 = _ref.$val;
|
|
bs = v$8;
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$3, true)[1]) { */ case 12:
|
|
v$9 = _ref.$val;
|
|
$r = order.PutUint16(bs, ((v$9.$get() << 16 >>> 16))); /* */ $s = 31; case 31: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Int16, true)[1]) { */ case 13:
|
|
v$10 = _ref.$val;
|
|
$r = order.PutUint16(bs, ((v$10 << 16 >>> 16))); /* */ $s = 32; case 32: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$3, true)[1]) { */ case 14:
|
|
v$11 = _ref.$val;
|
|
_ref$3 = v$11;
|
|
_i$2 = 0;
|
|
/* while (true) { */ case 33:
|
|
/* if (!(_i$2 < _ref$3.$length)) { break; } */ if(!(_i$2 < _ref$3.$length)) { $s = 34; continue; }
|
|
i$2 = _i$2;
|
|
x$2 = ((_i$2 < 0 || _i$2 >= _ref$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$3.$array[_ref$3.$offset + _i$2]);
|
|
$r = order.PutUint16($subslice(bs, ($imul(2, i$2))), ((x$2 << 16 >>> 16))); /* */ $s = 35; case 35: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$2++;
|
|
/* } */ $s = 33; continue; case 34:
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$4, true)[1]) { */ case 15:
|
|
v$12 = _ref.$val;
|
|
$r = order.PutUint16(bs, v$12.$get()); /* */ $s = 36; case 36: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Uint16, true)[1]) { */ case 16:
|
|
v$13 = _ref.$val;
|
|
$r = order.PutUint16(bs, v$13); /* */ $s = 37; case 37: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$4, true)[1]) { */ case 17:
|
|
v$14 = _ref.$val;
|
|
_ref$4 = v$14;
|
|
_i$3 = 0;
|
|
/* while (true) { */ case 38:
|
|
/* if (!(_i$3 < _ref$4.$length)) { break; } */ if(!(_i$3 < _ref$4.$length)) { $s = 39; continue; }
|
|
i$3 = _i$3;
|
|
x$3 = ((_i$3 < 0 || _i$3 >= _ref$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$4.$array[_ref$4.$offset + _i$3]);
|
|
$r = order.PutUint16($subslice(bs, ($imul(2, i$3))), x$3); /* */ $s = 40; case 40: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$3++;
|
|
/* } */ $s = 38; continue; case 39:
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$5, true)[1]) { */ case 18:
|
|
v$15 = _ref.$val;
|
|
$r = order.PutUint32(bs, ((v$15.$get() >>> 0))); /* */ $s = 41; case 41: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Int32, true)[1]) { */ case 19:
|
|
v$16 = _ref.$val;
|
|
$r = order.PutUint32(bs, ((v$16 >>> 0))); /* */ $s = 42; case 42: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$5, true)[1]) { */ case 20:
|
|
v$17 = _ref.$val;
|
|
_ref$5 = v$17;
|
|
_i$4 = 0;
|
|
/* while (true) { */ case 43:
|
|
/* if (!(_i$4 < _ref$5.$length)) { break; } */ if(!(_i$4 < _ref$5.$length)) { $s = 44; continue; }
|
|
i$4 = _i$4;
|
|
x$4 = ((_i$4 < 0 || _i$4 >= _ref$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$5.$array[_ref$5.$offset + _i$4]);
|
|
$r = order.PutUint32($subslice(bs, ($imul(4, i$4))), ((x$4 >>> 0))); /* */ $s = 45; case 45: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$4++;
|
|
/* } */ $s = 43; continue; case 44:
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$6, true)[1]) { */ case 21:
|
|
v$18 = _ref.$val;
|
|
$r = order.PutUint32(bs, v$18.$get()); /* */ $s = 46; case 46: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Uint32, true)[1]) { */ case 22:
|
|
v$19 = _ref.$val;
|
|
$r = order.PutUint32(bs, v$19); /* */ $s = 47; case 47: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$6, true)[1]) { */ case 23:
|
|
v$20 = _ref.$val;
|
|
_ref$6 = v$20;
|
|
_i$5 = 0;
|
|
/* while (true) { */ case 48:
|
|
/* if (!(_i$5 < _ref$6.$length)) { break; } */ if(!(_i$5 < _ref$6.$length)) { $s = 49; continue; }
|
|
i$5 = _i$5;
|
|
x$5 = ((_i$5 < 0 || _i$5 >= _ref$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$6.$array[_ref$6.$offset + _i$5]);
|
|
$r = order.PutUint32($subslice(bs, ($imul(4, i$5))), x$5); /* */ $s = 50; case 50: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$5++;
|
|
/* } */ $s = 48; continue; case 49:
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$7, true)[1]) { */ case 24:
|
|
v$21 = _ref.$val;
|
|
$r = order.PutUint64(bs, ((x$6 = v$21.$get(), new $Uint64(x$6.$high, x$6.$low)))); /* */ $s = 51; case 51: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Int64, true)[1]) { */ case 25:
|
|
v$22 = _ref.$val;
|
|
$r = order.PutUint64(bs, (new $Uint64(v$22.$high, v$22.$low))); /* */ $s = 52; case 52: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$7, true)[1]) { */ case 26:
|
|
v$23 = _ref.$val;
|
|
_ref$7 = v$23;
|
|
_i$6 = 0;
|
|
/* while (true) { */ case 53:
|
|
/* if (!(_i$6 < _ref$7.$length)) { break; } */ if(!(_i$6 < _ref$7.$length)) { $s = 54; continue; }
|
|
i$6 = _i$6;
|
|
x$7 = ((_i$6 < 0 || _i$6 >= _ref$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$7.$array[_ref$7.$offset + _i$6]);
|
|
$r = order.PutUint64($subslice(bs, ($imul(8, i$6))), (new $Uint64(x$7.$high, x$7.$low))); /* */ $s = 55; case 55: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$6++;
|
|
/* } */ $s = 53; continue; case 54:
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, ptrType$8, true)[1]) { */ case 27:
|
|
v$24 = _ref.$val;
|
|
$r = order.PutUint64(bs, v$24.$get()); /* */ $s = 56; case 56: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, $Uint64, true)[1]) { */ case 28:
|
|
v$25 = _ref.$val;
|
|
$r = order.PutUint64(bs, v$25); /* */ $s = 57; case 57: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 30; continue;
|
|
/* } else if ($assertType(_ref, sliceType$8, true)[1]) { */ case 29:
|
|
v$26 = _ref.$val;
|
|
_ref$8 = v$26;
|
|
_i$7 = 0;
|
|
/* while (true) { */ case 58:
|
|
/* if (!(_i$7 < _ref$8.$length)) { break; } */ if(!(_i$7 < _ref$8.$length)) { $s = 59; continue; }
|
|
i$7 = _i$7;
|
|
x$8 = ((_i$7 < 0 || _i$7 >= _ref$8.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$8.$array[_ref$8.$offset + _i$7]);
|
|
$r = order.PutUint64($subslice(bs, ($imul(8, i$7))), x$8); /* */ $s = 60; case 60: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i$7++;
|
|
/* } */ $s = 58; continue; case 59:
|
|
/* } */ case 30:
|
|
_r = w.Write(bs); /* */ $s = 61; case 61: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
err = _tuple[1];
|
|
$s = -1; return err;
|
|
/* } */ case 2:
|
|
_r$1 = reflect.ValueOf(data); /* */ $s = 62; case 62: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = reflect.Indirect($clone(_r$1, reflect.Value)); /* */ $s = 63; case 63: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v$27 = _r$2;
|
|
_r$3 = dataSize($clone(v$27, reflect.Value)); /* */ $s = 64; case 64: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
size = _r$3;
|
|
/* */ if (size < 0) { $s = 65; continue; }
|
|
/* */ $s = 66; continue;
|
|
/* if (size < 0) { */ case 65:
|
|
_r$4 = reflect.TypeOf(data).String(); /* */ $s = 67; case 67: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = errors.New("binary.Write: invalid type " + _r$4); /* */ $s = 68; case 68: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$5;
|
|
/* } */ case 66:
|
|
buf = $makeSlice(sliceType, size);
|
|
e = new encoder.ptr(order, buf, 0);
|
|
$r = e.value($clone(v$27, reflect.Value)); /* */ $s = 69; case 69: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r$6 = w.Write(buf); /* */ $s = 70; case 70: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$6;
|
|
err$1 = _tuple$1[1];
|
|
$s = -1; return err$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Write }; } $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._i$3 = _i$3; $f._i$4 = _i$4; $f._i$5 = _i$5; $f._i$6 = _i$6; $f._i$7 = _i$7; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f._ref$3 = _ref$3; $f._ref$4 = _ref$4; $f._ref$5 = _ref$5; $f._ref$6 = _ref$6; $f._ref$7 = _ref$7; $f._ref$8 = _ref$8; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.bs = bs; $f.buf = buf; $f.data = data; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.i$4 = i$4; $f.i$5 = i$5; $f.i$6 = i$6; $f.i$7 = i$7; $f.n = n; $f.order = order; $f.size = size; $f.v = v; $f.v$1 = v$1; $f.v$10 = v$10; $f.v$11 = v$11; $f.v$12 = v$12; $f.v$13 = v$13; $f.v$14 = v$14; $f.v$15 = v$15; $f.v$16 = v$16; $f.v$17 = v$17; $f.v$18 = v$18; $f.v$19 = v$19; $f.v$2 = v$2; $f.v$20 = v$20; $f.v$21 = v$21; $f.v$22 = v$22; $f.v$23 = v$23; $f.v$24 = v$24; $f.v$25 = v$25; $f.v$26 = v$26; $f.v$27 = v$27; $f.v$3 = v$3; $f.v$4 = v$4; $f.v$5 = v$5; $f.v$6 = v$6; $f.v$7 = v$7; $f.v$8 = v$8; $f.v$9 = v$9; $f.w = w; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Write = Write;
|
|
Size = function(v) {
|
|
var _r, _r$1, _r$2, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = reflect.ValueOf(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = reflect.Indirect($clone(_r, reflect.Value)); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = dataSize($clone(_r$1, reflect.Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Size }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Size = Size;
|
|
dataSize = function(v) {
|
|
var _r, _r$1, _r$2, s, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; s = $f.s; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if ($clone(v, reflect.Value).Kind() === 23) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ($clone(v, reflect.Value).Kind() === 23) { */ case 1:
|
|
_r = $clone(v, reflect.Value).Type().Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = sizeof(_r); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
s = _r$1;
|
|
if (s >= 0) {
|
|
$s = -1; return $imul(s, $clone(v, reflect.Value).Len());
|
|
}
|
|
$s = -1; return -1;
|
|
/* } */ case 2:
|
|
_r$2 = sizeof($clone(v, reflect.Value).Type()); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: dataSize }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.s = s; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
sizeof = function(t) {
|
|
var _1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _tmp, _tmp$1, i, n, s, s$1, sum, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; i = $f.i; n = $f.n; s = $f.s; s$1 = $f.s$1; sum = $f.sum; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = t.Kind(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_1 = _r;
|
|
/* */ if (_1 === (17)) { $s = 3; continue; }
|
|
/* */ if (_1 === (25)) { $s = 4; continue; }
|
|
/* */ if ((_1 === (1)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6)) || (_1 === (13)) || (_1 === (14)) || (_1 === (15)) || (_1 === (16))) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_1 === (17)) { */ case 3:
|
|
_r$1 = t.Elem(); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = sizeof(_r$1); /* */ $s = 8; case 8: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
s = _r$2;
|
|
/* */ if (s >= 0) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (s >= 0) { */ case 9:
|
|
_r$3 = t.Len(); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$s = -1; return $imul(s, _r$3);
|
|
/* } */ case 10:
|
|
$s = 6; continue;
|
|
/* } else if (_1 === (25)) { */ case 4:
|
|
sum = 0;
|
|
_tmp = 0;
|
|
_r$4 = t.NumField(); /* */ $s = 12; case 12: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tmp$1 = _r$4;
|
|
i = _tmp;
|
|
n = _tmp$1;
|
|
/* while (true) { */ case 13:
|
|
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 14; continue; }
|
|
_r$5 = t.Field(i); /* */ $s = 15; case 15: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$6 = sizeof(_r$5.Type); /* */ $s = 16; case 16: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
s$1 = _r$6;
|
|
if (s$1 < 0) {
|
|
$s = -1; return -1;
|
|
}
|
|
sum = sum + (s$1) >> 0;
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 13; continue; case 14:
|
|
$s = -1; return sum;
|
|
/* } else if ((_1 === (1)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6)) || (_1 === (13)) || (_1 === (14)) || (_1 === (15)) || (_1 === (16))) { */ case 5:
|
|
_r$7 = t.Size(); /* */ $s = 17; case 17: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$s = -1; return ((_r$7 >> 0));
|
|
/* } */ case 6:
|
|
case 1:
|
|
$s = -1; return -1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: sizeof }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.i = i; $f.n = n; $f.s = s; $f.s$1 = s$1; $f.sum = sum; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.ptr.prototype.bool = function() {
|
|
var d, x, x$1, x$2;
|
|
d = this;
|
|
x$2 = (x = d.buf, x$1 = d.offset, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
d.offset = d.offset + (1) >> 0;
|
|
return !((x$2 === 0));
|
|
};
|
|
decoder.prototype.bool = function() { return this.$val.bool(); };
|
|
encoder.ptr.prototype.bool = function(x) {
|
|
var e, x, x$1, x$2, x$3, x$4;
|
|
e = this;
|
|
if (x) {
|
|
(x$1 = e.buf, x$2 = e.offset, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2] = 1));
|
|
} else {
|
|
(x$3 = e.buf, x$4 = e.offset, ((x$4 < 0 || x$4 >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + x$4] = 0));
|
|
}
|
|
e.offset = e.offset + (1) >> 0;
|
|
};
|
|
encoder.prototype.bool = function(x) { return this.$val.bool(x); };
|
|
decoder.ptr.prototype.uint8 = function() {
|
|
var d, x, x$1, x$2;
|
|
d = this;
|
|
x$2 = (x = d.buf, x$1 = d.offset, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
d.offset = d.offset + (1) >> 0;
|
|
return x$2;
|
|
};
|
|
decoder.prototype.uint8 = function() { return this.$val.uint8(); };
|
|
encoder.ptr.prototype.uint8 = function(x) {
|
|
var e, x, x$1, x$2;
|
|
e = this;
|
|
(x$1 = e.buf, x$2 = e.offset, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2] = x));
|
|
e.offset = e.offset + (1) >> 0;
|
|
};
|
|
encoder.prototype.uint8 = function(x) { return this.$val.uint8(x); };
|
|
decoder.ptr.prototype.uint16 = function() {
|
|
var _r, d, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.order.Uint16($subslice(d.buf, d.offset, (d.offset + 2 >> 0))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
x = _r;
|
|
d.offset = d.offset + (2) >> 0;
|
|
$s = -1; return x;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.uint16 }; } $f._r = _r; $f.d = d; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.uint16 = function() { return this.$val.uint16(); };
|
|
encoder.ptr.prototype.uint16 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.order.PutUint16($subslice(e.buf, e.offset, (e.offset + 2 >> 0)), x); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
e.offset = e.offset + (2) >> 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.uint16 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.uint16 = function(x) { return this.$val.uint16(x); };
|
|
decoder.ptr.prototype.uint32 = function() {
|
|
var _r, d, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.order.Uint32($subslice(d.buf, d.offset, (d.offset + 4 >> 0))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
x = _r;
|
|
d.offset = d.offset + (4) >> 0;
|
|
$s = -1; return x;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.uint32 }; } $f._r = _r; $f.d = d; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.uint32 = function() { return this.$val.uint32(); };
|
|
encoder.ptr.prototype.uint32 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.order.PutUint32($subslice(e.buf, e.offset, (e.offset + 4 >> 0)), x); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
e.offset = e.offset + (4) >> 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.uint32 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.uint32 = function(x) { return this.$val.uint32(x); };
|
|
decoder.ptr.prototype.uint64 = function() {
|
|
var _r, d, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.order.Uint64($subslice(d.buf, d.offset, (d.offset + 8 >> 0))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
x = _r;
|
|
d.offset = d.offset + (8) >> 0;
|
|
$s = -1; return x;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.uint64 }; } $f._r = _r; $f.d = d; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.uint64 = function() { return this.$val.uint64(); };
|
|
encoder.ptr.prototype.uint64 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.order.PutUint64($subslice(e.buf, e.offset, (e.offset + 8 >> 0)), x); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
e.offset = e.offset + (8) >> 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.uint64 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.uint64 = function(x) { return this.$val.uint64(x); };
|
|
decoder.ptr.prototype.int8 = function() {
|
|
var d;
|
|
d = this;
|
|
return ((d.uint8() << 24 >> 24));
|
|
};
|
|
decoder.prototype.int8 = function() { return this.$val.int8(); };
|
|
encoder.ptr.prototype.int8 = function(x) {
|
|
var e, x;
|
|
e = this;
|
|
e.uint8(((x << 24 >>> 24)));
|
|
};
|
|
encoder.prototype.int8 = function(x) { return this.$val.int8(x); };
|
|
decoder.ptr.prototype.int16 = function() {
|
|
var _r, d, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.uint16(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ((_r << 16 >> 16));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.int16 }; } $f._r = _r; $f.d = d; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.int16 = function() { return this.$val.int16(); };
|
|
encoder.ptr.prototype.int16 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.uint16(((x << 16 >>> 16))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.int16 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.int16 = function(x) { return this.$val.int16(x); };
|
|
decoder.ptr.prototype.int32 = function() {
|
|
var _r, d, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.uint32(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ((_r >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.int32 }; } $f._r = _r; $f.d = d; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.int32 = function() { return this.$val.int32(); };
|
|
encoder.ptr.prototype.int32 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.uint32(((x >>> 0))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.int32 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.int32 = function(x) { return this.$val.int32(x); };
|
|
decoder.ptr.prototype.int64 = function() {
|
|
var _r, d, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = d.uint64(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ((x = _r, new $Int64(x.$high, x.$low)));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.int64 }; } $f._r = _r; $f.d = d; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.int64 = function() { return this.$val.int64(); };
|
|
encoder.ptr.prototype.int64 = function(x) {
|
|
var e, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; e = $f.e; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
$r = e.uint64((new $Uint64(x.$high, x.$low))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.int64 }; } $f.e = e; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.int64 = function(x) { return this.$val.int64(x); };
|
|
decoder.ptr.prototype.value = function(v) {
|
|
var _1, _arg, _arg$1, _arg$2, _arg$3, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$16, _r$17, _r$18, _r$19, _r$2, _r$20, _r$21, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _v, d, i, i$1, i$2, l, l$1, l$2, t, v, v$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _arg$3 = $f._arg$3; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$16 = $f._r$16; _r$17 = $f._r$17; _r$18 = $f._r$18; _r$19 = $f._r$19; _r$2 = $f._r$2; _r$20 = $f._r$20; _r$21 = $f._r$21; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _v = $f._v; d = $f.d; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; l = $f.l; l$1 = $f.l$1; l$2 = $f.l$2; t = $f.t; v = $f.v; v$1 = $f.v$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_1 = $clone(v, reflect.Value).Kind();
|
|
/* */ if (_1 === (17)) { $s = 2; continue; }
|
|
/* */ if (_1 === (25)) { $s = 3; continue; }
|
|
/* */ if (_1 === (23)) { $s = 4; continue; }
|
|
/* */ if (_1 === (1)) { $s = 5; continue; }
|
|
/* */ if (_1 === (3)) { $s = 6; continue; }
|
|
/* */ if (_1 === (4)) { $s = 7; continue; }
|
|
/* */ if (_1 === (5)) { $s = 8; continue; }
|
|
/* */ if (_1 === (6)) { $s = 9; continue; }
|
|
/* */ if (_1 === (8)) { $s = 10; continue; }
|
|
/* */ if (_1 === (9)) { $s = 11; continue; }
|
|
/* */ if (_1 === (10)) { $s = 12; continue; }
|
|
/* */ if (_1 === (11)) { $s = 13; continue; }
|
|
/* */ if (_1 === (13)) { $s = 14; continue; }
|
|
/* */ if (_1 === (14)) { $s = 15; continue; }
|
|
/* */ if (_1 === (15)) { $s = 16; continue; }
|
|
/* */ if (_1 === (16)) { $s = 17; continue; }
|
|
/* */ $s = 18; continue;
|
|
/* if (_1 === (17)) { */ case 2:
|
|
l = $clone(v, reflect.Value).Len();
|
|
i = 0;
|
|
/* while (true) { */ case 19:
|
|
/* if (!(i < l)) { break; } */ if(!(i < l)) { $s = 20; continue; }
|
|
_r = $clone(v, reflect.Value).Index(i); /* */ $s = 21; case 21: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = d.value($clone(_r, reflect.Value)); /* */ $s = 22; case 22: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 19; continue; case 20:
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (25)) { */ case 3:
|
|
t = $clone(v, reflect.Value).Type();
|
|
l$1 = $clone(v, reflect.Value).NumField();
|
|
i$1 = 0;
|
|
/* while (true) { */ case 23:
|
|
/* if (!(i$1 < l$1)) { break; } */ if(!(i$1 < l$1)) { $s = 24; continue; }
|
|
_r$1 = $clone(v, reflect.Value).Field(i$1); /* */ $s = 25; case 25: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v$1 = _r$1;
|
|
if ($clone(v$1, reflect.Value).CanSet()) { _v = true; $s = 29; continue s; }
|
|
_r$2 = t.Field(i$1); /* */ $s = 30; case 30: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v = !(_r$2.Name === "_"); case 29:
|
|
/* */ if (_v) { $s = 26; continue; }
|
|
/* */ $s = 27; continue;
|
|
/* if (_v) { */ case 26:
|
|
$r = d.value($clone(v$1, reflect.Value)); /* */ $s = 31; case 31: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 28; continue;
|
|
/* } else { */ case 27:
|
|
$r = d.skip($clone(v$1, reflect.Value)); /* */ $s = 32; case 32: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 28:
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 23; continue; case 24:
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (23)) { */ case 4:
|
|
l$2 = $clone(v, reflect.Value).Len();
|
|
i$2 = 0;
|
|
/* while (true) { */ case 33:
|
|
/* if (!(i$2 < l$2)) { break; } */ if(!(i$2 < l$2)) { $s = 34; continue; }
|
|
_r$3 = $clone(v, reflect.Value).Index(i$2); /* */ $s = 35; case 35: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$r = d.value($clone(_r$3, reflect.Value)); /* */ $s = 36; case 36: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$2 = i$2 + (1) >> 0;
|
|
/* } */ $s = 33; continue; case 34:
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (1)) { */ case 5:
|
|
$clone(v, reflect.Value).SetBool(d.bool());
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (3)) { */ case 6:
|
|
$clone(v, reflect.Value).SetInt((new $Int64(0, d.int8())));
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (4)) { */ case 7:
|
|
_r$4 = d.int16(); /* */ $s = 37; case 37: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetInt((new $Int64(0, _r$4))); /* */ $s = 38; case 38: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (5)) { */ case 8:
|
|
_r$5 = d.int32(); /* */ $s = 39; case 39: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetInt((new $Int64(0, _r$5))); /* */ $s = 40; case 40: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (6)) { */ case 9:
|
|
_r$6 = d.int64(); /* */ $s = 41; case 41: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetInt(_r$6); /* */ $s = 42; case 42: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (8)) { */ case 10:
|
|
$clone(v, reflect.Value).SetUint((new $Uint64(0, d.uint8())));
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (9)) { */ case 11:
|
|
_r$7 = d.uint16(); /* */ $s = 43; case 43: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetUint((new $Uint64(0, _r$7))); /* */ $s = 44; case 44: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (10)) { */ case 12:
|
|
_r$8 = d.uint32(); /* */ $s = 45; case 45: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetUint((new $Uint64(0, _r$8))); /* */ $s = 46; case 46: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (11)) { */ case 13:
|
|
_r$9 = d.uint64(); /* */ $s = 47; case 47: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetUint(_r$9); /* */ $s = 48; case 48: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (13)) { */ case 14:
|
|
_r$10 = d.uint32(); /* */ $s = 49; case 49: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_r$11 = math.Float32frombits(_r$10); /* */ $s = 50; case 50: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetFloat((_r$11)); /* */ $s = 51; case 51: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (14)) { */ case 15:
|
|
_r$12 = d.uint64(); /* */ $s = 52; case 52: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_r$13 = math.Float64frombits(_r$12); /* */ $s = 53; case 53: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).SetFloat(_r$13); /* */ $s = 54; case 54: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (15)) { */ case 16:
|
|
_r$14 = d.uint32(); /* */ $s = 55; case 55: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
_r$15 = math.Float32frombits(_r$14); /* */ $s = 56; case 56: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
_arg = (_r$15);
|
|
_r$16 = d.uint32(); /* */ $s = 57; case 57: if($c) { $c = false; _r$16 = _r$16.$blk(); } if (_r$16 && _r$16.$blk !== undefined) { break s; }
|
|
_r$17 = math.Float32frombits(_r$16); /* */ $s = 58; case 58: if($c) { $c = false; _r$17 = _r$17.$blk(); } if (_r$17 && _r$17.$blk !== undefined) { break s; }
|
|
_arg$1 = (_r$17);
|
|
$r = $clone(v, reflect.Value).SetComplex(new $Complex128(_arg, _arg$1)); /* */ $s = 59; case 59: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (16)) { */ case 17:
|
|
_r$18 = d.uint64(); /* */ $s = 60; case 60: if($c) { $c = false; _r$18 = _r$18.$blk(); } if (_r$18 && _r$18.$blk !== undefined) { break s; }
|
|
_r$19 = math.Float64frombits(_r$18); /* */ $s = 61; case 61: if($c) { $c = false; _r$19 = _r$19.$blk(); } if (_r$19 && _r$19.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$19;
|
|
_r$20 = d.uint64(); /* */ $s = 62; case 62: if($c) { $c = false; _r$20 = _r$20.$blk(); } if (_r$20 && _r$20.$blk !== undefined) { break s; }
|
|
_r$21 = math.Float64frombits(_r$20); /* */ $s = 63; case 63: if($c) { $c = false; _r$21 = _r$21.$blk(); } if (_r$21 && _r$21.$blk !== undefined) { break s; }
|
|
_arg$3 = _r$21;
|
|
$r = $clone(v, reflect.Value).SetComplex(new $Complex128(_arg$2, _arg$3)); /* */ $s = 64; case 64: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 18:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.value }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._arg$3 = _arg$3; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$16 = _r$16; $f._r$17 = _r$17; $f._r$18 = _r$18; $f._r$19 = _r$19; $f._r$2 = _r$2; $f._r$20 = _r$20; $f._r$21 = _r$21; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._v = _v; $f.d = d; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.l = l; $f.l$1 = l$1; $f.l$2 = l$2; $f.t = t; $f.v = v; $f.v$1 = v$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.value = function(v) { return this.$val.value(v); };
|
|
encoder.ptr.prototype.value = function(v) {
|
|
var _1, _2, _3, _4, _5, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _v, e, i, i$1, i$2, l, l$1, l$2, t, v, v$1, x, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _5 = $f._5; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _v = $f._v; e = $f.e; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; l = $f.l; l$1 = $f.l$1; l$2 = $f.l$2; t = $f.t; v = $f.v; v$1 = $f.v$1; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_1 = $clone(v, reflect.Value).Kind();
|
|
/* */ if (_1 === (17)) { $s = 2; continue; }
|
|
/* */ if (_1 === (25)) { $s = 3; continue; }
|
|
/* */ if (_1 === (23)) { $s = 4; continue; }
|
|
/* */ if (_1 === (1)) { $s = 5; continue; }
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 6; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { $s = 7; continue; }
|
|
/* */ if ((_1 === (13)) || (_1 === (14))) { $s = 8; continue; }
|
|
/* */ if ((_1 === (15)) || (_1 === (16))) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_1 === (17)) { */ case 2:
|
|
l = $clone(v, reflect.Value).Len();
|
|
i = 0;
|
|
/* while (true) { */ case 11:
|
|
/* if (!(i < l)) { break; } */ if(!(i < l)) { $s = 12; continue; }
|
|
_r = $clone(v, reflect.Value).Index(i); /* */ $s = 13; case 13: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$r = e.value($clone(_r, reflect.Value)); /* */ $s = 14; case 14: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 11; continue; case 12:
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (25)) { */ case 3:
|
|
t = $clone(v, reflect.Value).Type();
|
|
l$1 = $clone(v, reflect.Value).NumField();
|
|
i$1 = 0;
|
|
/* while (true) { */ case 15:
|
|
/* if (!(i$1 < l$1)) { break; } */ if(!(i$1 < l$1)) { $s = 16; continue; }
|
|
_r$1 = $clone(v, reflect.Value).Field(i$1); /* */ $s = 17; case 17: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v$1 = _r$1;
|
|
if ($clone(v$1, reflect.Value).CanSet()) { _v = true; $s = 21; continue s; }
|
|
_r$2 = t.Field(i$1); /* */ $s = 22; case 22: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_v = !(_r$2.Name === "_"); case 21:
|
|
/* */ if (_v) { $s = 18; continue; }
|
|
/* */ $s = 19; continue;
|
|
/* if (_v) { */ case 18:
|
|
$r = e.value($clone(v$1, reflect.Value)); /* */ $s = 23; case 23: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 20; continue;
|
|
/* } else { */ case 19:
|
|
$r = e.skip($clone(v$1, reflect.Value)); /* */ $s = 24; case 24: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 20:
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 15; continue; case 16:
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (23)) { */ case 4:
|
|
l$2 = $clone(v, reflect.Value).Len();
|
|
i$2 = 0;
|
|
/* while (true) { */ case 25:
|
|
/* if (!(i$2 < l$2)) { break; } */ if(!(i$2 < l$2)) { $s = 26; continue; }
|
|
_r$3 = $clone(v, reflect.Value).Index(i$2); /* */ $s = 27; case 27: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$r = e.value($clone(_r$3, reflect.Value)); /* */ $s = 28; case 28: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i$2 = i$2 + (1) >> 0;
|
|
/* } */ $s = 25; continue; case 26:
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (1)) { */ case 5:
|
|
e.bool($clone(v, reflect.Value).Bool());
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 6:
|
|
_r$4 = $clone(v, reflect.Value).Type().Kind(); /* */ $s = 30; case 30: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_2 = _r$4;
|
|
/* */ if (_2 === (3)) { $s = 31; continue; }
|
|
/* */ if (_2 === (4)) { $s = 32; continue; }
|
|
/* */ if (_2 === (5)) { $s = 33; continue; }
|
|
/* */ if (_2 === (6)) { $s = 34; continue; }
|
|
/* */ $s = 35; continue;
|
|
/* if (_2 === (3)) { */ case 31:
|
|
e.int8((((x = $clone(v, reflect.Value).Int(), x.$low + ((x.$high >> 31) * 4294967296)) << 24 >> 24)));
|
|
$s = 35; continue;
|
|
/* } else if (_2 === (4)) { */ case 32:
|
|
$r = e.int16((((x$1 = $clone(v, reflect.Value).Int(), x$1.$low + ((x$1.$high >> 31) * 4294967296)) << 16 >> 16))); /* */ $s = 36; case 36: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 35; continue;
|
|
/* } else if (_2 === (5)) { */ case 33:
|
|
$r = e.int32((((x$2 = $clone(v, reflect.Value).Int(), x$2.$low + ((x$2.$high >> 31) * 4294967296)) >> 0))); /* */ $s = 37; case 37: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 35; continue;
|
|
/* } else if (_2 === (6)) { */ case 34:
|
|
$r = e.int64($clone(v, reflect.Value).Int()); /* */ $s = 38; case 38: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 35:
|
|
case 29:
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { */ case 7:
|
|
_r$5 = $clone(v, reflect.Value).Type().Kind(); /* */ $s = 40; case 40: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_3 = _r$5;
|
|
/* */ if (_3 === (8)) { $s = 41; continue; }
|
|
/* */ if (_3 === (9)) { $s = 42; continue; }
|
|
/* */ if (_3 === (10)) { $s = 43; continue; }
|
|
/* */ if (_3 === (11)) { $s = 44; continue; }
|
|
/* */ $s = 45; continue;
|
|
/* if (_3 === (8)) { */ case 41:
|
|
e.uint8((($clone(v, reflect.Value).Uint().$low << 24 >>> 24)));
|
|
$s = 45; continue;
|
|
/* } else if (_3 === (9)) { */ case 42:
|
|
$r = e.uint16((($clone(v, reflect.Value).Uint().$low << 16 >>> 16))); /* */ $s = 46; case 46: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 45; continue;
|
|
/* } else if (_3 === (10)) { */ case 43:
|
|
$r = e.uint32((($clone(v, reflect.Value).Uint().$low >>> 0))); /* */ $s = 47; case 47: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 45; continue;
|
|
/* } else if (_3 === (11)) { */ case 44:
|
|
$r = e.uint64($clone(v, reflect.Value).Uint()); /* */ $s = 48; case 48: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 45:
|
|
case 39:
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (13)) || (_1 === (14))) { */ case 8:
|
|
_r$6 = $clone(v, reflect.Value).Type().Kind(); /* */ $s = 50; case 50: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_4 = _r$6;
|
|
/* */ if (_4 === (13)) { $s = 51; continue; }
|
|
/* */ if (_4 === (14)) { $s = 52; continue; }
|
|
/* */ $s = 53; continue;
|
|
/* if (_4 === (13)) { */ case 51:
|
|
$r = e.uint32(math.Float32bits(($fround($clone(v, reflect.Value).Float())))); /* */ $s = 54; case 54: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 53; continue;
|
|
/* } else if (_4 === (14)) { */ case 52:
|
|
$r = e.uint64(math.Float64bits($clone(v, reflect.Value).Float())); /* */ $s = 55; case 55: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 53:
|
|
case 49:
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (15)) || (_1 === (16))) { */ case 9:
|
|
_r$7 = $clone(v, reflect.Value).Type().Kind(); /* */ $s = 57; case 57: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_5 = _r$7;
|
|
/* */ if (_5 === (15)) { $s = 58; continue; }
|
|
/* */ if (_5 === (16)) { $s = 59; continue; }
|
|
/* */ $s = 60; continue;
|
|
/* if (_5 === (15)) { */ case 58:
|
|
x$3 = $clone(v, reflect.Value).Complex();
|
|
$r = e.uint32(math.Float32bits(($fround(x$3.$real)))); /* */ $s = 61; case 61: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = e.uint32(math.Float32bits(($fround(x$3.$imag)))); /* */ $s = 62; case 62: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 60; continue;
|
|
/* } else if (_5 === (16)) { */ case 59:
|
|
x$4 = $clone(v, reflect.Value).Complex();
|
|
$r = e.uint64(math.Float64bits(x$4.$real)); /* */ $s = 63; case 63: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = e.uint64(math.Float64bits(x$4.$imag)); /* */ $s = 64; case 64: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 60:
|
|
case 56:
|
|
/* } */ case 10:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.value }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._5 = _5; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._v = _v; $f.e = e; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.l = l; $f.l$1 = l$1; $f.l$2 = l$2; $f.t = t; $f.v = v; $f.v$1 = v$1; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.value = function(v) { return this.$val.value(v); };
|
|
decoder.ptr.prototype.skip = function(v) {
|
|
var _r, d, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; d = $f.d; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
d = this;
|
|
_r = dataSize($clone(v, reflect.Value)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
d.offset = d.offset + (_r) >> 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: decoder.ptr.prototype.skip }; } $f._r = _r; $f.d = d; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
decoder.prototype.skip = function(v) { return this.$val.skip(v); };
|
|
encoder.ptr.prototype.skip = function(v) {
|
|
var _i, _r, _ref, e, i, n, v, zero, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; e = $f.e; i = $f.i; n = $f.n; v = $f.v; zero = $f.zero; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = dataSize($clone(v, reflect.Value)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r;
|
|
zero = $subslice(e.buf, e.offset, (e.offset + n >> 0));
|
|
_ref = zero;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
((i < 0 || i >= zero.$length) ? ($throwRuntimeError("index out of range"), undefined) : zero.$array[zero.$offset + i] = 0);
|
|
_i++;
|
|
}
|
|
e.offset = e.offset + (n) >> 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: encoder.ptr.prototype.skip }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.e = e; $f.i = i; $f.n = n; $f.v = v; $f.zero = zero; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
encoder.prototype.skip = function(v) { return this.$val.skip(v); };
|
|
intDataSize = function(data) {
|
|
var _ref, data, data$1, data$10, data$11, data$12, data$13, data$2, data$3, data$4, data$5, data$6, data$7, data$8, data$9;
|
|
_ref = data;
|
|
if ($assertType(_ref, $Bool, true)[1] || $assertType(_ref, $Int8, true)[1] || $assertType(_ref, $Uint8, true)[1] || $assertType(_ref, ptrType, true)[1] || $assertType(_ref, ptrType$1, true)[1] || $assertType(_ref, ptrType$2, true)[1]) {
|
|
data$1 = _ref;
|
|
return 1;
|
|
} else if ($assertType(_ref, sliceType$1, true)[1]) {
|
|
data$2 = _ref.$val;
|
|
return data$2.$length;
|
|
} else if ($assertType(_ref, sliceType$2, true)[1]) {
|
|
data$3 = _ref.$val;
|
|
return data$3.$length;
|
|
} else if ($assertType(_ref, sliceType, true)[1]) {
|
|
data$4 = _ref.$val;
|
|
return data$4.$length;
|
|
} else if ($assertType(_ref, $Int16, true)[1] || $assertType(_ref, $Uint16, true)[1] || $assertType(_ref, ptrType$3, true)[1] || $assertType(_ref, ptrType$4, true)[1]) {
|
|
data$5 = _ref;
|
|
return 2;
|
|
} else if ($assertType(_ref, sliceType$3, true)[1]) {
|
|
data$6 = _ref.$val;
|
|
return $imul(2, data$6.$length);
|
|
} else if ($assertType(_ref, sliceType$4, true)[1]) {
|
|
data$7 = _ref.$val;
|
|
return $imul(2, data$7.$length);
|
|
} else if ($assertType(_ref, $Int32, true)[1] || $assertType(_ref, $Uint32, true)[1] || $assertType(_ref, ptrType$5, true)[1] || $assertType(_ref, ptrType$6, true)[1]) {
|
|
data$8 = _ref;
|
|
return 4;
|
|
} else if ($assertType(_ref, sliceType$5, true)[1]) {
|
|
data$9 = _ref.$val;
|
|
return $imul(4, data$9.$length);
|
|
} else if ($assertType(_ref, sliceType$6, true)[1]) {
|
|
data$10 = _ref.$val;
|
|
return $imul(4, data$10.$length);
|
|
} else if ($assertType(_ref, $Int64, true)[1] || $assertType(_ref, $Uint64, true)[1] || $assertType(_ref, ptrType$7, true)[1] || $assertType(_ref, ptrType$8, true)[1]) {
|
|
data$11 = _ref;
|
|
return 8;
|
|
} else if ($assertType(_ref, sliceType$7, true)[1]) {
|
|
data$12 = _ref.$val;
|
|
return $imul(8, data$12.$length);
|
|
} else if ($assertType(_ref, sliceType$8, true)[1]) {
|
|
data$13 = _ref.$val;
|
|
return $imul(8, data$13.$length);
|
|
}
|
|
return 0;
|
|
};
|
|
littleEndian.methods = [{prop: "Uint16", name: "Uint16", pkg: "", typ: $funcType([sliceType], [$Uint16], false)}, {prop: "PutUint16", name: "PutUint16", pkg: "", typ: $funcType([sliceType, $Uint16], [], false)}, {prop: "Uint32", name: "Uint32", pkg: "", typ: $funcType([sliceType], [$Uint32], false)}, {prop: "PutUint32", name: "PutUint32", pkg: "", typ: $funcType([sliceType, $Uint32], [], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([sliceType], [$Uint64], false)}, {prop: "PutUint64", name: "PutUint64", pkg: "", typ: $funcType([sliceType, $Uint64], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "GoString", name: "GoString", pkg: "", typ: $funcType([], [$String], false)}];
|
|
bigEndian.methods = [{prop: "Uint16", name: "Uint16", pkg: "", typ: $funcType([sliceType], [$Uint16], false)}, {prop: "PutUint16", name: "PutUint16", pkg: "", typ: $funcType([sliceType, $Uint16], [], false)}, {prop: "Uint32", name: "Uint32", pkg: "", typ: $funcType([sliceType], [$Uint32], false)}, {prop: "PutUint32", name: "PutUint32", pkg: "", typ: $funcType([sliceType, $Uint32], [], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([sliceType], [$Uint64], false)}, {prop: "PutUint64", name: "PutUint64", pkg: "", typ: $funcType([sliceType, $Uint64], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "GoString", name: "GoString", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$9.methods = [{prop: "bool", name: "bool", pkg: "encoding/binary", typ: $funcType([], [$Bool], false)}, {prop: "uint8", name: "uint8", pkg: "encoding/binary", typ: $funcType([], [$Uint8], false)}, {prop: "uint16", name: "uint16", pkg: "encoding/binary", typ: $funcType([], [$Uint16], false)}, {prop: "uint32", name: "uint32", pkg: "encoding/binary", typ: $funcType([], [$Uint32], false)}, {prop: "uint64", name: "uint64", pkg: "encoding/binary", typ: $funcType([], [$Uint64], false)}, {prop: "int8", name: "int8", pkg: "encoding/binary", typ: $funcType([], [$Int8], false)}, {prop: "int16", name: "int16", pkg: "encoding/binary", typ: $funcType([], [$Int16], false)}, {prop: "int32", name: "int32", pkg: "encoding/binary", typ: $funcType([], [$Int32], false)}, {prop: "int64", name: "int64", pkg: "encoding/binary", typ: $funcType([], [$Int64], false)}, {prop: "value", name: "value", pkg: "encoding/binary", typ: $funcType([reflect.Value], [], false)}, {prop: "skip", name: "skip", pkg: "encoding/binary", typ: $funcType([reflect.Value], [], false)}];
|
|
ptrType$10.methods = [{prop: "bool", name: "bool", pkg: "encoding/binary", typ: $funcType([$Bool], [], false)}, {prop: "uint8", name: "uint8", pkg: "encoding/binary", typ: $funcType([$Uint8], [], false)}, {prop: "uint16", name: "uint16", pkg: "encoding/binary", typ: $funcType([$Uint16], [], false)}, {prop: "uint32", name: "uint32", pkg: "encoding/binary", typ: $funcType([$Uint32], [], false)}, {prop: "uint64", name: "uint64", pkg: "encoding/binary", typ: $funcType([$Uint64], [], false)}, {prop: "int8", name: "int8", pkg: "encoding/binary", typ: $funcType([$Int8], [], false)}, {prop: "int16", name: "int16", pkg: "encoding/binary", typ: $funcType([$Int16], [], false)}, {prop: "int32", name: "int32", pkg: "encoding/binary", typ: $funcType([$Int32], [], false)}, {prop: "int64", name: "int64", pkg: "encoding/binary", typ: $funcType([$Int64], [], false)}, {prop: "value", name: "value", pkg: "encoding/binary", typ: $funcType([reflect.Value], [], false)}, {prop: "skip", name: "skip", pkg: "encoding/binary", typ: $funcType([reflect.Value], [], false)}];
|
|
ByteOrder.init([{prop: "PutUint16", name: "PutUint16", pkg: "", typ: $funcType([sliceType, $Uint16], [], false)}, {prop: "PutUint32", name: "PutUint32", pkg: "", typ: $funcType([sliceType, $Uint32], [], false)}, {prop: "PutUint64", name: "PutUint64", pkg: "", typ: $funcType([sliceType, $Uint64], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Uint16", name: "Uint16", pkg: "", typ: $funcType([sliceType], [$Uint16], false)}, {prop: "Uint32", name: "Uint32", pkg: "", typ: $funcType([sliceType], [$Uint32], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([sliceType], [$Uint64], false)}]);
|
|
littleEndian.init("", []);
|
|
bigEndian.init("", []);
|
|
decoder.init("encoding/binary", [{prop: "order", name: "order", embedded: false, exported: false, typ: ByteOrder, tag: ""}, {prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "offset", name: "offset", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
encoder.init("encoding/binary", [{prop: "order", name: "order", embedded: false, exported: false, typ: ByteOrder, tag: ""}, {prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "offset", name: "offset", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = reflect.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.LittleEndian = new littleEndian.ptr();
|
|
$pkg.BigEndian = new bigEndian.ptr();
|
|
overflow = errors.New("binary: varint overflows a 64-bit integer");
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["strings"] = (function() {
|
|
var $pkg = {}, $init, errors, js, bytealg, io, sync, unicode, utf8, Builder, asciiSet, ptrType, sliceType, sliceType$1, ptrType$5, arrayType$3, IndexByte, Index, LastIndex, Count, explode, Contains, ContainsRune, IndexRune, IndexAny, LastIndexByte, genSplit, SplitN, Split, Join, HasPrefix, HasSuffix, Map, ToLower, makeASCIISet, TrimPrefix;
|
|
errors = $packages["errors"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
bytealg = $packages["internal/bytealg"];
|
|
io = $packages["io"];
|
|
sync = $packages["sync"];
|
|
unicode = $packages["unicode"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
Builder = $pkg.Builder = $newType(0, $kindStruct, "strings.Builder", true, "strings", true, function(addr_, buf_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.addr = ptrType.nil;
|
|
this.buf = sliceType.nil;
|
|
return;
|
|
}
|
|
this.addr = addr_;
|
|
this.buf = buf_;
|
|
});
|
|
asciiSet = $pkg.asciiSet = $newType(32, $kindArray, "strings.asciiSet", true, "strings", false, null);
|
|
ptrType = $ptrType(Builder);
|
|
sliceType = $sliceType($Uint8);
|
|
sliceType$1 = $sliceType($String);
|
|
ptrType$5 = $ptrType(asciiSet);
|
|
arrayType$3 = $arrayType($Uint32, 8);
|
|
IndexByte = function(s, c) {
|
|
var c, s;
|
|
return $parseInt(s.indexOf($global.String.fromCharCode(c))) >> 0;
|
|
};
|
|
$pkg.IndexByte = IndexByte;
|
|
Index = function(s, sep) {
|
|
var s, sep;
|
|
return $parseInt(s.indexOf(sep)) >> 0;
|
|
};
|
|
$pkg.Index = Index;
|
|
LastIndex = function(s, sep) {
|
|
var s, sep;
|
|
return $parseInt(s.lastIndexOf(sep)) >> 0;
|
|
};
|
|
$pkg.LastIndex = LastIndex;
|
|
Count = function(s, sep) {
|
|
var n, pos, s, sep;
|
|
n = 0;
|
|
if ((sep.length === 0)) {
|
|
return utf8.RuneCountInString(s) + 1 >> 0;
|
|
} else if (sep.length > s.length) {
|
|
return 0;
|
|
} else if ((sep.length === s.length)) {
|
|
if (sep === s) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
while (true) {
|
|
pos = Index(s, sep);
|
|
if (pos === -1) {
|
|
break;
|
|
}
|
|
n = n + (1) >> 0;
|
|
s = $substring(s, (pos + sep.length >> 0));
|
|
}
|
|
return n;
|
|
};
|
|
$pkg.Count = Count;
|
|
Builder.ptr.prototype.String = function() {
|
|
var b;
|
|
b = this;
|
|
return ($bytesToString(b.buf));
|
|
};
|
|
Builder.prototype.String = function() { return this.$val.String(); };
|
|
Builder.ptr.prototype.copyCheck = function() {
|
|
var b;
|
|
b = this;
|
|
if (b.addr === ptrType.nil) {
|
|
b.addr = b;
|
|
} else if (!(b.addr === b)) {
|
|
$panic(new $String("strings: illegal use of non-zero Builder copied by value"));
|
|
}
|
|
};
|
|
Builder.prototype.copyCheck = function() { return this.$val.copyCheck(); };
|
|
Builder.ptr.prototype.Len = function() {
|
|
var b;
|
|
b = this;
|
|
return b.buf.$length;
|
|
};
|
|
Builder.prototype.Len = function() { return this.$val.Len(); };
|
|
Builder.ptr.prototype.Cap = function() {
|
|
var b;
|
|
b = this;
|
|
return b.buf.$capacity;
|
|
};
|
|
Builder.prototype.Cap = function() { return this.$val.Cap(); };
|
|
Builder.ptr.prototype.Reset = function() {
|
|
var b;
|
|
b = this;
|
|
b.addr = ptrType.nil;
|
|
b.buf = sliceType.nil;
|
|
};
|
|
Builder.prototype.Reset = function() { return this.$val.Reset(); };
|
|
Builder.ptr.prototype.grow = function(n) {
|
|
var b, buf, n;
|
|
b = this;
|
|
buf = $makeSlice(sliceType, b.buf.$length, (($imul(2, b.buf.$capacity)) + n >> 0));
|
|
$copySlice(buf, b.buf);
|
|
b.buf = buf;
|
|
};
|
|
Builder.prototype.grow = function(n) { return this.$val.grow(n); };
|
|
Builder.ptr.prototype.Grow = function(n) {
|
|
var b, n;
|
|
b = this;
|
|
b.copyCheck();
|
|
if (n < 0) {
|
|
$panic(new $String("strings.Builder.Grow: negative count"));
|
|
}
|
|
if ((b.buf.$capacity - b.buf.$length >> 0) < n) {
|
|
b.grow(n);
|
|
}
|
|
};
|
|
Builder.prototype.Grow = function(n) { return this.$val.Grow(n); };
|
|
Builder.ptr.prototype.Write = function(p) {
|
|
var b, p;
|
|
b = this;
|
|
b.copyCheck();
|
|
b.buf = $appendSlice(b.buf, p);
|
|
return [p.$length, $ifaceNil];
|
|
};
|
|
Builder.prototype.Write = function(p) { return this.$val.Write(p); };
|
|
Builder.ptr.prototype.WriteByte = function(c) {
|
|
var b, c;
|
|
b = this;
|
|
b.copyCheck();
|
|
b.buf = $append(b.buf, c);
|
|
return $ifaceNil;
|
|
};
|
|
Builder.prototype.WriteByte = function(c) { return this.$val.WriteByte(c); };
|
|
Builder.ptr.prototype.WriteRune = function(r) {
|
|
var b, l, n, r;
|
|
b = this;
|
|
b.copyCheck();
|
|
if (r < 128) {
|
|
b.buf = $append(b.buf, ((r << 24 >>> 24)));
|
|
return [1, $ifaceNil];
|
|
}
|
|
l = b.buf.$length;
|
|
if ((b.buf.$capacity - l >> 0) < 4) {
|
|
b.grow(4);
|
|
}
|
|
n = utf8.EncodeRune($subslice(b.buf, l, (l + 4 >> 0)), r);
|
|
b.buf = $subslice(b.buf, 0, (l + n >> 0));
|
|
return [n, $ifaceNil];
|
|
};
|
|
Builder.prototype.WriteRune = function(r) { return this.$val.WriteRune(r); };
|
|
Builder.ptr.prototype.WriteString = function(s) {
|
|
var b, s;
|
|
b = this;
|
|
b.copyCheck();
|
|
b.buf = $appendSlice(b.buf, s);
|
|
return [s.length, $ifaceNil];
|
|
};
|
|
Builder.prototype.WriteString = function(s) { return this.$val.WriteString(s); };
|
|
explode = function(s, n) {
|
|
var _tuple, a, ch, i, l, n, s, size, x;
|
|
l = utf8.RuneCountInString(s);
|
|
if (n < 0 || n > l) {
|
|
n = l;
|
|
}
|
|
a = $makeSlice(sliceType$1, n);
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < (n - 1 >> 0))) { break; }
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
ch = _tuple[0];
|
|
size = _tuple[1];
|
|
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = $substring(s, 0, size));
|
|
s = $substring(s, size);
|
|
if (ch === 65533) {
|
|
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = "\xEF\xBF\xBD");
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (n > 0) {
|
|
(x = n - 1 >> 0, ((x < 0 || x >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x] = s));
|
|
}
|
|
return a;
|
|
};
|
|
Contains = function(s, substr) {
|
|
var s, substr;
|
|
return Index(s, substr) >= 0;
|
|
};
|
|
$pkg.Contains = Contains;
|
|
ContainsRune = function(s, r) {
|
|
var r, s;
|
|
return IndexRune(s, r) >= 0;
|
|
};
|
|
$pkg.ContainsRune = ContainsRune;
|
|
IndexRune = function(s, r) {
|
|
var _i, _ref, _rune, i, r, r$1, s;
|
|
if (0 <= r && r < 128) {
|
|
return IndexByte(s, ((r << 24 >>> 24)));
|
|
} else if ((r === 65533)) {
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i = _i;
|
|
r$1 = _rune[0];
|
|
if (r$1 === 65533) {
|
|
return i;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return -1;
|
|
} else if (!utf8.ValidRune(r)) {
|
|
return -1;
|
|
} else {
|
|
return Index(s, ($encodeRune(r)));
|
|
}
|
|
};
|
|
$pkg.IndexRune = IndexRune;
|
|
IndexAny = function(s, chars) {
|
|
var _i, _i$1, _ref, _ref$1, _rune, _rune$1, _tuple, as, c, chars, i, i$1, isASCII, m, s;
|
|
if (chars === "") {
|
|
return -1;
|
|
}
|
|
if (s.length > 8) {
|
|
_tuple = makeASCIISet(chars);
|
|
as = $clone(_tuple[0], asciiSet);
|
|
isASCII = _tuple[1];
|
|
if (isASCII) {
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (new ptrType$5(as).contains(s.charCodeAt(i))) {
|
|
return i;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return -1;
|
|
}
|
|
}
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i$1 = _i;
|
|
c = _rune[0];
|
|
_ref$1 = chars;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.length)) { break; }
|
|
_rune$1 = $decodeRune(_ref$1, _i$1);
|
|
m = _rune$1[0];
|
|
if (c === m) {
|
|
return i$1;
|
|
}
|
|
_i$1 += _rune$1[1];
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.IndexAny = IndexAny;
|
|
LastIndexByte = function(s, c) {
|
|
var c, i, s;
|
|
i = s.length - 1 >> 0;
|
|
while (true) {
|
|
if (!(i >= 0)) { break; }
|
|
if (s.charCodeAt(i) === c) {
|
|
return i;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
return -1;
|
|
};
|
|
$pkg.LastIndexByte = LastIndexByte;
|
|
genSplit = function(s, sep, sepSave, n) {
|
|
var a, i, m, n, s, sep, sepSave;
|
|
if (n === 0) {
|
|
return sliceType$1.nil;
|
|
}
|
|
if (sep === "") {
|
|
return explode(s, n);
|
|
}
|
|
if (n < 0) {
|
|
n = Count(s, sep) + 1 >> 0;
|
|
}
|
|
a = $makeSlice(sliceType$1, n);
|
|
n = n - (1) >> 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < n)) { break; }
|
|
m = Index(s, sep);
|
|
if (m < 0) {
|
|
break;
|
|
}
|
|
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = $substring(s, 0, (m + sepSave >> 0)));
|
|
s = $substring(s, (m + sep.length >> 0));
|
|
i = i + (1) >> 0;
|
|
}
|
|
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = s);
|
|
return $subslice(a, 0, (i + 1 >> 0));
|
|
};
|
|
SplitN = function(s, sep, n) {
|
|
var n, s, sep;
|
|
return genSplit(s, sep, 0, n);
|
|
};
|
|
$pkg.SplitN = SplitN;
|
|
Split = function(s, sep) {
|
|
var s, sep;
|
|
return genSplit(s, sep, 0, -1);
|
|
};
|
|
$pkg.Split = Split;
|
|
Join = function(a, sep) {
|
|
var _1, _i, _ref, a, b, i, n, s, sep;
|
|
_1 = a.$length;
|
|
if (_1 === (0)) {
|
|
return "";
|
|
} else if (_1 === (1)) {
|
|
return (0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]);
|
|
}
|
|
n = $imul(sep.length, ((a.$length - 1 >> 0)));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < a.$length)) { break; }
|
|
n = n + (((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i]).length) >> 0;
|
|
i = i + (1) >> 0;
|
|
}
|
|
b = new Builder.ptr(ptrType.nil, sliceType.nil);
|
|
b.Grow(n);
|
|
b.WriteString((0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]));
|
|
_ref = $subslice(a, 1);
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
s = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
b.WriteString(sep);
|
|
b.WriteString(s);
|
|
_i++;
|
|
}
|
|
return b.String();
|
|
};
|
|
$pkg.Join = Join;
|
|
HasPrefix = function(s, prefix) {
|
|
var prefix, s;
|
|
return s.length >= prefix.length && $substring(s, 0, prefix.length) === prefix;
|
|
};
|
|
$pkg.HasPrefix = HasPrefix;
|
|
HasSuffix = function(s, suffix) {
|
|
var s, suffix;
|
|
return s.length >= suffix.length && $substring(s, (s.length - suffix.length >> 0)) === suffix;
|
|
};
|
|
$pkg.HasSuffix = HasSuffix;
|
|
Map = function(mapping, s) {
|
|
var _i, _i$1, _r, _r$1, _ref, _ref$1, _rune, _rune$1, _tuple, b, c, c$1, i, mapping, r, r$1, s, width, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _rune = $f._rune; _rune$1 = $f._rune$1; _tuple = $f._tuple; b = $f.b; c = $f.c; c$1 = $f.c$1; i = $f.i; mapping = $f.mapping; r = $f.r; r$1 = $f.r$1; s = $f.s; width = $f.width; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = new Builder.ptr(ptrType.nil, sliceType.nil);
|
|
_ref = s;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.length)) { break; } */ if(!(_i < _ref.length)) { $s = 2; continue; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
i = _i;
|
|
c = _rune[0];
|
|
_r = mapping(c); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
r = _r;
|
|
if ((r === c) && !((c === 65533))) {
|
|
_i += _rune[1];
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
width = 0;
|
|
if (c === 65533) {
|
|
_tuple = utf8.DecodeRuneInString($substring(s, i));
|
|
c = _tuple[0];
|
|
width = _tuple[1];
|
|
if (!((width === 1)) && (r === c)) {
|
|
_i += _rune[1];
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
} else {
|
|
width = utf8.RuneLen(c);
|
|
}
|
|
b.Grow(s.length + 4 >> 0);
|
|
b.WriteString($substring(s, 0, i));
|
|
if (r >= 0) {
|
|
b.WriteRune(r);
|
|
}
|
|
s = $substring(s, (i + width >> 0));
|
|
/* break; */ $s = 2; continue;
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (b.Cap() === 0) {
|
|
$s = -1; return s;
|
|
}
|
|
_ref$1 = s;
|
|
_i$1 = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i$1 < _ref$1.length)) { break; } */ if(!(_i$1 < _ref$1.length)) { $s = 5; continue; }
|
|
_rune$1 = $decodeRune(_ref$1, _i$1);
|
|
c$1 = _rune$1[0];
|
|
_r$1 = mapping(c$1); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
r$1 = _r$1;
|
|
if (r$1 >= 0) {
|
|
if (r$1 < 128) {
|
|
b.WriteByte(((r$1 << 24 >>> 24)));
|
|
} else {
|
|
b.WriteRune(r$1);
|
|
}
|
|
}
|
|
_i$1 += _rune$1[1];
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return b.String();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Map }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._rune = _rune; $f._rune$1 = _rune$1; $f._tuple = _tuple; $f.b = b; $f.c = c; $f.c$1 = c$1; $f.i = i; $f.mapping = mapping; $f.r = r; $f.r$1 = r$1; $f.s = s; $f.width = width; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Map = Map;
|
|
ToLower = function(s) {
|
|
var _r, _tmp, _tmp$1, b, c, c$1, hasUpper, i, i$1, isASCII, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; b = $f.b; c = $f.c; c$1 = $f.c$1; hasUpper = $f.hasUpper; i = $f.i; i$1 = $f.i$1; isASCII = $f.isASCII; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tmp = true;
|
|
_tmp$1 = false;
|
|
isASCII = _tmp;
|
|
hasUpper = _tmp$1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
c = s.charCodeAt(i);
|
|
if (c >= 128) {
|
|
isASCII = false;
|
|
break;
|
|
}
|
|
hasUpper = hasUpper || (c >= 65 && c <= 90);
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (isASCII) {
|
|
if (!hasUpper) {
|
|
$s = -1; return s;
|
|
}
|
|
b = new Builder.ptr(ptrType.nil, sliceType.nil);
|
|
b.Grow(s.length);
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < s.length)) { break; }
|
|
c$1 = s.charCodeAt(i$1);
|
|
if (c$1 >= 65 && c$1 <= 90) {
|
|
c$1 = c$1 + (32) << 24 >>> 24;
|
|
}
|
|
b.WriteByte(c$1);
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
$s = -1; return b.String();
|
|
}
|
|
_r = Map(unicode.ToLower, s); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ToLower }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.b = b; $f.c = c; $f.c$1 = c$1; $f.hasUpper = hasUpper; $f.i = i; $f.i$1 = i$1; $f.isASCII = isASCII; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.ToLower = ToLower;
|
|
makeASCIISet = function(chars) {
|
|
var _index, _tmp, _tmp$1, _tmp$2, _tmp$3, as, c, chars, i, ok, y;
|
|
as = arrayType$3.zero();
|
|
ok = false;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < chars.length)) { break; }
|
|
c = chars.charCodeAt(i);
|
|
if (c >= 128) {
|
|
_tmp = $clone(as, asciiSet);
|
|
_tmp$1 = false;
|
|
asciiSet.copy(as, _tmp);
|
|
ok = _tmp$1;
|
|
return [as, ok];
|
|
}
|
|
_index = c >>> 5 << 24 >>> 24;
|
|
((_index < 0 || _index >= as.length) ? ($throwRuntimeError("index out of range"), undefined) : as[_index] = ((((_index < 0 || _index >= as.length) ? ($throwRuntimeError("index out of range"), undefined) : as[_index]) | (((y = ((((c & 31) >>> 0) >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0));
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$2 = $clone(as, asciiSet);
|
|
_tmp$3 = true;
|
|
asciiSet.copy(as, _tmp$2);
|
|
ok = _tmp$3;
|
|
return [as, ok];
|
|
};
|
|
asciiSet.prototype.contains = function(c) {
|
|
var as, c, x, y;
|
|
as = this.$val;
|
|
return !((((((x = c >>> 5 << 24 >>> 24, (as.nilCheck, ((x < 0 || x >= as.length) ? ($throwRuntimeError("index out of range"), undefined) : as[x]))) & (((y = ((((c & 31) >>> 0) >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0)) === 0));
|
|
};
|
|
$ptrType(asciiSet).prototype.contains = function(c) { return (new asciiSet(this.$get())).contains(c); };
|
|
TrimPrefix = function(s, prefix) {
|
|
var prefix, s;
|
|
if (HasPrefix(s, prefix)) {
|
|
return $substring(s, prefix.length);
|
|
}
|
|
return s;
|
|
};
|
|
$pkg.TrimPrefix = TrimPrefix;
|
|
ptrType.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "copyCheck", name: "copyCheck", pkg: "strings", typ: $funcType([], [], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Cap", name: "Cap", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Reset", name: "Reset", pkg: "", typ: $funcType([], [], false)}, {prop: "grow", name: "grow", pkg: "strings", typ: $funcType([$Int], [], false)}, {prop: "Grow", name: "Grow", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}, {prop: "WriteByte", name: "WriteByte", pkg: "", typ: $funcType([$Uint8], [$error], false)}, {prop: "WriteRune", name: "WriteRune", pkg: "", typ: $funcType([$Int32], [$Int, $error], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [$Int, $error], false)}];
|
|
ptrType$5.methods = [{prop: "contains", name: "contains", pkg: "strings", typ: $funcType([$Uint8], [$Bool], false)}];
|
|
Builder.init("strings", [{prop: "addr", name: "addr", embedded: false, exported: false, typ: ptrType, tag: ""}, {prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType, tag: ""}]);
|
|
asciiSet.init($Uint32, 8);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bytealg.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unicode.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["regexp/syntax"] = (function() {
|
|
var $pkg = {}, $init, sort, strconv, strings, unicode, utf8, patchList, frag, compiler, Error, ErrorCode, Flags, parser, charGroup, ranges, Prog, InstOp, EmptyOp, Inst, Regexp, Op, sliceType, sliceType$1, sliceType$2, sliceType$3, ptrType, sliceType$4, ptrType$1, sliceType$5, arrayType, arrayType$1, ptrType$2, ptrType$3, ptrType$4, sliceType$6, ptrType$5, ptrType$6, ptrType$7, ptrType$8, anyRuneNotNL, anyRune, _Op_index_0, anyTable, code1, code2, code3, perlGroup, code4, code5, code6, code7, code8, code9, code10, code11, code12, code13, code14, code15, code16, code17, posixGroup, instOpNames, Compile, minFoldRune, repeatIsValid, cleanAlt, literalRegexp, Parse, isValidCaptureName, isCharClass, matchRune, mergeCharClass, unicodeTable, cleanClass, appendLiteral, appendRange, appendFoldedRange, appendClass, appendFoldedClass, appendNegatedClass, appendTable, appendNegatedTable, negateClass, checkUTF8, nextRune, isalnum, unhex, IsWordChar, bw, dumpProg, u32, dumpInst, writeRegexp, escape, simplify1;
|
|
sort = $packages["sort"];
|
|
strconv = $packages["strconv"];
|
|
strings = $packages["strings"];
|
|
unicode = $packages["unicode"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
patchList = $pkg.patchList = $newType(4, $kindUint32, "syntax.patchList", true, "regexp/syntax", false, null);
|
|
frag = $pkg.frag = $newType(0, $kindStruct, "syntax.frag", true, "regexp/syntax", false, function(i_, out_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.i = 0;
|
|
this.out = 0;
|
|
return;
|
|
}
|
|
this.i = i_;
|
|
this.out = out_;
|
|
});
|
|
compiler = $pkg.compiler = $newType(0, $kindStruct, "syntax.compiler", true, "regexp/syntax", false, function(p_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.p = ptrType.nil;
|
|
return;
|
|
}
|
|
this.p = p_;
|
|
});
|
|
Error = $pkg.Error = $newType(0, $kindStruct, "syntax.Error", true, "regexp/syntax", true, function(Code_, Expr_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Code = "";
|
|
this.Expr = "";
|
|
return;
|
|
}
|
|
this.Code = Code_;
|
|
this.Expr = Expr_;
|
|
});
|
|
ErrorCode = $pkg.ErrorCode = $newType(8, $kindString, "syntax.ErrorCode", true, "regexp/syntax", true, null);
|
|
Flags = $pkg.Flags = $newType(2, $kindUint16, "syntax.Flags", true, "regexp/syntax", true, null);
|
|
parser = $pkg.parser = $newType(0, $kindStruct, "syntax.parser", true, "regexp/syntax", false, function(flags_, stack_, free_, numCap_, wholeRegexp_, tmpClass_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.flags = 0;
|
|
this.stack = sliceType$5.nil;
|
|
this.free = ptrType$1.nil;
|
|
this.numCap = 0;
|
|
this.wholeRegexp = "";
|
|
this.tmpClass = sliceType.nil;
|
|
return;
|
|
}
|
|
this.flags = flags_;
|
|
this.stack = stack_;
|
|
this.free = free_;
|
|
this.numCap = numCap_;
|
|
this.wholeRegexp = wholeRegexp_;
|
|
this.tmpClass = tmpClass_;
|
|
});
|
|
charGroup = $pkg.charGroup = $newType(0, $kindStruct, "syntax.charGroup", true, "regexp/syntax", false, function(sign_, class$1_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.sign = 0;
|
|
this.class$1 = sliceType.nil;
|
|
return;
|
|
}
|
|
this.sign = sign_;
|
|
this.class$1 = class$1_;
|
|
});
|
|
ranges = $pkg.ranges = $newType(0, $kindStruct, "syntax.ranges", true, "regexp/syntax", false, function(p_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.p = ptrType$2.nil;
|
|
return;
|
|
}
|
|
this.p = p_;
|
|
});
|
|
Prog = $pkg.Prog = $newType(0, $kindStruct, "syntax.Prog", true, "regexp/syntax", true, function(Inst_, Start_, NumCap_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Inst = sliceType$4.nil;
|
|
this.Start = 0;
|
|
this.NumCap = 0;
|
|
return;
|
|
}
|
|
this.Inst = Inst_;
|
|
this.Start = Start_;
|
|
this.NumCap = NumCap_;
|
|
});
|
|
InstOp = $pkg.InstOp = $newType(1, $kindUint8, "syntax.InstOp", true, "regexp/syntax", true, null);
|
|
EmptyOp = $pkg.EmptyOp = $newType(1, $kindUint8, "syntax.EmptyOp", true, "regexp/syntax", true, null);
|
|
Inst = $pkg.Inst = $newType(0, $kindStruct, "syntax.Inst", true, "regexp/syntax", true, function(Op_, Out_, Arg_, Rune_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = 0;
|
|
this.Out = 0;
|
|
this.Arg = 0;
|
|
this.Rune = sliceType.nil;
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.Out = Out_;
|
|
this.Arg = Arg_;
|
|
this.Rune = Rune_;
|
|
});
|
|
Regexp = $pkg.Regexp = $newType(0, $kindStruct, "syntax.Regexp", true, "regexp/syntax", true, function(Op_, Flags_, Sub_, Sub0_, Rune_, Rune0_, Min_, Max_, Cap_, Name_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = 0;
|
|
this.Flags = 0;
|
|
this.Sub = sliceType$5.nil;
|
|
this.Sub0 = arrayType.zero();
|
|
this.Rune = sliceType.nil;
|
|
this.Rune0 = arrayType$1.zero();
|
|
this.Min = 0;
|
|
this.Max = 0;
|
|
this.Cap = 0;
|
|
this.Name = "";
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.Flags = Flags_;
|
|
this.Sub = Sub_;
|
|
this.Sub0 = Sub0_;
|
|
this.Rune = Rune_;
|
|
this.Rune0 = Rune0_;
|
|
this.Min = Min_;
|
|
this.Max = Max_;
|
|
this.Cap = Cap_;
|
|
this.Name = Name_;
|
|
});
|
|
Op = $pkg.Op = $newType(1, $kindUint8, "syntax.Op", true, "regexp/syntax", true, null);
|
|
sliceType = $sliceType($Int32);
|
|
sliceType$1 = $sliceType(unicode.Range16);
|
|
sliceType$2 = $sliceType(unicode.Range32);
|
|
sliceType$3 = $sliceType($String);
|
|
ptrType = $ptrType(Prog);
|
|
sliceType$4 = $sliceType(Inst);
|
|
ptrType$1 = $ptrType(Regexp);
|
|
sliceType$5 = $sliceType(ptrType$1);
|
|
arrayType = $arrayType(ptrType$1, 1);
|
|
arrayType$1 = $arrayType($Int32, 2);
|
|
ptrType$2 = $ptrType(sliceType);
|
|
ptrType$3 = $ptrType(unicode.RangeTable);
|
|
ptrType$4 = $ptrType(strings.Builder);
|
|
sliceType$6 = $sliceType($Uint8);
|
|
ptrType$5 = $ptrType(compiler);
|
|
ptrType$6 = $ptrType(Error);
|
|
ptrType$7 = $ptrType(parser);
|
|
ptrType$8 = $ptrType(Inst);
|
|
patchList.prototype.next = function(p) {
|
|
var i, l, p, x, x$1;
|
|
l = this.$val;
|
|
i = (x = p.Inst, x$1 = l >>> 1 >>> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (((l & 1) >>> 0) === 0) {
|
|
return ((i.Out >>> 0));
|
|
}
|
|
return ((i.Arg >>> 0));
|
|
};
|
|
$ptrType(patchList).prototype.next = function(p) { return new patchList(this.$get()).next(p); };
|
|
patchList.prototype.patch = function(p, val) {
|
|
var i, l, p, val, x, x$1;
|
|
l = this.$val;
|
|
while (true) {
|
|
if (!(!((l === 0)))) { break; }
|
|
i = (x = p.Inst, x$1 = l >>> 1 >>> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (((l & 1) >>> 0) === 0) {
|
|
l = ((i.Out >>> 0));
|
|
i.Out = val;
|
|
} else {
|
|
l = ((i.Arg >>> 0));
|
|
i.Arg = val;
|
|
}
|
|
}
|
|
};
|
|
$ptrType(patchList).prototype.patch = function(p, val) { return new patchList(this.$get()).patch(p, val); };
|
|
patchList.prototype.append = function(p, l2) {
|
|
var i, l1, l2, last, next, p, x, x$1;
|
|
l1 = this.$val;
|
|
if (l1 === 0) {
|
|
return l2;
|
|
}
|
|
if (l2 === 0) {
|
|
return l1;
|
|
}
|
|
last = l1;
|
|
while (true) {
|
|
next = new patchList(last).next(p);
|
|
if (next === 0) {
|
|
break;
|
|
}
|
|
last = next;
|
|
}
|
|
i = (x = p.Inst, x$1 = last >>> 1 >>> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (((last & 1) >>> 0) === 0) {
|
|
i.Out = ((l2 >>> 0));
|
|
} else {
|
|
i.Arg = ((l2 >>> 0));
|
|
}
|
|
return l1;
|
|
};
|
|
$ptrType(patchList).prototype.append = function(p, l2) { return new patchList(this.$get()).append(p, l2); };
|
|
Compile = function(re) {
|
|
var c, f, re;
|
|
c = new compiler.ptr(ptrType.nil);
|
|
c.init();
|
|
f = $clone(c.compile(re), frag);
|
|
new patchList(f.out).patch(c.p, c.inst(4).i);
|
|
c.p.Start = ((f.i >> 0));
|
|
return [c.p, $ifaceNil];
|
|
};
|
|
$pkg.Compile = Compile;
|
|
compiler.ptr.prototype.init = function() {
|
|
var c;
|
|
c = this;
|
|
c.p = new Prog.ptr(sliceType$4.nil, 0, 0);
|
|
c.p.NumCap = 2;
|
|
c.inst(5);
|
|
};
|
|
compiler.prototype.init = function() { return this.$val.init(); };
|
|
compiler.ptr.prototype.compile = function(re) {
|
|
var _1, _i, _i$1, _i$2, _ref, _ref$1, _ref$2, bra, c, f, f$1, f$2, f1, i, j, ket, re, sub, sub$1, sub$2, x, x$1, x$2, x$3;
|
|
c = this;
|
|
_1 = re.Op;
|
|
if (_1 === (1)) {
|
|
return c.fail();
|
|
} else if (_1 === (2)) {
|
|
return c.nop();
|
|
} else if (_1 === (3)) {
|
|
if (re.Rune.$length === 0) {
|
|
return c.nop();
|
|
}
|
|
f = new frag.ptr(0, 0);
|
|
_ref = re.Rune;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
j = _i;
|
|
f1 = $clone(c.rune($subslice(re.Rune, j, (j + 1 >> 0)), re.Flags), frag);
|
|
if (j === 0) {
|
|
frag.copy(f, f1);
|
|
} else {
|
|
frag.copy(f, c.cat($clone(f, frag), $clone(f1, frag)));
|
|
}
|
|
_i++;
|
|
}
|
|
return f;
|
|
} else if (_1 === (4)) {
|
|
return c.rune(re.Rune, re.Flags);
|
|
} else if (_1 === (5)) {
|
|
return c.rune(anyRuneNotNL, 0);
|
|
} else if (_1 === (6)) {
|
|
return c.rune(anyRune, 0);
|
|
} else if (_1 === (7)) {
|
|
return c.empty(1);
|
|
} else if (_1 === (8)) {
|
|
return c.empty(2);
|
|
} else if (_1 === (9)) {
|
|
return c.empty(4);
|
|
} else if (_1 === (10)) {
|
|
return c.empty(8);
|
|
} else if (_1 === (11)) {
|
|
return c.empty(16);
|
|
} else if (_1 === (12)) {
|
|
return c.empty(32);
|
|
} else if (_1 === (13)) {
|
|
bra = $clone(c.cap((((re.Cap << 1 >> 0) >>> 0))), frag);
|
|
sub = $clone(c.compile((x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]))), frag);
|
|
ket = $clone(c.cap(((((re.Cap << 1 >> 0) | 1) >>> 0))), frag);
|
|
return c.cat($clone(c.cat($clone(bra, frag), $clone(sub, frag)), frag), $clone(ket, frag));
|
|
} else if (_1 === (14)) {
|
|
return c.star($clone(c.compile((x$1 = re.Sub, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0]))), frag), !((((re.Flags & 32) >>> 0) === 0)));
|
|
} else if (_1 === (15)) {
|
|
return c.plus($clone(c.compile((x$2 = re.Sub, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0]))), frag), !((((re.Flags & 32) >>> 0) === 0)));
|
|
} else if (_1 === (16)) {
|
|
return c.quest($clone(c.compile((x$3 = re.Sub, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0]))), frag), !((((re.Flags & 32) >>> 0) === 0)));
|
|
} else if (_1 === (18)) {
|
|
if (re.Sub.$length === 0) {
|
|
return c.nop();
|
|
}
|
|
f$1 = new frag.ptr(0, 0);
|
|
_ref$1 = re.Sub;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i = _i$1;
|
|
sub$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
if (i === 0) {
|
|
frag.copy(f$1, c.compile(sub$1));
|
|
} else {
|
|
frag.copy(f$1, c.cat($clone(f$1, frag), $clone(c.compile(sub$1), frag)));
|
|
}
|
|
_i$1++;
|
|
}
|
|
return f$1;
|
|
} else if (_1 === (19)) {
|
|
f$2 = new frag.ptr(0, 0);
|
|
_ref$2 = re.Sub;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
sub$2 = ((_i$2 < 0 || _i$2 >= _ref$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$2.$array[_ref$2.$offset + _i$2]);
|
|
frag.copy(f$2, c.alt($clone(f$2, frag), $clone(c.compile(sub$2), frag)));
|
|
_i$2++;
|
|
}
|
|
return f$2;
|
|
}
|
|
$panic(new $String("regexp: unhandled case in compile"));
|
|
};
|
|
compiler.prototype.compile = function(re) { return this.$val.compile(re); };
|
|
compiler.ptr.prototype.inst = function(op) {
|
|
var c, f, op;
|
|
c = this;
|
|
f = new frag.ptr(((c.p.Inst.$length >>> 0)), 0);
|
|
c.p.Inst = $append(c.p.Inst, new Inst.ptr(op, 0, 0, sliceType.nil));
|
|
return f;
|
|
};
|
|
compiler.prototype.inst = function(op) { return this.$val.inst(op); };
|
|
compiler.ptr.prototype.nop = function() {
|
|
var c, f;
|
|
c = this;
|
|
f = $clone(c.inst(6), frag);
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
return f;
|
|
};
|
|
compiler.prototype.nop = function() { return this.$val.nop(); };
|
|
compiler.ptr.prototype.fail = function() {
|
|
var c;
|
|
c = this;
|
|
return new frag.ptr(0, 0);
|
|
};
|
|
compiler.prototype.fail = function() { return this.$val.fail(); };
|
|
compiler.ptr.prototype.cap = function(arg) {
|
|
var arg, c, f, x, x$1;
|
|
c = this;
|
|
f = $clone(c.inst(2), frag);
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
(x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Arg = arg;
|
|
if (c.p.NumCap < (((arg >> 0)) + 1 >> 0)) {
|
|
c.p.NumCap = ((arg >> 0)) + 1 >> 0;
|
|
}
|
|
return f;
|
|
};
|
|
compiler.prototype.cap = function(arg) { return this.$val.cap(arg); };
|
|
compiler.ptr.prototype.cat = function(f1, f2) {
|
|
var c, f1, f2;
|
|
c = this;
|
|
if ((f1.i === 0) || (f2.i === 0)) {
|
|
return new frag.ptr(0, 0);
|
|
}
|
|
new patchList(f1.out).patch(c.p, f2.i);
|
|
return new frag.ptr(f1.i, f2.out);
|
|
};
|
|
compiler.prototype.cat = function(f1, f2) { return this.$val.cat(f1, f2); };
|
|
compiler.ptr.prototype.alt = function(f1, f2) {
|
|
var c, f, f1, f2, i, x, x$1;
|
|
c = this;
|
|
if (f1.i === 0) {
|
|
return f2;
|
|
}
|
|
if (f2.i === 0) {
|
|
return f1;
|
|
}
|
|
f = $clone(c.inst(0), frag);
|
|
i = (x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
i.Out = f1.i;
|
|
i.Arg = f2.i;
|
|
f.out = new patchList(f1.out).append(c.p, f2.out);
|
|
return f;
|
|
};
|
|
compiler.prototype.alt = function(f1, f2) { return this.$val.alt(f1, f2); };
|
|
compiler.ptr.prototype.quest = function(f1, nongreedy) {
|
|
var c, f, f1, i, nongreedy, x, x$1;
|
|
c = this;
|
|
f = $clone(c.inst(0), frag);
|
|
i = (x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (nongreedy) {
|
|
i.Arg = f1.i;
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
} else {
|
|
i.Out = f1.i;
|
|
f.out = (((((f.i << 1 >>> 0) | 1) >>> 0) >>> 0));
|
|
}
|
|
f.out = new patchList(f.out).append(c.p, f1.out);
|
|
return f;
|
|
};
|
|
compiler.prototype.quest = function(f1, nongreedy) { return this.$val.quest(f1, nongreedy); };
|
|
compiler.ptr.prototype.star = function(f1, nongreedy) {
|
|
var c, f, f1, i, nongreedy, x, x$1;
|
|
c = this;
|
|
f = $clone(c.inst(0), frag);
|
|
i = (x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (nongreedy) {
|
|
i.Arg = f1.i;
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
} else {
|
|
i.Out = f1.i;
|
|
f.out = (((((f.i << 1 >>> 0) | 1) >>> 0) >>> 0));
|
|
}
|
|
new patchList(f1.out).patch(c.p, f.i);
|
|
return f;
|
|
};
|
|
compiler.prototype.star = function(f1, nongreedy) { return this.$val.star(f1, nongreedy); };
|
|
compiler.ptr.prototype.plus = function(f1, nongreedy) {
|
|
var c, f1, nongreedy;
|
|
c = this;
|
|
return new frag.ptr(f1.i, c.star($clone(f1, frag), nongreedy).out);
|
|
};
|
|
compiler.prototype.plus = function(f1, nongreedy) { return this.$val.plus(f1, nongreedy); };
|
|
compiler.ptr.prototype.empty = function(op) {
|
|
var c, f, op, x, x$1;
|
|
c = this;
|
|
f = $clone(c.inst(3), frag);
|
|
(x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Arg = ((op >>> 0));
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
return f;
|
|
};
|
|
compiler.prototype.empty = function(op) { return this.$val.empty(op); };
|
|
compiler.ptr.prototype.rune = function(r, flags) {
|
|
var c, f, flags, i, r, x, x$1;
|
|
c = this;
|
|
f = $clone(c.inst(7), frag);
|
|
i = (x = c.p.Inst, x$1 = f.i, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
i.Rune = r;
|
|
flags = (flags & (1)) >>> 0;
|
|
if (!((r.$length === 1)) || (unicode.SimpleFold((0 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 0])) === (0 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 0]))) {
|
|
flags = (flags & ~(1)) << 16 >>> 16;
|
|
}
|
|
i.Arg = ((flags >>> 0));
|
|
f.out = (((f.i << 1 >>> 0) >>> 0));
|
|
if ((((flags & 1) >>> 0) === 0) && ((r.$length === 1) || (r.$length === 2) && ((0 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 0]) === (1 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 1])))) {
|
|
i.Op = 8;
|
|
} else if ((r.$length === 2) && ((0 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 0]) === 0) && ((1 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 1]) === 1114111)) {
|
|
i.Op = 9;
|
|
} else if ((r.$length === 4) && ((0 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 0]) === 0) && ((1 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 1]) === 9) && ((2 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 2]) === 11) && ((3 >= r.$length ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + 3]) === 1114111)) {
|
|
i.Op = 10;
|
|
}
|
|
return f;
|
|
};
|
|
compiler.prototype.rune = function(r, flags) { return this.$val.rune(r, flags); };
|
|
Op.prototype.String = function() {
|
|
var i, x;
|
|
i = this.$val;
|
|
if (1 <= i && i <= 19) {
|
|
i = i - (1) << 24 >>> 24;
|
|
return $substring("NoMatchEmptyMatchLiteralCharClassAnyCharNotNLAnyCharBeginLineEndLineBeginTextEndTextWordBoundaryNoWordBoundaryCaptureStarPlusQuestRepeatConcatAlternate", ((i < 0 || i >= _Op_index_0.length) ? ($throwRuntimeError("index out of range"), undefined) : _Op_index_0[i]), (x = i + 1 << 24 >>> 24, ((x < 0 || x >= _Op_index_0.length) ? ($throwRuntimeError("index out of range"), undefined) : _Op_index_0[x])));
|
|
} else if ((i === 128)) {
|
|
return "opPseudo";
|
|
} else {
|
|
return "Op(" + strconv.FormatInt((new $Int64(0, i)), 10) + ")";
|
|
}
|
|
};
|
|
$ptrType(Op).prototype.String = function() { return new Op(this.$get()).String(); };
|
|
Error.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
return "error parsing regexp: " + new ErrorCode(e.Code).String() + ": `" + e.Expr + "`";
|
|
};
|
|
Error.prototype.Error = function() { return this.$val.Error(); };
|
|
ErrorCode.prototype.String = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return (e);
|
|
};
|
|
$ptrType(ErrorCode).prototype.String = function() { return new ErrorCode(this.$get()).String(); };
|
|
parser.ptr.prototype.newRegexp = function(op) {
|
|
var op, p, re;
|
|
p = this;
|
|
re = p.free;
|
|
if (!(re === ptrType$1.nil)) {
|
|
p.free = re.Sub0[0];
|
|
Regexp.copy(re, new Regexp.ptr(0, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, ""));
|
|
} else {
|
|
re = new Regexp.ptr(0, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
}
|
|
re.Op = op;
|
|
return re;
|
|
};
|
|
parser.prototype.newRegexp = function(op) { return this.$val.newRegexp(op); };
|
|
parser.ptr.prototype.reuse = function(re) {
|
|
var p, re;
|
|
p = this;
|
|
re.Sub0[0] = p.free;
|
|
p.free = re;
|
|
};
|
|
parser.prototype.reuse = function(re) { return this.$val.reuse(re); };
|
|
parser.ptr.prototype.push = function(re) {
|
|
var p, re, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
p = this;
|
|
if ((re.Op === 4) && (re.Rune.$length === 2) && ((x = re.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])) === (x$1 = re.Rune, (1 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 1])))) {
|
|
if (p.maybeConcat((x$16 = re.Rune, (0 >= x$16.$length ? ($throwRuntimeError("index out of range"), undefined) : x$16.$array[x$16.$offset + 0])), (p.flags & ~1) << 16 >>> 16)) {
|
|
return ptrType$1.nil;
|
|
}
|
|
re.Op = 3;
|
|
re.Rune = $subslice(re.Rune, 0, 1);
|
|
re.Flags = (p.flags & ~1) << 16 >>> 16;
|
|
} else if ((re.Op === 4) && (re.Rune.$length === 4) && ((x$2 = re.Rune, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0])) === (x$3 = re.Rune, (1 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 1]))) && ((x$4 = re.Rune, (2 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 2])) === (x$5 = re.Rune, (3 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 3]))) && (unicode.SimpleFold((x$6 = re.Rune, (0 >= x$6.$length ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + 0]))) === (x$7 = re.Rune, (2 >= x$7.$length ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + 2]))) && (unicode.SimpleFold((x$8 = re.Rune, (2 >= x$8.$length ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + 2]))) === (x$9 = re.Rune, (0 >= x$9.$length ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + 0]))) || (re.Op === 4) && (re.Rune.$length === 2) && (((x$10 = re.Rune, (0 >= x$10.$length ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + 0])) + 1 >> 0) === (x$11 = re.Rune, (1 >= x$11.$length ? ($throwRuntimeError("index out of range"), undefined) : x$11.$array[x$11.$offset + 1]))) && (unicode.SimpleFold((x$12 = re.Rune, (0 >= x$12.$length ? ($throwRuntimeError("index out of range"), undefined) : x$12.$array[x$12.$offset + 0]))) === (x$13 = re.Rune, (1 >= x$13.$length ? ($throwRuntimeError("index out of range"), undefined) : x$13.$array[x$13.$offset + 1]))) && (unicode.SimpleFold((x$14 = re.Rune, (1 >= x$14.$length ? ($throwRuntimeError("index out of range"), undefined) : x$14.$array[x$14.$offset + 1]))) === (x$15 = re.Rune, (0 >= x$15.$length ? ($throwRuntimeError("index out of range"), undefined) : x$15.$array[x$15.$offset + 0])))) {
|
|
if (p.maybeConcat((x$17 = re.Rune, (0 >= x$17.$length ? ($throwRuntimeError("index out of range"), undefined) : x$17.$array[x$17.$offset + 0])), (p.flags | 1) >>> 0)) {
|
|
return ptrType$1.nil;
|
|
}
|
|
re.Op = 3;
|
|
re.Rune = $subslice(re.Rune, 0, 1);
|
|
re.Flags = (p.flags | 1) >>> 0;
|
|
} else {
|
|
p.maybeConcat(-1, 0);
|
|
}
|
|
p.stack = $append(p.stack, re);
|
|
return re;
|
|
};
|
|
parser.prototype.push = function(re) { return this.$val.push(re); };
|
|
parser.ptr.prototype.maybeConcat = function(r, flags) {
|
|
var flags, n, p, r, re1, re2, x, x$1, x$2, x$3, x$4;
|
|
p = this;
|
|
n = p.stack.$length;
|
|
if (n < 2) {
|
|
return false;
|
|
}
|
|
re1 = (x = p.stack, x$1 = n - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
re2 = (x$2 = p.stack, x$3 = n - 2 >> 0, ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3]));
|
|
if (!((re1.Op === 3)) || !((re2.Op === 3)) || !((((re1.Flags & 1) >>> 0) === ((re2.Flags & 1) >>> 0)))) {
|
|
return false;
|
|
}
|
|
re2.Rune = $appendSlice(re2.Rune, re1.Rune);
|
|
if (r >= 0) {
|
|
re1.Rune = $subslice(new sliceType(re1.Rune0), 0, 1);
|
|
(x$4 = re1.Rune, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0] = r));
|
|
re1.Flags = flags;
|
|
return true;
|
|
}
|
|
p.stack = $subslice(p.stack, 0, (n - 1 >> 0));
|
|
p.reuse(re1);
|
|
return false;
|
|
};
|
|
parser.prototype.maybeConcat = function(r, flags) { return this.$val.maybeConcat(r, flags); };
|
|
parser.ptr.prototype.newLiteral = function(r, flags) {
|
|
var flags, p, r, re;
|
|
p = this;
|
|
re = p.newRegexp(3);
|
|
re.Flags = flags;
|
|
if (!((((flags & 1) >>> 0) === 0))) {
|
|
r = minFoldRune(r);
|
|
}
|
|
re.Rune0[0] = r;
|
|
re.Rune = $subslice(new sliceType(re.Rune0), 0, 1);
|
|
return re;
|
|
};
|
|
parser.prototype.newLiteral = function(r, flags) { return this.$val.newLiteral(r, flags); };
|
|
minFoldRune = function(r) {
|
|
var min, r, r0;
|
|
if (r < 65 || r > 125251) {
|
|
return r;
|
|
}
|
|
min = r;
|
|
r0 = r;
|
|
r = unicode.SimpleFold(r);
|
|
while (true) {
|
|
if (!(!((r === r0)))) { break; }
|
|
if (min > r) {
|
|
min = r;
|
|
}
|
|
r = unicode.SimpleFold(r);
|
|
}
|
|
return min;
|
|
};
|
|
parser.ptr.prototype.literal = function(r) {
|
|
var p, r;
|
|
p = this;
|
|
p.push(p.newLiteral(r, p.flags));
|
|
};
|
|
parser.prototype.literal = function(r) { return this.$val.literal(r); };
|
|
parser.ptr.prototype.op = function(op) {
|
|
var op, p, re;
|
|
p = this;
|
|
re = p.newRegexp(op);
|
|
re.Flags = p.flags;
|
|
return p.push(re);
|
|
};
|
|
parser.prototype.op = function(op) { return this.$val.op(op); };
|
|
parser.ptr.prototype.repeat = function(op, min, max, before, after, lastRepeat) {
|
|
var after, before, flags, lastRepeat, max, min, n, op, p, re, sub, x, x$1, x$2, x$3, x$4;
|
|
p = this;
|
|
flags = p.flags;
|
|
if (!((((p.flags & 64) >>> 0) === 0))) {
|
|
if (after.length > 0 && (after.charCodeAt(0) === 63)) {
|
|
after = $substring(after, 1);
|
|
flags = (flags ^ (32)) << 16 >>> 16;
|
|
}
|
|
if (!(lastRepeat === "")) {
|
|
return ["", new Error.ptr("invalid nested repetition operator", $substring(lastRepeat, 0, (lastRepeat.length - after.length >> 0)))];
|
|
}
|
|
}
|
|
n = p.stack.$length;
|
|
if (n === 0) {
|
|
return ["", new Error.ptr("missing argument to repetition operator", $substring(before, 0, (before.length - after.length >> 0)))];
|
|
}
|
|
sub = (x = p.stack, x$1 = n - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (sub.Op >= 128) {
|
|
return ["", new Error.ptr("missing argument to repetition operator", $substring(before, 0, (before.length - after.length >> 0)))];
|
|
}
|
|
re = p.newRegexp(op);
|
|
re.Min = min;
|
|
re.Max = max;
|
|
re.Flags = flags;
|
|
re.Sub = $subslice(new sliceType$5(re.Sub0), 0, 1);
|
|
(x$2 = re.Sub, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0] = sub));
|
|
(x$3 = p.stack, x$4 = n - 1 >> 0, ((x$4 < 0 || x$4 >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + x$4] = re));
|
|
if ((op === 17) && (min >= 2 || max >= 2) && !repeatIsValid(re, 1000)) {
|
|
return ["", new Error.ptr("invalid repeat count", $substring(before, 0, (before.length - after.length >> 0)))];
|
|
}
|
|
return [after, $ifaceNil];
|
|
};
|
|
parser.prototype.repeat = function(op, min, max, before, after, lastRepeat) { return this.$val.repeat(op, min, max, before, after, lastRepeat); };
|
|
repeatIsValid = function(re, n) {
|
|
var _i, _q, _ref, m, n, re, sub;
|
|
if (re.Op === 17) {
|
|
m = re.Max;
|
|
if (m === 0) {
|
|
return true;
|
|
}
|
|
if (m < 0) {
|
|
m = re.Min;
|
|
}
|
|
if (m > n) {
|
|
return false;
|
|
}
|
|
if (m > 0) {
|
|
n = (_q = n / (m), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
}
|
|
}
|
|
_ref = re.Sub;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
sub = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!repeatIsValid(sub, n)) {
|
|
return false;
|
|
}
|
|
_i++;
|
|
}
|
|
return true;
|
|
};
|
|
parser.ptr.prototype.concat = function() {
|
|
var _r, _r$1, i, p, subs, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; i = $f.i; p = $f.p; subs = $f.subs; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
p.maybeConcat(-1, 0);
|
|
i = p.stack.$length;
|
|
while (true) {
|
|
if (!(i > 0 && (x = p.stack, x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Op < 128)) { break; }
|
|
i = i - (1) >> 0;
|
|
}
|
|
subs = $subslice(p.stack, i);
|
|
p.stack = $subslice(p.stack, 0, i);
|
|
if (subs.$length === 0) {
|
|
$s = -1; return p.push(p.newRegexp(2));
|
|
}
|
|
_r = p.collapse(subs, 18); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = p.push(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.concat }; } $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.p = p; $f.subs = subs; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.concat = function() { return this.$val.concat(); };
|
|
parser.ptr.prototype.alternate = function() {
|
|
var _r, _r$1, i, p, subs, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; i = $f.i; p = $f.p; subs = $f.subs; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
i = p.stack.$length;
|
|
while (true) {
|
|
if (!(i > 0 && (x = p.stack, x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Op < 128)) { break; }
|
|
i = i - (1) >> 0;
|
|
}
|
|
subs = $subslice(p.stack, i);
|
|
p.stack = $subslice(p.stack, 0, i);
|
|
/* */ if (subs.$length > 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (subs.$length > 0) { */ case 1:
|
|
$r = cleanAlt((x$2 = subs.$length - 1 >> 0, ((x$2 < 0 || x$2 >= subs.$length) ? ($throwRuntimeError("index out of range"), undefined) : subs.$array[subs.$offset + x$2]))); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 2:
|
|
if (subs.$length === 0) {
|
|
$s = -1; return p.push(p.newRegexp(1));
|
|
}
|
|
_r = p.collapse(subs, 19); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = p.push(_r); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.alternate }; } $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.p = p; $f.subs = subs; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.alternate = function() { return this.$val.alternate(); };
|
|
cleanAlt = function(re) {
|
|
var _1, _r, re, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; re = $f.re; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_1 = re.Op;
|
|
/* */ if (_1 === (4)) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (_1 === (4)) { */ case 2:
|
|
_r = cleanClass((re.$ptr_Rune || (re.$ptr_Rune = new ptrType$2(function() { return this.$target.Rune; }, function($v) { this.$target.Rune = $v; }, re)))); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
re.Rune = _r;
|
|
if ((re.Rune.$length === 2) && ((x = re.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])) === 0) && ((x$1 = re.Rune, (1 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 1])) === 1114111)) {
|
|
re.Rune = sliceType.nil;
|
|
re.Op = 6;
|
|
$s = -1; return;
|
|
}
|
|
if ((re.Rune.$length === 4) && ((x$2 = re.Rune, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0])) === 0) && ((x$3 = re.Rune, (1 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 1])) === 9) && ((x$4 = re.Rune, (2 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 2])) === 11) && ((x$5 = re.Rune, (3 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 3])) === 1114111)) {
|
|
re.Rune = sliceType.nil;
|
|
re.Op = 5;
|
|
$s = -1; return;
|
|
}
|
|
if ((re.Rune.$capacity - re.Rune.$length >> 0) > 100) {
|
|
re.Rune = $appendSlice($subslice(new sliceType(re.Rune0), 0, 0), re.Rune);
|
|
}
|
|
/* } */ case 3:
|
|
case 1:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cleanAlt }; } $f._1 = _1; $f._r = _r; $f.re = re; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.ptr.prototype.collapse = function(subs, op) {
|
|
var _i, _r, _ref, old, op, p, re, sub, subs, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; old = $f.old; op = $f.op; p = $f.p; re = $f.re; sub = $f.sub; subs = $f.subs; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
if (subs.$length === 1) {
|
|
$s = -1; return (0 >= subs.$length ? ($throwRuntimeError("index out of range"), undefined) : subs.$array[subs.$offset + 0]);
|
|
}
|
|
re = p.newRegexp(op);
|
|
re.Sub = $subslice(new sliceType$5(re.Sub0), 0, 0);
|
|
_ref = subs;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
sub = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (sub.Op === op) {
|
|
re.Sub = $appendSlice(re.Sub, sub.Sub);
|
|
p.reuse(sub);
|
|
} else {
|
|
re.Sub = $append(re.Sub, sub);
|
|
}
|
|
_i++;
|
|
}
|
|
/* */ if (op === 19) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (op === 19) { */ case 1:
|
|
_r = p.factor(re.Sub); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
re.Sub = _r;
|
|
if (re.Sub.$length === 1) {
|
|
old = re;
|
|
re = (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
p.reuse(old);
|
|
}
|
|
/* } */ case 2:
|
|
$s = -1; return re;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.collapse }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.old = old; $f.op = op; $f.p = p; $f.re = re; $f.sub = sub; $f.subs = subs; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.collapse = function(subs, op) { return this.$val.collapse(subs, op); };
|
|
parser.ptr.prototype.factor = function(sub) {
|
|
var _i, _r, _r$1, _ref, _tmp, _tmp$1, _tuple, first, i, i$1, i$2, i$3, ifirst, iflags, istr, j, j$1, j$2, j$3, max, out, p, prefix, prefix$1, re, re$1, reuse, same, start, str, strflags, sub, suffix, suffix$1, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; first = $f.first; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; ifirst = $f.ifirst; iflags = $f.iflags; istr = $f.istr; j = $f.j; j$1 = $f.j$1; j$2 = $f.j$2; j$3 = $f.j$3; max = $f.max; out = $f.out; p = $f.p; prefix = $f.prefix; prefix$1 = $f.prefix$1; re = $f.re; re$1 = $f.re$1; reuse = $f.reuse; same = $f.same; start = $f.start; str = $f.str; strflags = $f.strflags; sub = $f.sub; suffix = $f.suffix; suffix$1 = $f.suffix$1; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
if (sub.$length < 2) {
|
|
$s = -1; return sub;
|
|
}
|
|
str = sliceType.nil;
|
|
strflags = 0;
|
|
start = 0;
|
|
out = $subslice(sub, 0, 0);
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i <= sub.$length)) { break; } */ if(!(i <= sub.$length)) { $s = 2; continue; }
|
|
istr = sliceType.nil;
|
|
iflags = 0;
|
|
/* */ if (i < sub.$length) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (i < sub.$length) { */ case 3:
|
|
_tuple = p.leadingString(((i < 0 || i >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i]));
|
|
istr = _tuple[0];
|
|
iflags = _tuple[1];
|
|
if (iflags === strflags) {
|
|
same = 0;
|
|
while (true) {
|
|
if (!(same < str.$length && same < istr.$length && (((same < 0 || same >= str.$length) ? ($throwRuntimeError("index out of range"), undefined) : str.$array[str.$offset + same]) === ((same < 0 || same >= istr.$length) ? ($throwRuntimeError("index out of range"), undefined) : istr.$array[istr.$offset + same])))) { break; }
|
|
same = same + (1) >> 0;
|
|
}
|
|
if (same > 0) {
|
|
str = $subslice(str, 0, same);
|
|
i = i + (1) >> 0;
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
}
|
|
/* } */ case 4:
|
|
/* */ if (i === start) { $s = 5; continue; }
|
|
/* */ if (i === (start + 1 >> 0)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (i === start) { */ case 5:
|
|
$s = 8; continue;
|
|
/* } else if (i === (start + 1 >> 0)) { */ case 6:
|
|
out = $append(out, ((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]));
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
prefix = p.newRegexp(3);
|
|
prefix.Flags = strflags;
|
|
prefix.Rune = $appendSlice($subslice(prefix.Rune, 0, 0), str);
|
|
j = start;
|
|
while (true) {
|
|
if (!(j < i)) { break; }
|
|
((j < 0 || j >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j] = p.removeLeadingString(((j < 0 || j >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j]), str.$length));
|
|
j = j + (1) >> 0;
|
|
}
|
|
_r = p.collapse($subslice(sub, start, i), 19); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
suffix = _r;
|
|
re = p.newRegexp(18);
|
|
re.Sub = $append($subslice(re.Sub, 0, 0), prefix, suffix);
|
|
out = $append(out, re);
|
|
/* } */ case 8:
|
|
start = i;
|
|
str = istr;
|
|
strflags = iflags;
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
sub = out;
|
|
start = 0;
|
|
out = $subslice(sub, 0, 0);
|
|
first = ptrType$1.nil;
|
|
i$1 = 0;
|
|
/* while (true) { */ case 10:
|
|
/* if (!(i$1 <= sub.$length)) { break; } */ if(!(i$1 <= sub.$length)) { $s = 11; continue; }
|
|
ifirst = ptrType$1.nil;
|
|
/* */ if (i$1 < sub.$length) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (i$1 < sub.$length) { */ case 12:
|
|
ifirst = p.leadingRegexp(((i$1 < 0 || i$1 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$1]));
|
|
if (!(first === ptrType$1.nil) && first.Equal(ifirst) && (isCharClass(first) || ((first.Op === 17) && (first.Min === first.Max) && isCharClass((x = first.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])))))) {
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* continue; */ $s = 10; continue;
|
|
}
|
|
/* } */ case 13:
|
|
/* */ if (i$1 === start) { $s = 14; continue; }
|
|
/* */ if (i$1 === (start + 1 >> 0)) { $s = 15; continue; }
|
|
/* */ $s = 16; continue;
|
|
/* if (i$1 === start) { */ case 14:
|
|
$s = 17; continue;
|
|
/* } else if (i$1 === (start + 1 >> 0)) { */ case 15:
|
|
out = $append(out, ((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]));
|
|
$s = 17; continue;
|
|
/* } else { */ case 16:
|
|
prefix$1 = first;
|
|
j$1 = start;
|
|
while (true) {
|
|
if (!(j$1 < i$1)) { break; }
|
|
reuse = !((j$1 === start));
|
|
((j$1 < 0 || j$1 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$1] = p.removeLeadingRegexp(((j$1 < 0 || j$1 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$1]), reuse));
|
|
j$1 = j$1 + (1) >> 0;
|
|
}
|
|
_r$1 = p.collapse($subslice(sub, start, i$1), 19); /* */ $s = 18; case 18: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
suffix$1 = _r$1;
|
|
re$1 = p.newRegexp(18);
|
|
re$1.Sub = $append($subslice(re$1.Sub, 0, 0), prefix$1, suffix$1);
|
|
out = $append(out, re$1);
|
|
/* } */ case 17:
|
|
start = i$1;
|
|
first = ifirst;
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 10; continue; case 11:
|
|
sub = out;
|
|
start = 0;
|
|
out = $subslice(sub, 0, 0);
|
|
i$2 = 0;
|
|
/* while (true) { */ case 19:
|
|
/* if (!(i$2 <= sub.$length)) { break; } */ if(!(i$2 <= sub.$length)) { $s = 20; continue; }
|
|
/* */ if (i$2 < sub.$length && isCharClass(((i$2 < 0 || i$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$2]))) { $s = 21; continue; }
|
|
/* */ $s = 22; continue;
|
|
/* if (i$2 < sub.$length && isCharClass(((i$2 < 0 || i$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$2]))) { */ case 21:
|
|
i$2 = i$2 + (1) >> 0;
|
|
/* continue; */ $s = 19; continue;
|
|
/* } */ case 22:
|
|
/* */ if (i$2 === start) { $s = 23; continue; }
|
|
/* */ if (i$2 === (start + 1 >> 0)) { $s = 24; continue; }
|
|
/* */ $s = 25; continue;
|
|
/* if (i$2 === start) { */ case 23:
|
|
$s = 26; continue;
|
|
/* } else if (i$2 === (start + 1 >> 0)) { */ case 24:
|
|
out = $append(out, ((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]));
|
|
$s = 26; continue;
|
|
/* } else { */ case 25:
|
|
max = start;
|
|
j$2 = start + 1 >> 0;
|
|
while (true) {
|
|
if (!(j$2 < i$2)) { break; }
|
|
if (((max < 0 || max >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + max]).Op < ((j$2 < 0 || j$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$2]).Op || (((max < 0 || max >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + max]).Op === ((j$2 < 0 || j$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$2]).Op) && ((max < 0 || max >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + max]).Rune.$length < ((j$2 < 0 || j$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$2]).Rune.$length) {
|
|
max = j$2;
|
|
}
|
|
j$2 = j$2 + (1) >> 0;
|
|
}
|
|
_tmp = ((max < 0 || max >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + max]);
|
|
_tmp$1 = ((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]);
|
|
((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start] = _tmp);
|
|
((max < 0 || max >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + max] = _tmp$1);
|
|
j$3 = start + 1 >> 0;
|
|
while (true) {
|
|
if (!(j$3 < i$2)) { break; }
|
|
mergeCharClass(((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]), ((j$3 < 0 || j$3 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$3]));
|
|
p.reuse(((j$3 < 0 || j$3 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + j$3]));
|
|
j$3 = j$3 + (1) >> 0;
|
|
}
|
|
$r = cleanAlt(((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start])); /* */ $s = 27; case 27: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
out = $append(out, ((start < 0 || start >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + start]));
|
|
/* } */ case 26:
|
|
if (i$2 < sub.$length) {
|
|
out = $append(out, ((i$2 < 0 || i$2 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$2]));
|
|
}
|
|
start = i$2 + 1 >> 0;
|
|
i$2 = i$2 + (1) >> 0;
|
|
/* } */ $s = 19; continue; case 20:
|
|
sub = out;
|
|
start = 0;
|
|
out = $subslice(sub, 0, 0);
|
|
_ref = sub;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i$3 = _i;
|
|
if ((i$3 + 1 >> 0) < sub.$length && (((i$3 < 0 || i$3 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$3]).Op === 2) && ((x$1 = i$3 + 1 >> 0, ((x$1 < 0 || x$1 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + x$1])).Op === 2)) {
|
|
_i++;
|
|
continue;
|
|
}
|
|
out = $append(out, ((i$3 < 0 || i$3 >= sub.$length) ? ($throwRuntimeError("index out of range"), undefined) : sub.$array[sub.$offset + i$3]));
|
|
_i++;
|
|
}
|
|
sub = out;
|
|
$s = -1; return sub;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.factor }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.first = first; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.ifirst = ifirst; $f.iflags = iflags; $f.istr = istr; $f.j = j; $f.j$1 = j$1; $f.j$2 = j$2; $f.j$3 = j$3; $f.max = max; $f.out = out; $f.p = p; $f.prefix = prefix; $f.prefix$1 = prefix$1; $f.re = re; $f.re$1 = re$1; $f.reuse = reuse; $f.same = same; $f.start = start; $f.str = str; $f.strflags = strflags; $f.sub = sub; $f.suffix = suffix; $f.suffix$1 = suffix$1; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.factor = function(sub) { return this.$val.factor(sub); };
|
|
parser.ptr.prototype.leadingString = function(re) {
|
|
var p, re, x;
|
|
p = this;
|
|
if ((re.Op === 18) && re.Sub.$length > 0) {
|
|
re = (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
}
|
|
if (!((re.Op === 3))) {
|
|
return [sliceType.nil, 0];
|
|
}
|
|
return [re.Rune, (re.Flags & 1) >>> 0];
|
|
};
|
|
parser.prototype.leadingString = function(re) { return this.$val.leadingString(re); };
|
|
parser.ptr.prototype.removeLeadingString = function(re, n) {
|
|
var _1, n, old, p, re, sub, x, x$1, x$2;
|
|
p = this;
|
|
if ((re.Op === 18) && re.Sub.$length > 0) {
|
|
sub = (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
sub = p.removeLeadingString(sub, n);
|
|
(x$1 = re.Sub, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0] = sub));
|
|
if (sub.Op === 2) {
|
|
p.reuse(sub);
|
|
_1 = re.Sub.$length;
|
|
if ((_1 === (0)) || (_1 === (1))) {
|
|
re.Op = 2;
|
|
re.Sub = sliceType$5.nil;
|
|
} else if (_1 === (2)) {
|
|
old = re;
|
|
re = (x$2 = re.Sub, (1 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 1]));
|
|
p.reuse(old);
|
|
} else {
|
|
$copySlice(re.Sub, $subslice(re.Sub, 1));
|
|
re.Sub = $subslice(re.Sub, 0, (re.Sub.$length - 1 >> 0));
|
|
}
|
|
}
|
|
return re;
|
|
}
|
|
if (re.Op === 3) {
|
|
re.Rune = $subslice(re.Rune, 0, $copySlice(re.Rune, $subslice(re.Rune, n)));
|
|
if (re.Rune.$length === 0) {
|
|
re.Op = 2;
|
|
}
|
|
}
|
|
return re;
|
|
};
|
|
parser.prototype.removeLeadingString = function(re, n) { return this.$val.removeLeadingString(re, n); };
|
|
parser.ptr.prototype.leadingRegexp = function(re) {
|
|
var p, re, sub, x;
|
|
p = this;
|
|
if (re.Op === 2) {
|
|
return ptrType$1.nil;
|
|
}
|
|
if ((re.Op === 18) && re.Sub.$length > 0) {
|
|
sub = (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
if (sub.Op === 2) {
|
|
return ptrType$1.nil;
|
|
}
|
|
return sub;
|
|
}
|
|
return re;
|
|
};
|
|
parser.prototype.leadingRegexp = function(re) { return this.$val.leadingRegexp(re); };
|
|
parser.ptr.prototype.removeLeadingRegexp = function(re, reuse) {
|
|
var _1, old, p, re, reuse, x, x$1;
|
|
p = this;
|
|
if ((re.Op === 18) && re.Sub.$length > 0) {
|
|
if (reuse) {
|
|
p.reuse((x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])));
|
|
}
|
|
re.Sub = $subslice(re.Sub, 0, $copySlice(re.Sub, $subslice(re.Sub, 1)));
|
|
_1 = re.Sub.$length;
|
|
if (_1 === (0)) {
|
|
re.Op = 2;
|
|
re.Sub = sliceType$5.nil;
|
|
} else if (_1 === (1)) {
|
|
old = re;
|
|
re = (x$1 = re.Sub, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0]));
|
|
p.reuse(old);
|
|
}
|
|
return re;
|
|
}
|
|
if (reuse) {
|
|
p.reuse(re);
|
|
}
|
|
return p.newRegexp(2);
|
|
};
|
|
parser.prototype.removeLeadingRegexp = function(re, reuse) { return this.$val.removeLeadingRegexp(re, reuse); };
|
|
literalRegexp = function(s, flags) {
|
|
var _i, _ref, _rune, c, flags, re, s;
|
|
re = new Regexp.ptr(3, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
re.Flags = flags;
|
|
re.Rune = $subslice(new sliceType(re.Rune0), 0, 0);
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
c = _rune[0];
|
|
if (re.Rune.$length >= re.Rune.$capacity) {
|
|
re.Rune = (new sliceType($stringToRunes(s)));
|
|
break;
|
|
}
|
|
re.Rune = $append(re.Rune, c);
|
|
_i += _rune[1];
|
|
}
|
|
return re;
|
|
};
|
|
Parse = function(s, flags) {
|
|
var _1, _2, _3, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _struct, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, _tuple$8, _tuple$9, after, after$1, before, before$1, c, c$1, err, err$1, err$2, err$3, flags, i, lastRepeat, lit, max, min, n, ok, op, p, r, r$1, re, repeat, rest, rest$1, rest$2, s, t, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _struct = $f._struct; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; _tuple$8 = $f._tuple$8; _tuple$9 = $f._tuple$9; after = $f.after; after$1 = $f.after$1; before = $f.before; before$1 = $f.before$1; c = $f.c; c$1 = $f.c$1; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; err$3 = $f.err$3; flags = $f.flags; i = $f.i; lastRepeat = $f.lastRepeat; lit = $f.lit; max = $f.max; min = $f.min; n = $f.n; ok = $f.ok; op = $f.op; p = $f.p; r = $f.r; r$1 = $f.r$1; re = $f.re; repeat = $f.repeat; rest = $f.rest; rest$1 = $f.rest$1; rest$2 = $f.rest$2; s = $f.s; t = $f.t; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (!((((flags & 2) >>> 0) === 0))) {
|
|
err = checkUTF8(s);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err];
|
|
}
|
|
$s = -1; return [literalRegexp(s, flags), $ifaceNil];
|
|
}
|
|
p = new parser.ptr(0, sliceType$5.nil, ptrType$1.nil, 0, "", sliceType.nil);
|
|
err$1 = $ifaceNil;
|
|
c = 0;
|
|
op = 0;
|
|
lastRepeat = "";
|
|
p.flags = flags;
|
|
p.wholeRegexp = s;
|
|
t = s;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(!(t === ""))) { break; } */ if(!(!(t === ""))) { $s = 2; continue; }
|
|
repeat = "";
|
|
_1 = t.charCodeAt(0);
|
|
/* */ if (_1 === (40)) { $s = 4; continue; }
|
|
/* */ if (_1 === (124)) { $s = 5; continue; }
|
|
/* */ if (_1 === (41)) { $s = 6; continue; }
|
|
/* */ if (_1 === (94)) { $s = 7; continue; }
|
|
/* */ if (_1 === (36)) { $s = 8; continue; }
|
|
/* */ if (_1 === (46)) { $s = 9; continue; }
|
|
/* */ if (_1 === (91)) { $s = 10; continue; }
|
|
/* */ if ((_1 === (42)) || (_1 === (43)) || (_1 === (63))) { $s = 11; continue; }
|
|
/* */ if (_1 === (123)) { $s = 12; continue; }
|
|
/* */ if (_1 === (92)) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (_1 === (40)) { */ case 4:
|
|
if (!((((p.flags & 64) >>> 0) === 0)) && t.length >= 2 && (t.charCodeAt(1) === 63)) {
|
|
_tuple = p.parsePerlFlags(t);
|
|
t = _tuple[0];
|
|
err$1 = _tuple[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
/* break; */ $s = 3; continue;
|
|
}
|
|
p.numCap = p.numCap + (1) >> 0;
|
|
p.op(128).Cap = p.numCap;
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (124)) { */ case 5:
|
|
_r = p.parseVerticalBar(); /* */ $s = 16; case 16: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (41)) { */ case 6:
|
|
_r$1 = p.parseRightParen(); /* */ $s = 17; case 17: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err$1 = _r$1;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (94)) { */ case 7:
|
|
if (!((((p.flags & 16) >>> 0) === 0))) {
|
|
p.op(9);
|
|
} else {
|
|
p.op(7);
|
|
}
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (36)) { */ case 8:
|
|
if (!((((p.flags & 16) >>> 0) === 0))) {
|
|
_struct = p.op(10);
|
|
_struct.Flags = (_struct.Flags | (256)) >>> 0;
|
|
} else {
|
|
p.op(8);
|
|
}
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (46)) { */ case 9:
|
|
if (!((((p.flags & 8) >>> 0) === 0))) {
|
|
p.op(6);
|
|
} else {
|
|
p.op(5);
|
|
}
|
|
t = $substring(t, 1);
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (91)) { */ case 10:
|
|
_r$2 = p.parseClass(t); /* */ $s = 18; case 18: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$2;
|
|
t = _tuple$1[0];
|
|
err$1 = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
$s = 15; continue;
|
|
/* } else if ((_1 === (42)) || (_1 === (43)) || (_1 === (63))) { */ case 11:
|
|
before = t;
|
|
_2 = t.charCodeAt(0);
|
|
if (_2 === (42)) {
|
|
op = 14;
|
|
} else if (_2 === (43)) {
|
|
op = 15;
|
|
} else if (_2 === (63)) {
|
|
op = 16;
|
|
}
|
|
after = $substring(t, 1);
|
|
_tuple$2 = p.repeat(op, 0, 0, before, after, lastRepeat);
|
|
after = _tuple$2[0];
|
|
err$1 = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
repeat = before;
|
|
t = after;
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (123)) { */ case 12:
|
|
op = 17;
|
|
before$1 = t;
|
|
_tuple$3 = p.parseRepeat(t);
|
|
min = _tuple$3[0];
|
|
max = _tuple$3[1];
|
|
after$1 = _tuple$3[2];
|
|
ok = _tuple$3[3];
|
|
if (!ok) {
|
|
p.literal(123);
|
|
t = $substring(t, 1);
|
|
/* break; */ $s = 3; continue;
|
|
}
|
|
if (min < 0 || min > 1000 || max > 1000 || max >= 0 && min > max) {
|
|
$s = -1; return [ptrType$1.nil, new Error.ptr("invalid repeat count", $substring(before$1, 0, (before$1.length - after$1.length >> 0)))];
|
|
}
|
|
_tuple$4 = p.repeat(op, min, max, before$1, after$1, lastRepeat);
|
|
after$1 = _tuple$4[0];
|
|
err$1 = _tuple$4[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
repeat = before$1;
|
|
t = after$1;
|
|
$s = 15; continue;
|
|
/* } else if (_1 === (92)) { */ case 13:
|
|
if (!((((p.flags & 64) >>> 0) === 0)) && t.length >= 2) {
|
|
_3 = t.charCodeAt(1);
|
|
if (_3 === (65)) {
|
|
p.op(9);
|
|
t = $substring(t, 2);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
} else if (_3 === (98)) {
|
|
p.op(11);
|
|
t = $substring(t, 2);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
} else if (_3 === (66)) {
|
|
p.op(12);
|
|
t = $substring(t, 2);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
} else if (_3 === (67)) {
|
|
$s = -1; return [ptrType$1.nil, new Error.ptr("invalid escape sequence", $substring(t, 0, 2))];
|
|
} else if (_3 === (81)) {
|
|
lit = "";
|
|
i = strings.Index(t, "\\E");
|
|
if (i < 0) {
|
|
lit = $substring(t, 2);
|
|
t = "";
|
|
} else {
|
|
lit = $substring(t, 2, i);
|
|
t = $substring(t, (i + 2 >> 0));
|
|
}
|
|
while (true) {
|
|
if (!(!(lit === ""))) { break; }
|
|
_tuple$5 = nextRune(lit);
|
|
c$1 = _tuple$5[0];
|
|
rest = _tuple$5[1];
|
|
err$2 = _tuple$5[2];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$2];
|
|
}
|
|
p.literal(c$1);
|
|
lit = rest;
|
|
}
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
} else if (_3 === (122)) {
|
|
p.op(10);
|
|
t = $substring(t, 2);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
}
|
|
}
|
|
re = p.newRegexp(4);
|
|
re.Flags = p.flags;
|
|
/* */ if (t.length >= 2 && ((t.charCodeAt(1) === 112) || (t.charCodeAt(1) === 80))) { $s = 19; continue; }
|
|
/* */ $s = 20; continue;
|
|
/* if (t.length >= 2 && ((t.charCodeAt(1) === 112) || (t.charCodeAt(1) === 80))) { */ case 19:
|
|
_r$3 = p.parseUnicodeClass(t, $subslice(new sliceType(re.Rune0), 0, 0)); /* */ $s = 21; case 21: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_tuple$6 = _r$3;
|
|
r = _tuple$6[0];
|
|
rest$1 = _tuple$6[1];
|
|
err$3 = _tuple$6[2];
|
|
if (!($interfaceIsEqual(err$3, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$3];
|
|
}
|
|
if (!(r === sliceType.nil)) {
|
|
re.Rune = r;
|
|
t = rest$1;
|
|
p.push(re);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
}
|
|
/* } */ case 20:
|
|
_r$4 = p.parsePerlClassEscape(t, $subslice(new sliceType(re.Rune0), 0, 0)); /* */ $s = 22; case 22: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple$7 = _r$4;
|
|
r$1 = _tuple$7[0];
|
|
rest$2 = _tuple$7[1];
|
|
if (!(r$1 === sliceType.nil)) {
|
|
re.Rune = r$1;
|
|
t = rest$2;
|
|
p.push(re);
|
|
/* break BigSwitch; */ $s = 3; continue s;
|
|
}
|
|
p.reuse(re);
|
|
_tuple$8 = p.parseEscape(t);
|
|
c = _tuple$8[0];
|
|
t = _tuple$8[1];
|
|
err$1 = _tuple$8[2];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
p.literal(c);
|
|
$s = 15; continue;
|
|
/* } else { */ case 14:
|
|
_tuple$9 = nextRune(t);
|
|
c = _tuple$9[0];
|
|
t = _tuple$9[1];
|
|
err$1 = _tuple$9[2];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
p.literal(c);
|
|
/* } */ case 15:
|
|
case 3:
|
|
lastRepeat = repeat;
|
|
/* } */ $s = 1; continue; case 2:
|
|
_r$5 = p.concat(); /* */ $s = 23; case 23: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$5;
|
|
_r$6 = p.swapVerticalBar(); /* */ $s = 26; case 26: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
/* */ if (_r$6) { $s = 24; continue; }
|
|
/* */ $s = 25; continue;
|
|
/* if (_r$6) { */ case 24:
|
|
p.stack = $subslice(p.stack, 0, (p.stack.$length - 1 >> 0));
|
|
/* } */ case 25:
|
|
_r$7 = p.alternate(); /* */ $s = 27; case 27: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_r$7;
|
|
n = p.stack.$length;
|
|
if (!((n === 1))) {
|
|
$s = -1; return [ptrType$1.nil, new Error.ptr("missing closing )", s)];
|
|
}
|
|
$s = -1; return [(x = p.stack, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Parse }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._struct = _struct; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f._tuple$8 = _tuple$8; $f._tuple$9 = _tuple$9; $f.after = after; $f.after$1 = after$1; $f.before = before; $f.before$1 = before$1; $f.c = c; $f.c$1 = c$1; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.err$3 = err$3; $f.flags = flags; $f.i = i; $f.lastRepeat = lastRepeat; $f.lit = lit; $f.max = max; $f.min = min; $f.n = n; $f.ok = ok; $f.op = op; $f.p = p; $f.r = r; $f.r$1 = r$1; $f.re = re; $f.repeat = repeat; $f.rest = rest; $f.rest$1 = rest$1; $f.rest$2 = rest$2; $f.s = s; $f.t = t; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Parse = Parse;
|
|
parser.ptr.prototype.parseRepeat = function(s) {
|
|
var _tuple, _tuple$1, max, min, ok, ok1, p, rest, s;
|
|
min = 0;
|
|
max = 0;
|
|
rest = "";
|
|
ok = false;
|
|
p = this;
|
|
if (s === "" || !((s.charCodeAt(0) === 123))) {
|
|
return [min, max, rest, ok];
|
|
}
|
|
s = $substring(s, 1);
|
|
ok1 = false;
|
|
_tuple = p.parseInt(s);
|
|
min = _tuple[0];
|
|
s = _tuple[1];
|
|
ok1 = _tuple[2];
|
|
if (!ok1) {
|
|
return [min, max, rest, ok];
|
|
}
|
|
if (s === "") {
|
|
return [min, max, rest, ok];
|
|
}
|
|
if (!((s.charCodeAt(0) === 44))) {
|
|
max = min;
|
|
} else {
|
|
s = $substring(s, 1);
|
|
if (s === "") {
|
|
return [min, max, rest, ok];
|
|
}
|
|
if (s.charCodeAt(0) === 125) {
|
|
max = -1;
|
|
} else {
|
|
_tuple$1 = p.parseInt(s);
|
|
max = _tuple$1[0];
|
|
s = _tuple$1[1];
|
|
ok1 = _tuple$1[2];
|
|
if (!ok1) {
|
|
return [min, max, rest, ok];
|
|
} else if (max < 0) {
|
|
min = -1;
|
|
}
|
|
}
|
|
}
|
|
if (s === "" || !((s.charCodeAt(0) === 125))) {
|
|
return [min, max, rest, ok];
|
|
}
|
|
rest = $substring(s, 1);
|
|
ok = true;
|
|
return [min, max, rest, ok];
|
|
};
|
|
parser.prototype.parseRepeat = function(s) { return this.$val.parseRepeat(s); };
|
|
parser.ptr.prototype.parsePerlFlags = function(s) {
|
|
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, c, capture, end, err, flags, name, p, re, rest, s, sawFlag, sign, t;
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
t = s;
|
|
if (t.length > 4 && (t.charCodeAt(2) === 80) && (t.charCodeAt(3) === 60)) {
|
|
end = strings.IndexRune(t, 62);
|
|
if (end < 0) {
|
|
err = checkUTF8(t);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp = "";
|
|
_tmp$1 = err;
|
|
rest = _tmp;
|
|
err = _tmp$1;
|
|
return [rest, err];
|
|
}
|
|
_tmp$2 = "";
|
|
_tmp$3 = new Error.ptr("invalid named capture", s);
|
|
rest = _tmp$2;
|
|
err = _tmp$3;
|
|
return [rest, err];
|
|
}
|
|
capture = $substring(t, 0, (end + 1 >> 0));
|
|
name = $substring(t, 4, end);
|
|
err = checkUTF8(name);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$4 = "";
|
|
_tmp$5 = err;
|
|
rest = _tmp$4;
|
|
err = _tmp$5;
|
|
return [rest, err];
|
|
}
|
|
if (!isValidCaptureName(name)) {
|
|
_tmp$6 = "";
|
|
_tmp$7 = new Error.ptr("invalid named capture", capture);
|
|
rest = _tmp$6;
|
|
err = _tmp$7;
|
|
return [rest, err];
|
|
}
|
|
p.numCap = p.numCap + (1) >> 0;
|
|
re = p.op(128);
|
|
re.Cap = p.numCap;
|
|
re.Name = name;
|
|
_tmp$8 = $substring(t, (end + 1 >> 0));
|
|
_tmp$9 = $ifaceNil;
|
|
rest = _tmp$8;
|
|
err = _tmp$9;
|
|
return [rest, err];
|
|
}
|
|
c = 0;
|
|
t = $substring(t, 2);
|
|
flags = p.flags;
|
|
sign = 1;
|
|
sawFlag = false;
|
|
Loop:
|
|
while (true) {
|
|
if (!(!(t === ""))) { break; }
|
|
_tuple = nextRune(t);
|
|
c = _tuple[0];
|
|
t = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$10 = "";
|
|
_tmp$11 = err;
|
|
rest = _tmp$10;
|
|
err = _tmp$11;
|
|
return [rest, err];
|
|
}
|
|
_1 = c;
|
|
if (_1 === (105)) {
|
|
flags = (flags | (1)) >>> 0;
|
|
sawFlag = true;
|
|
} else if (_1 === (109)) {
|
|
flags = (flags & ~(16)) << 16 >>> 16;
|
|
sawFlag = true;
|
|
} else if (_1 === (115)) {
|
|
flags = (flags | (8)) >>> 0;
|
|
sawFlag = true;
|
|
} else if (_1 === (85)) {
|
|
flags = (flags | (32)) >>> 0;
|
|
sawFlag = true;
|
|
} else if (_1 === (45)) {
|
|
if (sign < 0) {
|
|
break Loop;
|
|
}
|
|
sign = -1;
|
|
flags = ~flags << 16 >>> 16;
|
|
sawFlag = false;
|
|
} else if ((_1 === (58)) || (_1 === (41))) {
|
|
if (sign < 0) {
|
|
if (!sawFlag) {
|
|
break Loop;
|
|
}
|
|
flags = ~flags << 16 >>> 16;
|
|
}
|
|
if (c === 58) {
|
|
p.op(128);
|
|
}
|
|
p.flags = flags;
|
|
_tmp$12 = t;
|
|
_tmp$13 = $ifaceNil;
|
|
rest = _tmp$12;
|
|
err = _tmp$13;
|
|
return [rest, err];
|
|
} else {
|
|
break Loop;
|
|
}
|
|
}
|
|
_tmp$14 = "";
|
|
_tmp$15 = new Error.ptr("invalid or unsupported Perl syntax", $substring(s, 0, (s.length - t.length >> 0)));
|
|
rest = _tmp$14;
|
|
err = _tmp$15;
|
|
return [rest, err];
|
|
};
|
|
parser.prototype.parsePerlFlags = function(s) { return this.$val.parsePerlFlags(s); };
|
|
isValidCaptureName = function(name) {
|
|
var _i, _ref, _rune, c, name;
|
|
if (name === "") {
|
|
return false;
|
|
}
|
|
_ref = name;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
c = _rune[0];
|
|
if (!((c === 95)) && !isalnum(c)) {
|
|
return false;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return true;
|
|
};
|
|
parser.ptr.prototype.parseInt = function(s) {
|
|
var i, n, ok, p, rest, s, t;
|
|
n = 0;
|
|
rest = "";
|
|
ok = false;
|
|
p = this;
|
|
if (s === "" || s.charCodeAt(0) < 48 || 57 < s.charCodeAt(0)) {
|
|
return [n, rest, ok];
|
|
}
|
|
if (s.length >= 2 && (s.charCodeAt(0) === 48) && 48 <= s.charCodeAt(1) && s.charCodeAt(1) <= 57) {
|
|
return [n, rest, ok];
|
|
}
|
|
t = s;
|
|
while (true) {
|
|
if (!(!(s === "") && 48 <= s.charCodeAt(0) && s.charCodeAt(0) <= 57)) { break; }
|
|
s = $substring(s, 1);
|
|
}
|
|
rest = s;
|
|
ok = true;
|
|
t = $substring(t, 0, (t.length - s.length >> 0));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < t.length)) { break; }
|
|
if (n >= 100000000) {
|
|
n = -1;
|
|
break;
|
|
}
|
|
n = (($imul(n, 10)) + ((t.charCodeAt(i) >> 0)) >> 0) - 48 >> 0;
|
|
i = i + (1) >> 0;
|
|
}
|
|
return [n, rest, ok];
|
|
};
|
|
parser.prototype.parseInt = function(s) { return this.$val.parseInt(s); };
|
|
isCharClass = function(re) {
|
|
var re;
|
|
return (re.Op === 3) && (re.Rune.$length === 1) || (re.Op === 4) || (re.Op === 5) || (re.Op === 6);
|
|
};
|
|
matchRune = function(re, r) {
|
|
var _1, i, r, re, x, x$1, x$2, x$3;
|
|
_1 = re.Op;
|
|
if (_1 === (3)) {
|
|
return (re.Rune.$length === 1) && ((x = re.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])) === r);
|
|
} else if (_1 === (4)) {
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < re.Rune.$length)) { break; }
|
|
if ((x$1 = re.Rune, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])) <= r && r <= (x$2 = re.Rune, x$3 = i + 1 >> 0, ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3]))) {
|
|
return true;
|
|
}
|
|
i = i + (2) >> 0;
|
|
}
|
|
return false;
|
|
} else if (_1 === (5)) {
|
|
return !((r === 10));
|
|
} else if (_1 === (6)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
parser.ptr.prototype.parseVerticalBar = function() {
|
|
var _r, _r$1, p, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_r = p.concat(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
_r$1 = p.swapVerticalBar(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!_r$1) { */ case 2:
|
|
p.op(129);
|
|
/* } */ case 3:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parseVerticalBar }; } $f._r = _r; $f._r$1 = _r$1; $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parseVerticalBar = function() { return this.$val.parseVerticalBar(); };
|
|
mergeCharClass = function(dst, src) {
|
|
var _1, dst, src, x, x$1, x$2, x$3, x$4;
|
|
switch (0) { default:
|
|
_1 = dst.Op;
|
|
if (_1 === (6)) {
|
|
} else if (_1 === (5)) {
|
|
if (matchRune(src, 10)) {
|
|
dst.Op = 6;
|
|
}
|
|
} else if (_1 === (4)) {
|
|
if (src.Op === 3) {
|
|
dst.Rune = appendLiteral(dst.Rune, (x = src.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])), src.Flags);
|
|
} else {
|
|
dst.Rune = appendClass(dst.Rune, src.Rune);
|
|
}
|
|
} else if (_1 === (3)) {
|
|
if (((x$1 = src.Rune, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])) === (x$2 = dst.Rune, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0]))) && (src.Flags === dst.Flags)) {
|
|
break;
|
|
}
|
|
dst.Op = 4;
|
|
dst.Rune = appendLiteral($subslice(dst.Rune, 0, 0), (x$3 = dst.Rune, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])), dst.Flags);
|
|
dst.Rune = appendLiteral(dst.Rune, (x$4 = src.Rune, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0])), src.Flags);
|
|
}
|
|
}
|
|
};
|
|
parser.ptr.prototype.swapVerticalBar = function() {
|
|
var _tmp, _tmp$1, n, p, re1, re1$1, re2, re3, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; n = $f.n; p = $f.p; re1 = $f.re1; re1$1 = $f.re1$1; re2 = $f.re2; re3 = $f.re3; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$15 = $f.x$15; x$16 = $f.x$16; x$17 = $f.x$17; x$18 = $f.x$18; x$19 = $f.x$19; x$2 = $f.x$2; x$20 = $f.x$20; x$21 = $f.x$21; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
n = p.stack.$length;
|
|
if (n >= 3 && ((x = p.stack, x$1 = n - 2 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Op === 129) && isCharClass((x$2 = p.stack, x$3 = n - 1 >> 0, ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3]))) && isCharClass((x$4 = p.stack, x$5 = n - 3 >> 0, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])))) {
|
|
re1 = (x$6 = p.stack, x$7 = n - 1 >> 0, ((x$7 < 0 || x$7 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + x$7]));
|
|
re3 = (x$8 = p.stack, x$9 = n - 3 >> 0, ((x$9 < 0 || x$9 >= x$8.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + x$9]));
|
|
if (re1.Op > re3.Op) {
|
|
_tmp = re3;
|
|
_tmp$1 = re1;
|
|
re1 = _tmp;
|
|
re3 = _tmp$1;
|
|
(x$10 = p.stack, x$11 = n - 3 >> 0, ((x$11 < 0 || x$11 >= x$10.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + x$11] = re3));
|
|
}
|
|
mergeCharClass(re3, re1);
|
|
p.reuse(re1);
|
|
p.stack = $subslice(p.stack, 0, (n - 1 >> 0));
|
|
$s = -1; return true;
|
|
}
|
|
/* */ if (n >= 2) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (n >= 2) { */ case 1:
|
|
re1$1 = (x$12 = p.stack, x$13 = n - 1 >> 0, ((x$13 < 0 || x$13 >= x$12.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$12.$array[x$12.$offset + x$13]));
|
|
re2 = (x$14 = p.stack, x$15 = n - 2 >> 0, ((x$15 < 0 || x$15 >= x$14.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$14.$array[x$14.$offset + x$15]));
|
|
/* */ if (re2.Op === 129) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (re2.Op === 129) { */ case 3:
|
|
/* */ if (n >= 3) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (n >= 3) { */ case 5:
|
|
$r = cleanAlt((x$16 = p.stack, x$17 = n - 3 >> 0, ((x$17 < 0 || x$17 >= x$16.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$16.$array[x$16.$offset + x$17]))); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 6:
|
|
(x$18 = p.stack, x$19 = n - 2 >> 0, ((x$19 < 0 || x$19 >= x$18.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$18.$array[x$18.$offset + x$19] = re1$1));
|
|
(x$20 = p.stack, x$21 = n - 1 >> 0, ((x$21 < 0 || x$21 >= x$20.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$20.$array[x$20.$offset + x$21] = re2));
|
|
$s = -1; return true;
|
|
/* } */ case 4:
|
|
/* } */ case 2:
|
|
$s = -1; return false;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.swapVerticalBar }; } $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.n = n; $f.p = p; $f.re1 = re1; $f.re1$1 = re1$1; $f.re2 = re2; $f.re3 = re3; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$15 = x$15; $f.x$16 = x$16; $f.x$17 = x$17; $f.x$18 = x$18; $f.x$19 = x$19; $f.x$2 = x$2; $f.x$20 = x$20; $f.x$21 = x$21; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.swapVerticalBar = function() { return this.$val.swapVerticalBar(); };
|
|
parser.ptr.prototype.parseRightParen = function() {
|
|
var _r, _r$1, _r$2, n, p, re1, re2, x, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; n = $f.n; p = $f.p; re1 = $f.re1; re2 = $f.re2; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
_r = p.concat(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
_r$1 = p.swapVerticalBar(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (_r$1) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (_r$1) { */ case 2:
|
|
p.stack = $subslice(p.stack, 0, (p.stack.$length - 1 >> 0));
|
|
/* } */ case 3:
|
|
_r$2 = p.alternate(); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$2;
|
|
n = p.stack.$length;
|
|
if (n < 2) {
|
|
$s = -1; return new Error.ptr("unexpected )", p.wholeRegexp);
|
|
}
|
|
re1 = (x = p.stack, x$1 = n - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
re2 = (x$2 = p.stack, x$3 = n - 2 >> 0, ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3]));
|
|
p.stack = $subslice(p.stack, 0, (n - 2 >> 0));
|
|
if (!((re2.Op === 128))) {
|
|
$s = -1; return new Error.ptr("unexpected )", p.wholeRegexp);
|
|
}
|
|
p.flags = re2.Flags;
|
|
if (re2.Cap === 0) {
|
|
p.push(re1);
|
|
} else {
|
|
re2.Op = 13;
|
|
re2.Sub = $subslice(new sliceType$5(re2.Sub0), 0, 1);
|
|
(x$4 = re2.Sub, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0] = re1));
|
|
p.push(re2);
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parseRightParen }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.n = n; $f.p = p; $f.re1 = re1; $f.re2 = re2; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parseRightParen = function() { return this.$val.parseRightParen(); };
|
|
parser.ptr.prototype.parseEscape = function(s) {
|
|
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$22, _tmp$23, _tmp$24, _tmp$25, _tmp$26, _tmp$27, _tmp$28, _tmp$29, _tmp$3, _tmp$30, _tmp$31, _tmp$32, _tmp$33, _tmp$34, _tmp$35, _tmp$36, _tmp$37, _tmp$38, _tmp$39, _tmp$4, _tmp$40, _tmp$41, _tmp$42, _tmp$43, _tmp$44, _tmp$45, _tmp$46, _tmp$47, _tmp$48, _tmp$49, _tmp$5, _tmp$50, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$2, _tuple$3, c, err, i, nhex, p, r, rest, s, t, v, x, y;
|
|
r = 0;
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
t = $substring(s, 1);
|
|
if (t === "") {
|
|
_tmp = 0;
|
|
_tmp$1 = "";
|
|
_tmp$2 = new Error.ptr("trailing backslash at end of expression", "");
|
|
r = _tmp;
|
|
rest = _tmp$1;
|
|
err = _tmp$2;
|
|
return [r, rest, err];
|
|
}
|
|
_tuple = nextRune(t);
|
|
c = _tuple[0];
|
|
t = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$3 = 0;
|
|
_tmp$4 = "";
|
|
_tmp$5 = err;
|
|
r = _tmp$3;
|
|
rest = _tmp$4;
|
|
err = _tmp$5;
|
|
return [r, rest, err];
|
|
}
|
|
Switch:
|
|
switch (0) { default:
|
|
_1 = c;
|
|
if ((_1 === (49)) || (_1 === (50)) || (_1 === (51)) || (_1 === (52)) || (_1 === (53)) || (_1 === (54)) || (_1 === (55))) {
|
|
if (t === "" || t.charCodeAt(0) < 48 || t.charCodeAt(0) > 55) {
|
|
break;
|
|
}
|
|
r = c - 48 >> 0;
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < 3)) { break; }
|
|
if (t === "" || t.charCodeAt(0) < 48 || t.charCodeAt(0) > 55) {
|
|
break;
|
|
}
|
|
r = (($imul(r, 8)) + ((t.charCodeAt(0) >> 0)) >> 0) - 48 >> 0;
|
|
t = $substring(t, 1);
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$6 = r;
|
|
_tmp$7 = t;
|
|
_tmp$8 = $ifaceNil;
|
|
r = _tmp$6;
|
|
rest = _tmp$7;
|
|
err = _tmp$8;
|
|
return [r, rest, err];
|
|
} else if (_1 === (48)) {
|
|
r = c - 48 >> 0;
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < 3)) { break; }
|
|
if (t === "" || t.charCodeAt(0) < 48 || t.charCodeAt(0) > 55) {
|
|
break;
|
|
}
|
|
r = (($imul(r, 8)) + ((t.charCodeAt(0) >> 0)) >> 0) - 48 >> 0;
|
|
t = $substring(t, 1);
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$9 = r;
|
|
_tmp$10 = t;
|
|
_tmp$11 = $ifaceNil;
|
|
r = _tmp$9;
|
|
rest = _tmp$10;
|
|
err = _tmp$11;
|
|
return [r, rest, err];
|
|
} else if (_1 === (120)) {
|
|
if (t === "") {
|
|
break;
|
|
}
|
|
_tuple$1 = nextRune(t);
|
|
c = _tuple$1[0];
|
|
t = _tuple$1[1];
|
|
err = _tuple$1[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$12 = 0;
|
|
_tmp$13 = "";
|
|
_tmp$14 = err;
|
|
r = _tmp$12;
|
|
rest = _tmp$13;
|
|
err = _tmp$14;
|
|
return [r, rest, err];
|
|
}
|
|
if (c === 123) {
|
|
nhex = 0;
|
|
r = 0;
|
|
while (true) {
|
|
if (t === "") {
|
|
break Switch;
|
|
}
|
|
_tuple$2 = nextRune(t);
|
|
c = _tuple$2[0];
|
|
t = _tuple$2[1];
|
|
err = _tuple$2[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$15 = 0;
|
|
_tmp$16 = "";
|
|
_tmp$17 = err;
|
|
r = _tmp$15;
|
|
rest = _tmp$16;
|
|
err = _tmp$17;
|
|
return [r, rest, err];
|
|
}
|
|
if (c === 125) {
|
|
break;
|
|
}
|
|
v = unhex(c);
|
|
if (v < 0) {
|
|
break Switch;
|
|
}
|
|
r = ($imul(r, 16)) + v >> 0;
|
|
if (r > 1114111) {
|
|
break Switch;
|
|
}
|
|
nhex = nhex + (1) >> 0;
|
|
}
|
|
if (nhex === 0) {
|
|
break Switch;
|
|
}
|
|
_tmp$18 = r;
|
|
_tmp$19 = t;
|
|
_tmp$20 = $ifaceNil;
|
|
r = _tmp$18;
|
|
rest = _tmp$19;
|
|
err = _tmp$20;
|
|
return [r, rest, err];
|
|
}
|
|
x = unhex(c);
|
|
_tuple$3 = nextRune(t);
|
|
c = _tuple$3[0];
|
|
t = _tuple$3[1];
|
|
err = _tuple$3[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$21 = 0;
|
|
_tmp$22 = "";
|
|
_tmp$23 = err;
|
|
r = _tmp$21;
|
|
rest = _tmp$22;
|
|
err = _tmp$23;
|
|
return [r, rest, err];
|
|
}
|
|
y = unhex(c);
|
|
if (x < 0 || y < 0) {
|
|
break;
|
|
}
|
|
_tmp$24 = ($imul(x, 16)) + y >> 0;
|
|
_tmp$25 = t;
|
|
_tmp$26 = $ifaceNil;
|
|
r = _tmp$24;
|
|
rest = _tmp$25;
|
|
err = _tmp$26;
|
|
return [r, rest, err];
|
|
} else if (_1 === (97)) {
|
|
_tmp$27 = 7;
|
|
_tmp$28 = t;
|
|
_tmp$29 = err;
|
|
r = _tmp$27;
|
|
rest = _tmp$28;
|
|
err = _tmp$29;
|
|
return [r, rest, err];
|
|
} else if (_1 === (102)) {
|
|
_tmp$30 = 12;
|
|
_tmp$31 = t;
|
|
_tmp$32 = err;
|
|
r = _tmp$30;
|
|
rest = _tmp$31;
|
|
err = _tmp$32;
|
|
return [r, rest, err];
|
|
} else if (_1 === (110)) {
|
|
_tmp$33 = 10;
|
|
_tmp$34 = t;
|
|
_tmp$35 = err;
|
|
r = _tmp$33;
|
|
rest = _tmp$34;
|
|
err = _tmp$35;
|
|
return [r, rest, err];
|
|
} else if (_1 === (114)) {
|
|
_tmp$36 = 13;
|
|
_tmp$37 = t;
|
|
_tmp$38 = err;
|
|
r = _tmp$36;
|
|
rest = _tmp$37;
|
|
err = _tmp$38;
|
|
return [r, rest, err];
|
|
} else if (_1 === (116)) {
|
|
_tmp$39 = 9;
|
|
_tmp$40 = t;
|
|
_tmp$41 = err;
|
|
r = _tmp$39;
|
|
rest = _tmp$40;
|
|
err = _tmp$41;
|
|
return [r, rest, err];
|
|
} else if (_1 === (118)) {
|
|
_tmp$42 = 11;
|
|
_tmp$43 = t;
|
|
_tmp$44 = err;
|
|
r = _tmp$42;
|
|
rest = _tmp$43;
|
|
err = _tmp$44;
|
|
return [r, rest, err];
|
|
} else if (c < 128 && !isalnum(c)) {
|
|
_tmp$45 = c;
|
|
_tmp$46 = t;
|
|
_tmp$47 = $ifaceNil;
|
|
r = _tmp$45;
|
|
rest = _tmp$46;
|
|
err = _tmp$47;
|
|
return [r, rest, err];
|
|
}
|
|
}
|
|
_tmp$48 = 0;
|
|
_tmp$49 = "";
|
|
_tmp$50 = new Error.ptr("invalid escape sequence", $substring(s, 0, (s.length - t.length >> 0)));
|
|
r = _tmp$48;
|
|
rest = _tmp$49;
|
|
err = _tmp$50;
|
|
return [r, rest, err];
|
|
};
|
|
parser.prototype.parseEscape = function(s) { return this.$val.parseEscape(s); };
|
|
parser.ptr.prototype.parseClassChar = function(s, wholeClass) {
|
|
var _tmp, _tmp$1, _tmp$2, _tuple, _tuple$1, err, p, r, rest, s, wholeClass;
|
|
r = 0;
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
if (s === "") {
|
|
_tmp = 0;
|
|
_tmp$1 = "";
|
|
_tmp$2 = new Error.ptr("missing closing ]", wholeClass);
|
|
r = _tmp;
|
|
rest = _tmp$1;
|
|
err = _tmp$2;
|
|
return [r, rest, err];
|
|
}
|
|
if (s.charCodeAt(0) === 92) {
|
|
_tuple = p.parseEscape(s);
|
|
r = _tuple[0];
|
|
rest = _tuple[1];
|
|
err = _tuple[2];
|
|
return [r, rest, err];
|
|
}
|
|
_tuple$1 = nextRune(s);
|
|
r = _tuple$1[0];
|
|
rest = _tuple$1[1];
|
|
err = _tuple$1[2];
|
|
return [r, rest, err];
|
|
};
|
|
parser.prototype.parseClassChar = function(s, wholeClass) { return this.$val.parseClassChar(s, wholeClass); };
|
|
parser.ptr.prototype.parsePerlClassEscape = function(s, r) {
|
|
var _entry, _r, _tmp, _tmp$1, g, out, p, r, rest, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; g = $f.g; out = $f.out; p = $f.p; r = $f.r; rest = $f.rest; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
out = sliceType.nil;
|
|
rest = "";
|
|
p = this;
|
|
if ((((p.flags & 64) >>> 0) === 0) || s.length < 2 || !((s.charCodeAt(0) === 92))) {
|
|
$s = -1; return [out, rest];
|
|
}
|
|
g = $clone((_entry = perlGroup[$String.keyFor($substring(s, 0, 2))], _entry !== undefined ? _entry.v : new charGroup.ptr(0, sliceType.nil)), charGroup);
|
|
if (g.sign === 0) {
|
|
$s = -1; return [out, rest];
|
|
}
|
|
_r = p.appendGroup(r, $clone(g, charGroup)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tmp = _r;
|
|
_tmp$1 = $substring(s, 2);
|
|
out = _tmp;
|
|
rest = _tmp$1;
|
|
$s = -1; return [out, rest];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parsePerlClassEscape }; } $f._entry = _entry; $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.g = g; $f.out = out; $f.p = p; $f.r = r; $f.rest = rest; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parsePerlClassEscape = function(s, r) { return this.$val.parsePerlClassEscape(s, r); };
|
|
parser.ptr.prototype.parseNamedClass = function(s, r) {
|
|
var _entry, _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, err, g, i, name, out, p, r, rest, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; err = $f.err; g = $f.g; i = $f.i; name = $f.name; out = $f.out; p = $f.p; r = $f.r; rest = $f.rest; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
out = sliceType.nil;
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
if (s.length < 2 || !((s.charCodeAt(0) === 91)) || !((s.charCodeAt(1) === 58))) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
i = strings.Index($substring(s, 2), ":]");
|
|
if (i < 0) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
i = i + (2) >> 0;
|
|
_tmp = $substring(s, 0, (i + 2 >> 0));
|
|
_tmp$1 = $substring(s, (i + 2 >> 0));
|
|
name = _tmp;
|
|
s = _tmp$1;
|
|
g = $clone((_entry = posixGroup[$String.keyFor(name)], _entry !== undefined ? _entry.v : new charGroup.ptr(0, sliceType.nil)), charGroup);
|
|
if (g.sign === 0) {
|
|
_tmp$2 = sliceType.nil;
|
|
_tmp$3 = "";
|
|
_tmp$4 = new Error.ptr("invalid character class range", name);
|
|
out = _tmp$2;
|
|
rest = _tmp$3;
|
|
err = _tmp$4;
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
_r = p.appendGroup(r, $clone(g, charGroup)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tmp$5 = _r;
|
|
_tmp$6 = s;
|
|
_tmp$7 = $ifaceNil;
|
|
out = _tmp$5;
|
|
rest = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [out, rest, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parseNamedClass }; } $f._entry = _entry; $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f.err = err; $f.g = g; $f.i = i; $f.name = name; $f.out = out; $f.p = p; $f.r = r; $f.rest = rest; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parseNamedClass = function(s, r) { return this.$val.parseNamedClass(s, r); };
|
|
parser.ptr.prototype.appendGroup = function(r, g) {
|
|
var _r, g, p, r, tmp, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; g = $f.g; p = $f.p; r = $f.r; tmp = $f.tmp; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = this;
|
|
/* */ if (((p.flags & 1) >>> 0) === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (((p.flags & 1) >>> 0) === 0) { */ case 1:
|
|
if (g.sign < 0) {
|
|
r = appendNegatedClass(r, g.class$1);
|
|
} else {
|
|
r = appendClass(r, g.class$1);
|
|
}
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
tmp = $subslice(p.tmpClass, 0, 0);
|
|
tmp = appendFoldedClass(tmp, g.class$1);
|
|
p.tmpClass = tmp;
|
|
_r = cleanClass((p.$ptr_tmpClass || (p.$ptr_tmpClass = new ptrType$2(function() { return this.$target.tmpClass; }, function($v) { this.$target.tmpClass = $v; }, p)))); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
tmp = _r;
|
|
if (g.sign < 0) {
|
|
r = appendNegatedClass(r, tmp);
|
|
} else {
|
|
r = appendClass(r, tmp);
|
|
}
|
|
/* } */ case 3:
|
|
$s = -1; return r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.appendGroup }; } $f._r = _r; $f.g = g; $f.p = p; $f.r = r; $f.tmp = tmp; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.appendGroup = function(r, g) { return this.$val.appendGroup(r, g); };
|
|
unicodeTable = function(name) {
|
|
var _entry, _entry$1, _entry$2, _entry$3, name, t, t$1;
|
|
if (name === "Any") {
|
|
return [anyTable, anyTable];
|
|
}
|
|
t = (_entry = unicode.Categories[$String.keyFor(name)], _entry !== undefined ? _entry.v : ptrType$3.nil);
|
|
if (!(t === ptrType$3.nil)) {
|
|
return [t, (_entry$1 = unicode.FoldCategory[$String.keyFor(name)], _entry$1 !== undefined ? _entry$1.v : ptrType$3.nil)];
|
|
}
|
|
t$1 = (_entry$2 = unicode.Scripts[$String.keyFor(name)], _entry$2 !== undefined ? _entry$2.v : ptrType$3.nil);
|
|
if (!(t$1 === ptrType$3.nil)) {
|
|
return [t$1, (_entry$3 = unicode.FoldScript[$String.keyFor(name)], _entry$3 !== undefined ? _entry$3.v : ptrType$3.nil)];
|
|
}
|
|
return [ptrType$3.nil, ptrType$3.nil];
|
|
};
|
|
parser.ptr.prototype.parseUnicodeClass = function(s, r) {
|
|
var _r, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, c, end, err, fold, name, out, p, r, rest, s, seq, sign, t, tab, tmp, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; c = $f.c; end = $f.end; err = $f.err; fold = $f.fold; name = $f.name; out = $f.out; p = $f.p; r = $f.r; rest = $f.rest; s = $f.s; seq = $f.seq; sign = $f.sign; t = $f.t; tab = $f.tab; tmp = $f.tmp; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
out = sliceType.nil;
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
if ((((p.flags & 128) >>> 0) === 0) || s.length < 2 || !((s.charCodeAt(0) === 92)) || !((s.charCodeAt(1) === 112)) && !((s.charCodeAt(1) === 80))) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
sign = 1;
|
|
if (s.charCodeAt(1) === 80) {
|
|
sign = -1;
|
|
}
|
|
t = $substring(s, 2);
|
|
_tuple = nextRune(t);
|
|
c = _tuple[0];
|
|
t = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
_tmp = "";
|
|
_tmp$1 = "";
|
|
seq = _tmp;
|
|
name = _tmp$1;
|
|
if (!((c === 123))) {
|
|
seq = $substring(s, 0, (s.length - t.length >> 0));
|
|
name = $substring(seq, 2);
|
|
} else {
|
|
end = strings.IndexRune(s, 125);
|
|
if (end < 0) {
|
|
err = checkUTF8(s);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
_tmp$2 = sliceType.nil;
|
|
_tmp$3 = "";
|
|
_tmp$4 = new Error.ptr("invalid character class range", s);
|
|
out = _tmp$2;
|
|
rest = _tmp$3;
|
|
err = _tmp$4;
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
_tmp$5 = $substring(s, 0, (end + 1 >> 0));
|
|
_tmp$6 = $substring(s, (end + 1 >> 0));
|
|
seq = _tmp$5;
|
|
t = _tmp$6;
|
|
name = $substring(s, 3, end);
|
|
err = checkUTF8(name);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
}
|
|
if (!(name === "") && (name.charCodeAt(0) === 94)) {
|
|
sign = -sign;
|
|
name = $substring(name, 1);
|
|
}
|
|
_tuple$1 = unicodeTable(name);
|
|
tab = _tuple$1[0];
|
|
fold = _tuple$1[1];
|
|
if (tab === ptrType$3.nil) {
|
|
_tmp$7 = sliceType.nil;
|
|
_tmp$8 = "";
|
|
_tmp$9 = new Error.ptr("invalid character class range", seq);
|
|
out = _tmp$7;
|
|
rest = _tmp$8;
|
|
err = _tmp$9;
|
|
$s = -1; return [out, rest, err];
|
|
}
|
|
/* */ if ((((p.flags & 1) >>> 0) === 0) || fold === ptrType$3.nil) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((((p.flags & 1) >>> 0) === 0) || fold === ptrType$3.nil) { */ case 1:
|
|
if (sign > 0) {
|
|
r = appendTable(r, tab);
|
|
} else {
|
|
r = appendNegatedTable(r, tab);
|
|
}
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
tmp = $subslice(p.tmpClass, 0, 0);
|
|
tmp = appendTable(tmp, tab);
|
|
tmp = appendTable(tmp, fold);
|
|
p.tmpClass = tmp;
|
|
_r = cleanClass((p.$ptr_tmpClass || (p.$ptr_tmpClass = new ptrType$2(function() { return this.$target.tmpClass; }, function($v) { this.$target.tmpClass = $v; }, p)))); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
tmp = _r;
|
|
if (sign > 0) {
|
|
r = appendClass(r, tmp);
|
|
} else {
|
|
r = appendNegatedClass(r, tmp);
|
|
}
|
|
/* } */ case 3:
|
|
_tmp$10 = r;
|
|
_tmp$11 = t;
|
|
_tmp$12 = $ifaceNil;
|
|
out = _tmp$10;
|
|
rest = _tmp$11;
|
|
err = _tmp$12;
|
|
$s = -1; return [out, rest, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parseUnicodeClass }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.c = c; $f.end = end; $f.err = err; $f.fold = fold; $f.name = name; $f.out = out; $f.p = p; $f.r = r; $f.rest = rest; $f.s = s; $f.seq = seq; $f.sign = sign; $f.t = t; $f.tab = tab; $f.tmp = tmp; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parseUnicodeClass = function(s, r) { return this.$val.parseUnicodeClass(s, r); };
|
|
parser.ptr.prototype.parseClass = function(s) {
|
|
var _r, _r$1, _r$2, _r$3, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, class$1, err, err$1, err$2, first, hi, lo, nclass, nclass$1, nclass$2, nt, nt$1, nt$2, p, re, rest, rng, s, sign, size, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$16 = $f._tmp$16; _tmp$17 = $f._tmp$17; _tmp$18 = $f._tmp$18; _tmp$19 = $f._tmp$19; _tmp$2 = $f._tmp$2; _tmp$20 = $f._tmp$20; _tmp$21 = $f._tmp$21; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; class$1 = $f.class$1; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; first = $f.first; hi = $f.hi; lo = $f.lo; nclass = $f.nclass; nclass$1 = $f.nclass$1; nclass$2 = $f.nclass$2; nt = $f.nt; nt$1 = $f.nt$1; nt$2 = $f.nt$2; p = $f.p; re = $f.re; rest = $f.rest; rng = $f.rng; s = $f.s; sign = $f.sign; size = $f.size; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
p = this;
|
|
t = $substring(s, 1);
|
|
re = p.newRegexp(4);
|
|
re.Flags = p.flags;
|
|
re.Rune = $subslice(new sliceType(re.Rune0), 0, 0);
|
|
sign = 1;
|
|
if (!(t === "") && (t.charCodeAt(0) === 94)) {
|
|
sign = -1;
|
|
t = $substring(t, 1);
|
|
if (((p.flags & 4) >>> 0) === 0) {
|
|
re.Rune = $append(re.Rune, 10, 10);
|
|
}
|
|
}
|
|
class$1 = re.Rune;
|
|
first = true;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(t === "" || !((t.charCodeAt(0) === 93)) || first)) { break; } */ if(!(t === "" || !((t.charCodeAt(0) === 93)) || first)) { $s = 2; continue; }
|
|
if (!(t === "") && (t.charCodeAt(0) === 45) && (((p.flags & 64) >>> 0) === 0) && !first && ((t.length === 1) || !((t.charCodeAt(1) === 93)))) {
|
|
_tuple = utf8.DecodeRuneInString($substring(t, 1));
|
|
size = _tuple[1];
|
|
_tmp = "";
|
|
_tmp$1 = new Error.ptr("invalid character class range", $substring(t, 0, (1 + size >> 0)));
|
|
rest = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
first = false;
|
|
/* */ if (t.length > 2 && (t.charCodeAt(0) === 91) && (t.charCodeAt(1) === 58)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (t.length > 2 && (t.charCodeAt(0) === 91) && (t.charCodeAt(1) === 58)) { */ case 3:
|
|
_r = p.parseNamedClass(t, class$1); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
nclass = _tuple$1[0];
|
|
nt = _tuple$1[1];
|
|
err$1 = _tuple$1[2];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp$2 = "";
|
|
_tmp$3 = err$1;
|
|
rest = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
if (!(nclass === sliceType.nil)) {
|
|
_tmp$4 = nclass;
|
|
_tmp$5 = nt;
|
|
class$1 = _tmp$4;
|
|
t = _tmp$5;
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
/* } */ case 4:
|
|
_r$1 = p.parseUnicodeClass(t, class$1); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$1;
|
|
nclass$1 = _tuple$2[0];
|
|
nt$1 = _tuple$2[1];
|
|
err$2 = _tuple$2[2];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
_tmp$6 = "";
|
|
_tmp$7 = err$2;
|
|
rest = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
/* */ if (!(nclass$1 === sliceType.nil)) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!(nclass$1 === sliceType.nil)) { */ case 7:
|
|
_tmp$8 = nclass$1;
|
|
_tmp$9 = nt$1;
|
|
class$1 = _tmp$8;
|
|
t = _tmp$9;
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 8:
|
|
_r$2 = p.parsePerlClassEscape(t, class$1); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$2;
|
|
nclass$2 = _tuple$3[0];
|
|
nt$2 = _tuple$3[1];
|
|
if (!(nclass$2 === sliceType.nil)) {
|
|
_tmp$10 = nclass$2;
|
|
_tmp$11 = nt$2;
|
|
class$1 = _tmp$10;
|
|
t = _tmp$11;
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
rng = t;
|
|
_tmp$12 = 0;
|
|
_tmp$13 = 0;
|
|
lo = _tmp$12;
|
|
hi = _tmp$13;
|
|
_tuple$4 = p.parseClassChar(t, s);
|
|
lo = _tuple$4[0];
|
|
t = _tuple$4[1];
|
|
err$2 = _tuple$4[2];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
_tmp$14 = "";
|
|
_tmp$15 = err$2;
|
|
rest = _tmp$14;
|
|
err = _tmp$15;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
hi = lo;
|
|
if (t.length >= 2 && (t.charCodeAt(0) === 45) && !((t.charCodeAt(1) === 93))) {
|
|
t = $substring(t, 1);
|
|
_tuple$5 = p.parseClassChar(t, s);
|
|
hi = _tuple$5[0];
|
|
t = _tuple$5[1];
|
|
err$2 = _tuple$5[2];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
_tmp$16 = "";
|
|
_tmp$17 = err$2;
|
|
rest = _tmp$16;
|
|
err = _tmp$17;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
if (hi < lo) {
|
|
rng = $substring(rng, 0, (rng.length - t.length >> 0));
|
|
_tmp$18 = "";
|
|
_tmp$19 = new Error.ptr("invalid character class range", rng);
|
|
rest = _tmp$18;
|
|
err = _tmp$19;
|
|
$s = -1; return [rest, err];
|
|
}
|
|
}
|
|
if (((p.flags & 1) >>> 0) === 0) {
|
|
class$1 = appendRange(class$1, lo, hi);
|
|
} else {
|
|
class$1 = appendFoldedRange(class$1, lo, hi);
|
|
}
|
|
/* } */ $s = 1; continue; case 2:
|
|
t = $substring(t, 1);
|
|
re.Rune = class$1;
|
|
_r$3 = cleanClass((re.$ptr_Rune || (re.$ptr_Rune = new ptrType$2(function() { return this.$target.Rune; }, function($v) { this.$target.Rune = $v; }, re)))); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
class$1 = _r$3;
|
|
if (sign < 0) {
|
|
class$1 = negateClass(class$1);
|
|
}
|
|
re.Rune = class$1;
|
|
p.push(re);
|
|
_tmp$20 = t;
|
|
_tmp$21 = $ifaceNil;
|
|
rest = _tmp$20;
|
|
err = _tmp$21;
|
|
$s = -1; return [rest, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parser.ptr.prototype.parseClass }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$16 = _tmp$16; $f._tmp$17 = _tmp$17; $f._tmp$18 = _tmp$18; $f._tmp$19 = _tmp$19; $f._tmp$2 = _tmp$2; $f._tmp$20 = _tmp$20; $f._tmp$21 = _tmp$21; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f.class$1 = class$1; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.first = first; $f.hi = hi; $f.lo = lo; $f.nclass = nclass; $f.nclass$1 = nclass$1; $f.nclass$2 = nclass$2; $f.nt = nt; $f.nt$1 = nt$1; $f.nt$2 = nt$2; $f.p = p; $f.re = re; $f.rest = rest; $f.rng = rng; $f.s = s; $f.sign = sign; $f.size = size; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parser.prototype.parseClass = function(s) { return this.$val.parseClass(s); };
|
|
cleanClass = function(rp) {
|
|
var _tmp, _tmp$1, hi, i, lo, r, rp, w, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; hi = $f.hi; i = $f.i; lo = $f.lo; r = $f.r; rp = $f.rp; w = $f.w; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = sort.Sort((x = new ranges.ptr(rp), new x.constructor.elem(x))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
r = rp.$get();
|
|
if (r.$length < 2) {
|
|
$s = -1; return r;
|
|
}
|
|
w = 2;
|
|
i = 2;
|
|
while (true) {
|
|
if (!(i < r.$length)) { break; }
|
|
_tmp = ((i < 0 || i >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + i]);
|
|
_tmp$1 = (x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$1]));
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
if (lo <= ((x$2 = w - 1 >> 0, ((x$2 < 0 || x$2 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$2])) + 1 >> 0)) {
|
|
if (hi > (x$3 = w - 1 >> 0, ((x$3 < 0 || x$3 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$3]))) {
|
|
(x$4 = w - 1 >> 0, ((x$4 < 0 || x$4 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$4] = hi));
|
|
}
|
|
i = i + (2) >> 0;
|
|
continue;
|
|
}
|
|
((w < 0 || w >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + w] = lo);
|
|
(x$5 = w + 1 >> 0, ((x$5 < 0 || x$5 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$5] = hi));
|
|
w = w + (2) >> 0;
|
|
i = i + (2) >> 0;
|
|
}
|
|
$s = -1; return $subslice(r, 0, w);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: cleanClass }; } $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.hi = hi; $f.i = i; $f.lo = lo; $f.r = r; $f.rp = rp; $f.w = w; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
appendLiteral = function(r, x, flags) {
|
|
var flags, r, x;
|
|
if (!((((flags & 1) >>> 0) === 0))) {
|
|
return appendFoldedRange(r, x, x);
|
|
}
|
|
return appendRange(r, x, x);
|
|
};
|
|
appendRange = function(r, lo, hi) {
|
|
var _tmp, _tmp$1, hi, i, lo, n, r, rhi, rlo, x, x$1, x$2, x$3;
|
|
n = r.$length;
|
|
i = 2;
|
|
while (true) {
|
|
if (!(i <= 4)) { break; }
|
|
if (n >= i) {
|
|
_tmp = (x = n - i >> 0, ((x < 0 || x >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x]));
|
|
_tmp$1 = (x$1 = (n - i >> 0) + 1 >> 0, ((x$1 < 0 || x$1 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$1]));
|
|
rlo = _tmp;
|
|
rhi = _tmp$1;
|
|
if (lo <= (rhi + 1 >> 0) && rlo <= (hi + 1 >> 0)) {
|
|
if (lo < rlo) {
|
|
(x$2 = n - i >> 0, ((x$2 < 0 || x$2 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$2] = lo));
|
|
}
|
|
if (hi > rhi) {
|
|
(x$3 = (n - i >> 0) + 1 >> 0, ((x$3 < 0 || x$3 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$3] = hi));
|
|
}
|
|
return r;
|
|
}
|
|
}
|
|
i = i + (2) >> 0;
|
|
}
|
|
return $append(r, lo, hi);
|
|
};
|
|
appendFoldedRange = function(r, lo, hi) {
|
|
var c, f, hi, lo, r;
|
|
if (lo <= 65 && hi >= 125251) {
|
|
return appendRange(r, lo, hi);
|
|
}
|
|
if (hi < 65 || lo > 125251) {
|
|
return appendRange(r, lo, hi);
|
|
}
|
|
if (lo < 65) {
|
|
r = appendRange(r, lo, 64);
|
|
lo = 65;
|
|
}
|
|
if (hi > 125251) {
|
|
r = appendRange(r, 125252, hi);
|
|
hi = 125251;
|
|
}
|
|
c = lo;
|
|
while (true) {
|
|
if (!(c <= hi)) { break; }
|
|
r = appendRange(r, c, c);
|
|
f = unicode.SimpleFold(c);
|
|
while (true) {
|
|
if (!(!((f === c)))) { break; }
|
|
r = appendRange(r, f, f);
|
|
f = unicode.SimpleFold(f);
|
|
}
|
|
c = c + (1) >> 0;
|
|
}
|
|
return r;
|
|
};
|
|
appendClass = function(r, x) {
|
|
var i, r, x, x$1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < x.$length)) { break; }
|
|
r = appendRange(r, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]), (x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])));
|
|
i = i + (2) >> 0;
|
|
}
|
|
return r;
|
|
};
|
|
appendFoldedClass = function(r, x) {
|
|
var i, r, x, x$1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < x.$length)) { break; }
|
|
r = appendFoldedRange(r, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]), (x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])));
|
|
i = i + (2) >> 0;
|
|
}
|
|
return r;
|
|
};
|
|
appendNegatedClass = function(r, x) {
|
|
var _tmp, _tmp$1, hi, i, lo, nextLo, r, x, x$1;
|
|
nextLo = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < x.$length)) { break; }
|
|
_tmp = ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]);
|
|
_tmp$1 = (x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
if (nextLo <= (lo - 1 >> 0)) {
|
|
r = appendRange(r, nextLo, lo - 1 >> 0);
|
|
}
|
|
nextLo = hi + 1 >> 0;
|
|
i = i + (2) >> 0;
|
|
}
|
|
if (nextLo <= 1114111) {
|
|
r = appendRange(r, nextLo, 1114111);
|
|
}
|
|
return r;
|
|
};
|
|
appendTable = function(r, x) {
|
|
var _i, _i$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, c, c$1, hi, hi$1, lo, lo$1, r, stride, stride$1, x, xr, xr$1;
|
|
_ref = x.R16;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
xr = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), unicode.Range16);
|
|
_tmp = ((xr.Lo >> 0));
|
|
_tmp$1 = ((xr.Hi >> 0));
|
|
_tmp$2 = ((xr.Stride >> 0));
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
stride = _tmp$2;
|
|
if (stride === 1) {
|
|
r = appendRange(r, lo, hi);
|
|
_i++;
|
|
continue;
|
|
}
|
|
c = lo;
|
|
while (true) {
|
|
if (!(c <= hi)) { break; }
|
|
r = appendRange(r, c, c);
|
|
c = c + (stride) >> 0;
|
|
}
|
|
_i++;
|
|
}
|
|
_ref$1 = x.R32;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
xr$1 = $clone(((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]), unicode.Range32);
|
|
_tmp$3 = ((xr$1.Lo >> 0));
|
|
_tmp$4 = ((xr$1.Hi >> 0));
|
|
_tmp$5 = ((xr$1.Stride >> 0));
|
|
lo$1 = _tmp$3;
|
|
hi$1 = _tmp$4;
|
|
stride$1 = _tmp$5;
|
|
if (stride$1 === 1) {
|
|
r = appendRange(r, lo$1, hi$1);
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
c$1 = lo$1;
|
|
while (true) {
|
|
if (!(c$1 <= hi$1)) { break; }
|
|
r = appendRange(r, c$1, c$1);
|
|
c$1 = c$1 + (stride$1) >> 0;
|
|
}
|
|
_i$1++;
|
|
}
|
|
return r;
|
|
};
|
|
appendNegatedTable = function(r, x) {
|
|
var _i, _i$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, c, c$1, hi, hi$1, lo, lo$1, nextLo, r, stride, stride$1, x, xr, xr$1;
|
|
nextLo = 0;
|
|
_ref = x.R16;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
xr = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), unicode.Range16);
|
|
_tmp = ((xr.Lo >> 0));
|
|
_tmp$1 = ((xr.Hi >> 0));
|
|
_tmp$2 = ((xr.Stride >> 0));
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
stride = _tmp$2;
|
|
if (stride === 1) {
|
|
if (nextLo <= (lo - 1 >> 0)) {
|
|
r = appendRange(r, nextLo, lo - 1 >> 0);
|
|
}
|
|
nextLo = hi + 1 >> 0;
|
|
_i++;
|
|
continue;
|
|
}
|
|
c = lo;
|
|
while (true) {
|
|
if (!(c <= hi)) { break; }
|
|
if (nextLo <= (c - 1 >> 0)) {
|
|
r = appendRange(r, nextLo, c - 1 >> 0);
|
|
}
|
|
nextLo = c + 1 >> 0;
|
|
c = c + (stride) >> 0;
|
|
}
|
|
_i++;
|
|
}
|
|
_ref$1 = x.R32;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
xr$1 = $clone(((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]), unicode.Range32);
|
|
_tmp$3 = ((xr$1.Lo >> 0));
|
|
_tmp$4 = ((xr$1.Hi >> 0));
|
|
_tmp$5 = ((xr$1.Stride >> 0));
|
|
lo$1 = _tmp$3;
|
|
hi$1 = _tmp$4;
|
|
stride$1 = _tmp$5;
|
|
if (stride$1 === 1) {
|
|
if (nextLo <= (lo$1 - 1 >> 0)) {
|
|
r = appendRange(r, nextLo, lo$1 - 1 >> 0);
|
|
}
|
|
nextLo = hi$1 + 1 >> 0;
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
c$1 = lo$1;
|
|
while (true) {
|
|
if (!(c$1 <= hi$1)) { break; }
|
|
if (nextLo <= (c$1 - 1 >> 0)) {
|
|
r = appendRange(r, nextLo, c$1 - 1 >> 0);
|
|
}
|
|
nextLo = c$1 + 1 >> 0;
|
|
c$1 = c$1 + (stride$1) >> 0;
|
|
}
|
|
_i$1++;
|
|
}
|
|
if (nextLo <= 1114111) {
|
|
r = appendRange(r, nextLo, 1114111);
|
|
}
|
|
return r;
|
|
};
|
|
negateClass = function(r) {
|
|
var _tmp, _tmp$1, hi, i, lo, nextLo, r, w, x, x$1;
|
|
nextLo = 0;
|
|
w = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < r.$length)) { break; }
|
|
_tmp = ((i < 0 || i >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + i]);
|
|
_tmp$1 = (x = i + 1 >> 0, ((x < 0 || x >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x]));
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
if (nextLo <= (lo - 1 >> 0)) {
|
|
((w < 0 || w >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + w] = nextLo);
|
|
(x$1 = w + 1 >> 0, ((x$1 < 0 || x$1 >= r.$length) ? ($throwRuntimeError("index out of range"), undefined) : r.$array[r.$offset + x$1] = (lo - 1 >> 0)));
|
|
w = w + (2) >> 0;
|
|
}
|
|
nextLo = hi + 1 >> 0;
|
|
i = i + (2) >> 0;
|
|
}
|
|
r = $subslice(r, 0, w);
|
|
if (nextLo <= 1114111) {
|
|
r = $append(r, nextLo, 1114111);
|
|
}
|
|
return r;
|
|
};
|
|
ranges.ptr.prototype.Less = function(i, j) {
|
|
var i, j, p, ra, x, x$1;
|
|
ra = this;
|
|
p = ra.p.$get();
|
|
i = $imul(i, (2));
|
|
j = $imul(j, (2));
|
|
return ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]) < ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]) || (((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]) === ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j])) && (x = i + 1 >> 0, ((x < 0 || x >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x])) > (x$1 = j + 1 >> 0, ((x$1 < 0 || x$1 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$1]));
|
|
};
|
|
ranges.prototype.Less = function(i, j) { return this.$val.Less(i, j); };
|
|
ranges.ptr.prototype.Len = function() {
|
|
var _q, ra;
|
|
ra = this;
|
|
return (_q = ra.p.$get().$length / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
};
|
|
ranges.prototype.Len = function() { return this.$val.Len(); };
|
|
ranges.ptr.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, i, j, p, ra, x, x$1, x$2, x$3;
|
|
ra = this;
|
|
p = ra.p.$get();
|
|
i = $imul(i, (2));
|
|
j = $imul(j, (2));
|
|
_tmp = ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]);
|
|
_tmp$1 = (x = j + 1 >> 0, ((x < 0 || x >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x]));
|
|
_tmp$2 = ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]);
|
|
_tmp$3 = (x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$1]));
|
|
((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i] = _tmp);
|
|
(x$2 = i + 1 >> 0, ((x$2 < 0 || x$2 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$2] = _tmp$1));
|
|
((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j] = _tmp$2);
|
|
(x$3 = j + 1 >> 0, ((x$3 < 0 || x$3 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$3] = _tmp$3));
|
|
};
|
|
ranges.prototype.Swap = function(i, j) { return this.$val.Swap(i, j); };
|
|
checkUTF8 = function(s) {
|
|
var _tuple, rune, s, size;
|
|
while (true) {
|
|
if (!(!(s === ""))) { break; }
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
rune = _tuple[0];
|
|
size = _tuple[1];
|
|
if ((rune === 65533) && (size === 1)) {
|
|
return new Error.ptr("invalid UTF-8", s);
|
|
}
|
|
s = $substring(s, size);
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
nextRune = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, c, err, s, size, t;
|
|
c = 0;
|
|
t = "";
|
|
err = $ifaceNil;
|
|
_tuple = utf8.DecodeRuneInString(s);
|
|
c = _tuple[0];
|
|
size = _tuple[1];
|
|
if ((c === 65533) && (size === 1)) {
|
|
_tmp = 0;
|
|
_tmp$1 = "";
|
|
_tmp$2 = new Error.ptr("invalid UTF-8", s);
|
|
c = _tmp;
|
|
t = _tmp$1;
|
|
err = _tmp$2;
|
|
return [c, t, err];
|
|
}
|
|
_tmp$3 = c;
|
|
_tmp$4 = $substring(s, size);
|
|
_tmp$5 = $ifaceNil;
|
|
c = _tmp$3;
|
|
t = _tmp$4;
|
|
err = _tmp$5;
|
|
return [c, t, err];
|
|
};
|
|
isalnum = function(c) {
|
|
var c;
|
|
return 48 <= c && c <= 57 || 65 <= c && c <= 90 || 97 <= c && c <= 122;
|
|
};
|
|
unhex = function(c) {
|
|
var c;
|
|
if (48 <= c && c <= 57) {
|
|
return c - 48 >> 0;
|
|
}
|
|
if (97 <= c && c <= 102) {
|
|
return (c - 97 >> 0) + 10 >> 0;
|
|
}
|
|
if (65 <= c && c <= 70) {
|
|
return (c - 65 >> 0) + 10 >> 0;
|
|
}
|
|
return -1;
|
|
};
|
|
InstOp.prototype.String = function() {
|
|
var i;
|
|
i = this.$val;
|
|
if (((i >>> 0)) >= ((instOpNames.$length >>> 0))) {
|
|
return "";
|
|
}
|
|
return ((i < 0 || i >= instOpNames.$length) ? ($throwRuntimeError("index out of range"), undefined) : instOpNames.$array[instOpNames.$offset + i]);
|
|
};
|
|
$ptrType(InstOp).prototype.String = function() { return new InstOp(this.$get()).String(); };
|
|
IsWordChar = function(r) {
|
|
var r;
|
|
return 65 <= r && r <= 90 || 97 <= r && r <= 122 || 48 <= r && r <= 57 || (r === 95);
|
|
};
|
|
$pkg.IsWordChar = IsWordChar;
|
|
Prog.ptr.prototype.String = function() {
|
|
var b, p;
|
|
p = this;
|
|
b = new strings.Builder.ptr(ptrType$4.nil, sliceType$6.nil);
|
|
dumpProg(b, p);
|
|
return b.String();
|
|
};
|
|
Prog.prototype.String = function() { return this.$val.String(); };
|
|
Prog.ptr.prototype.skipNop = function(pc) {
|
|
var i, p, pc, x, x$1, x$2;
|
|
p = this;
|
|
i = (x = p.Inst, ((pc < 0 || pc >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pc]));
|
|
while (true) {
|
|
if (!((i.Op === 6) || (i.Op === 2))) { break; }
|
|
i = (x$1 = p.Inst, x$2 = i.Out, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2]));
|
|
}
|
|
return i;
|
|
};
|
|
Prog.prototype.skipNop = function(pc) { return this.$val.skipNop(pc); };
|
|
Inst.ptr.prototype.op = function() {
|
|
var _1, i, op;
|
|
i = this;
|
|
op = i.Op;
|
|
_1 = op;
|
|
if ((_1 === (8)) || (_1 === (9)) || (_1 === (10))) {
|
|
op = 7;
|
|
}
|
|
return op;
|
|
};
|
|
Inst.prototype.op = function() { return this.$val.op(); };
|
|
Prog.ptr.prototype.Prefix = function() {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, buf, complete, i, p, prefix, x;
|
|
prefix = "";
|
|
complete = false;
|
|
p = this;
|
|
i = p.skipNop(((p.Start >>> 0)));
|
|
if (!((i.op() === 7)) || !((i.Rune.$length === 1))) {
|
|
_tmp = "";
|
|
_tmp$1 = i.Op === 4;
|
|
prefix = _tmp;
|
|
complete = _tmp$1;
|
|
return [prefix, complete];
|
|
}
|
|
buf = new strings.Builder.ptr(ptrType$4.nil, sliceType$6.nil);
|
|
while (true) {
|
|
if (!((i.op() === 7) && (i.Rune.$length === 1) && (((((i.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { break; }
|
|
buf.WriteRune((x = i.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])));
|
|
i = p.skipNop(i.Out);
|
|
}
|
|
_tmp$2 = buf.String();
|
|
_tmp$3 = i.Op === 4;
|
|
prefix = _tmp$2;
|
|
complete = _tmp$3;
|
|
return [prefix, complete];
|
|
};
|
|
Prog.prototype.Prefix = function() { return this.$val.Prefix(); };
|
|
Prog.ptr.prototype.StartCond = function() {
|
|
var _1, flag, i, p, pc, x, x$1;
|
|
p = this;
|
|
flag = 0;
|
|
pc = ((p.Start >>> 0));
|
|
i = (x = p.Inst, ((pc < 0 || pc >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pc]));
|
|
Loop:
|
|
while (true) {
|
|
_1 = i.Op;
|
|
if (_1 === (3)) {
|
|
flag = (flag | (((i.Arg << 24 >>> 24)))) >>> 0;
|
|
} else if (_1 === (5)) {
|
|
return 255;
|
|
} else if ((_1 === (2)) || (_1 === (6))) {
|
|
} else {
|
|
break Loop;
|
|
}
|
|
pc = i.Out;
|
|
i = (x$1 = p.Inst, ((pc < 0 || pc >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + pc]));
|
|
}
|
|
return flag;
|
|
};
|
|
Prog.prototype.StartCond = function() { return this.$val.StartCond(); };
|
|
Inst.ptr.prototype.MatchRune = function(r) {
|
|
var i, r;
|
|
i = this;
|
|
return !((i.MatchRunePos(r) === -1));
|
|
};
|
|
Inst.prototype.MatchRune = function(r) { return this.$val.MatchRune(r); };
|
|
Inst.ptr.prototype.MatchRunePos = function(r) {
|
|
var _1, _q, _q$1, _q$2, c, hi, i, j, lo, m, r, r0, r1, rune, x, x$1, x$2;
|
|
i = this;
|
|
rune = i.Rune;
|
|
_1 = rune.$length;
|
|
if (_1 === (0)) {
|
|
return -1;
|
|
} else if (_1 === (1)) {
|
|
r0 = (0 >= rune.$length ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + 0]);
|
|
if (r === r0) {
|
|
return 0;
|
|
}
|
|
if (!((((((i.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) {
|
|
r1 = unicode.SimpleFold(r0);
|
|
while (true) {
|
|
if (!(!((r1 === r0)))) { break; }
|
|
if (r === r1) {
|
|
return 0;
|
|
}
|
|
r1 = unicode.SimpleFold(r1);
|
|
}
|
|
}
|
|
return -1;
|
|
} else if (_1 === (2)) {
|
|
if (r >= (0 >= rune.$length ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + 0]) && r <= (1 >= rune.$length ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + 1])) {
|
|
return 0;
|
|
}
|
|
return -1;
|
|
} else if ((_1 === (4)) || (_1 === (6)) || (_1 === (8))) {
|
|
j = 0;
|
|
while (true) {
|
|
if (!(j < rune.$length)) { break; }
|
|
if (r < ((j < 0 || j >= rune.$length) ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + j])) {
|
|
return -1;
|
|
}
|
|
if (r <= (x = j + 1 >> 0, ((x < 0 || x >= rune.$length) ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + x]))) {
|
|
return (_q = j / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
}
|
|
j = j + (2) >> 0;
|
|
}
|
|
return -1;
|
|
}
|
|
lo = 0;
|
|
hi = (_q$1 = rune.$length / 2, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
while (true) {
|
|
if (!(lo < hi)) { break; }
|
|
m = lo + (_q$2 = ((hi - lo >> 0)) / 2, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
|
|
c = (x$1 = $imul(2, m), ((x$1 < 0 || x$1 >= rune.$length) ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + x$1]));
|
|
if (c <= r) {
|
|
if (r <= (x$2 = ($imul(2, m)) + 1 >> 0, ((x$2 < 0 || x$2 >= rune.$length) ? ($throwRuntimeError("index out of range"), undefined) : rune.$array[rune.$offset + x$2]))) {
|
|
return m;
|
|
}
|
|
lo = m + 1 >> 0;
|
|
} else {
|
|
hi = m;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
Inst.prototype.MatchRunePos = function(r) { return this.$val.MatchRunePos(r); };
|
|
Inst.ptr.prototype.MatchEmptyWidth = function(before, after) {
|
|
var _1, after, before, i;
|
|
i = this;
|
|
_1 = ((i.Arg << 24 >>> 24));
|
|
if (_1 === (1)) {
|
|
return (before === 10) || (before === -1);
|
|
} else if (_1 === (2)) {
|
|
return (after === 10) || (after === -1);
|
|
} else if (_1 === (4)) {
|
|
return before === -1;
|
|
} else if (_1 === (8)) {
|
|
return after === -1;
|
|
} else if (_1 === (16)) {
|
|
return !(IsWordChar(before) === IsWordChar(after));
|
|
} else if (_1 === (32)) {
|
|
return IsWordChar(before) === IsWordChar(after);
|
|
}
|
|
$panic(new $String("unknown empty width arg"));
|
|
};
|
|
Inst.prototype.MatchEmptyWidth = function(before, after) { return this.$val.MatchEmptyWidth(before, after); };
|
|
Inst.ptr.prototype.String = function() {
|
|
var b, i;
|
|
i = this;
|
|
b = new strings.Builder.ptr(ptrType$4.nil, sliceType$6.nil);
|
|
dumpInst(b, i);
|
|
return b.String();
|
|
};
|
|
Inst.prototype.String = function() { return this.$val.String(); };
|
|
bw = function(b, args) {
|
|
var _i, _ref, args, b, s;
|
|
_ref = args;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
s = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
b.WriteString(s);
|
|
_i++;
|
|
}
|
|
};
|
|
dumpProg = function(b, p) {
|
|
var _i, _ref, b, i, j, p, pc, x;
|
|
_ref = p.Inst;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
j = _i;
|
|
i = (x = p.Inst, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j]));
|
|
pc = strconv.Itoa(j);
|
|
if (pc.length < 3) {
|
|
b.WriteString($substring(" ", pc.length));
|
|
}
|
|
if (j === p.Start) {
|
|
pc = pc + ("*");
|
|
}
|
|
bw(b, new sliceType$3([pc, "\t"]));
|
|
dumpInst(b, i);
|
|
bw(b, new sliceType$3(["\n"]));
|
|
_i++;
|
|
}
|
|
};
|
|
u32 = function(i) {
|
|
var i;
|
|
return strconv.FormatUint((new $Uint64(0, i)), 10);
|
|
};
|
|
dumpInst = function(b, i) {
|
|
var _1, b, i;
|
|
_1 = i.Op;
|
|
if (_1 === (0)) {
|
|
bw(b, new sliceType$3(["alt -> ", u32(i.Out), ", ", u32(i.Arg)]));
|
|
} else if (_1 === (1)) {
|
|
bw(b, new sliceType$3(["altmatch -> ", u32(i.Out), ", ", u32(i.Arg)]));
|
|
} else if (_1 === (2)) {
|
|
bw(b, new sliceType$3(["cap ", u32(i.Arg), " -> ", u32(i.Out)]));
|
|
} else if (_1 === (3)) {
|
|
bw(b, new sliceType$3(["empty ", u32(i.Arg), " -> ", u32(i.Out)]));
|
|
} else if (_1 === (4)) {
|
|
bw(b, new sliceType$3(["match"]));
|
|
} else if (_1 === (5)) {
|
|
bw(b, new sliceType$3(["fail"]));
|
|
} else if (_1 === (6)) {
|
|
bw(b, new sliceType$3(["nop -> ", u32(i.Out)]));
|
|
} else if (_1 === (7)) {
|
|
if (i.Rune === sliceType.nil) {
|
|
bw(b, new sliceType$3(["rune <nil>"]));
|
|
}
|
|
bw(b, new sliceType$3(["rune ", strconv.QuoteToASCII(($runesToString(i.Rune)))]));
|
|
if (!((((((i.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) {
|
|
bw(b, new sliceType$3(["/i"]));
|
|
}
|
|
bw(b, new sliceType$3([" -> ", u32(i.Out)]));
|
|
} else if (_1 === (8)) {
|
|
bw(b, new sliceType$3(["rune1 ", strconv.QuoteToASCII(($runesToString(i.Rune))), " -> ", u32(i.Out)]));
|
|
} else if (_1 === (9)) {
|
|
bw(b, new sliceType$3(["any -> ", u32(i.Out)]));
|
|
} else if (_1 === (10)) {
|
|
bw(b, new sliceType$3(["anynotnl -> ", u32(i.Out)]));
|
|
}
|
|
};
|
|
Regexp.ptr.prototype.Equal = function(y) {
|
|
var _1, _i, _i$1, _ref, _ref$1, i, i$1, r, sub, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, y;
|
|
x = this;
|
|
if (x === ptrType$1.nil || y === ptrType$1.nil) {
|
|
return x === y;
|
|
}
|
|
if (!((x.Op === y.Op))) {
|
|
return false;
|
|
}
|
|
_1 = x.Op;
|
|
if (_1 === (10)) {
|
|
if (!((((x.Flags & 256) >>> 0) === ((y.Flags & 256) >>> 0)))) {
|
|
return false;
|
|
}
|
|
} else if ((_1 === (3)) || (_1 === (4))) {
|
|
if (!((x.Rune.$length === y.Rune.$length))) {
|
|
return false;
|
|
}
|
|
_ref = x.Rune;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
r = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!((r === (x$1 = y.Rune, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i]))))) {
|
|
return false;
|
|
}
|
|
_i++;
|
|
}
|
|
} else if ((_1 === (19)) || (_1 === (18))) {
|
|
if (!((x.Sub.$length === y.Sub.$length))) {
|
|
return false;
|
|
}
|
|
_ref$1 = x.Sub;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
sub = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
if (!sub.Equal((x$2 = y.Sub, ((i$1 < 0 || i$1 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i$1])))) {
|
|
return false;
|
|
}
|
|
_i$1++;
|
|
}
|
|
} else if ((_1 === (14)) || (_1 === (15)) || (_1 === (16))) {
|
|
if (!((((x.Flags & 32) >>> 0) === ((y.Flags & 32) >>> 0))) || !(x$3 = x.Sub, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).Equal((x$4 = y.Sub, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0])))) {
|
|
return false;
|
|
}
|
|
} else if (_1 === (17)) {
|
|
if (!((((x.Flags & 32) >>> 0) === ((y.Flags & 32) >>> 0))) || !((x.Min === y.Min)) || !((x.Max === y.Max)) || !(x$5 = x.Sub, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0])).Equal((x$6 = y.Sub, (0 >= x$6.$length ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + 0])))) {
|
|
return false;
|
|
}
|
|
} else if (_1 === (13)) {
|
|
if (!((x.Cap === y.Cap)) || !(x.Name === y.Name) || !(x$7 = x.Sub, (0 >= x$7.$length ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + 0])).Equal((x$8 = y.Sub, (0 >= x$8.$length ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + 0])))) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
Regexp.prototype.Equal = function(y) { return this.$val.Equal(y); };
|
|
writeRegexp = function(b, re) {
|
|
var _1, _2, _i, _i$1, _i$2, _r, _ref, _ref$1, _ref$2, _tmp, _tmp$1, _tmp$2, _tmp$3, b, hi, hi$1, i, i$1, i$2, lo, lo$1, r, re, sub, sub$1, sub$2, x, x$1, x$10, x$11, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
switch (0) { default:
|
|
_1 = re.Op;
|
|
if (_1 === (1)) {
|
|
b.WriteString("[^\\x00-\\x{10FFFF}]");
|
|
} else if (_1 === (2)) {
|
|
b.WriteString("(?:)");
|
|
} else if (_1 === (3)) {
|
|
if (!((((re.Flags & 1) >>> 0) === 0))) {
|
|
b.WriteString("(?i:");
|
|
}
|
|
_ref = re.Rune;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
r = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
escape(b, r, false);
|
|
_i++;
|
|
}
|
|
if (!((((re.Flags & 1) >>> 0) === 0))) {
|
|
b.WriteString(")");
|
|
}
|
|
} else if (_1 === (4)) {
|
|
if (!(((_r = re.Rune.$length % 2, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0))) {
|
|
b.WriteString("[invalid char class]");
|
|
break;
|
|
}
|
|
b.WriteRune(91);
|
|
if (re.Rune.$length === 0) {
|
|
b.WriteString("^\\x00-\\x{10FFFF}");
|
|
} else if (((x = re.Rune, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])) === 0) && ((x$1 = re.Rune, x$2 = re.Rune.$length - 1 >> 0, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2])) === 1114111)) {
|
|
b.WriteRune(94);
|
|
i = 1;
|
|
while (true) {
|
|
if (!(i < (re.Rune.$length - 1 >> 0))) { break; }
|
|
_tmp = (x$3 = re.Rune, ((i < 0 || i >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + i])) + 1 >> 0;
|
|
_tmp$1 = (x$4 = re.Rune, x$5 = i + 1 >> 0, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])) - 1 >> 0;
|
|
lo = _tmp;
|
|
hi = _tmp$1;
|
|
escape(b, lo, lo === 45);
|
|
if (!((lo === hi))) {
|
|
b.WriteRune(45);
|
|
escape(b, hi, hi === 45);
|
|
}
|
|
i = i + (2) >> 0;
|
|
}
|
|
} else {
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < re.Rune.$length)) { break; }
|
|
_tmp$2 = (x$6 = re.Rune, ((i$1 < 0 || i$1 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + i$1]));
|
|
_tmp$3 = (x$7 = re.Rune, x$8 = i$1 + 1 >> 0, ((x$8 < 0 || x$8 >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + x$8]));
|
|
lo$1 = _tmp$2;
|
|
hi$1 = _tmp$3;
|
|
escape(b, lo$1, lo$1 === 45);
|
|
if (!((lo$1 === hi$1))) {
|
|
b.WriteRune(45);
|
|
escape(b, hi$1, hi$1 === 45);
|
|
}
|
|
i$1 = i$1 + (2) >> 0;
|
|
}
|
|
}
|
|
b.WriteRune(93);
|
|
} else if (_1 === (5)) {
|
|
b.WriteString("(?-s:.)");
|
|
} else if (_1 === (6)) {
|
|
b.WriteString("(?s:.)");
|
|
} else if (_1 === (7)) {
|
|
b.WriteString("(?m:^)");
|
|
} else if (_1 === (8)) {
|
|
b.WriteString("(?m:$)");
|
|
} else if (_1 === (9)) {
|
|
b.WriteString("\\A");
|
|
} else if (_1 === (10)) {
|
|
if (!((((re.Flags & 256) >>> 0) === 0))) {
|
|
b.WriteString("(?-m:$)");
|
|
} else {
|
|
b.WriteString("\\z");
|
|
}
|
|
} else if (_1 === (11)) {
|
|
b.WriteString("\\b");
|
|
} else if (_1 === (12)) {
|
|
b.WriteString("\\B");
|
|
} else if (_1 === (13)) {
|
|
if (!(re.Name === "")) {
|
|
b.WriteString("(?P<");
|
|
b.WriteString(re.Name);
|
|
b.WriteRune(62);
|
|
} else {
|
|
b.WriteRune(40);
|
|
}
|
|
if (!(((x$9 = re.Sub, (0 >= x$9.$length ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + 0])).Op === 2))) {
|
|
writeRegexp(b, (x$10 = re.Sub, (0 >= x$10.$length ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + 0])));
|
|
}
|
|
b.WriteRune(41);
|
|
} else if ((_1 === (14)) || (_1 === (15)) || (_1 === (16)) || (_1 === (17))) {
|
|
sub = (x$11 = re.Sub, (0 >= x$11.$length ? ($throwRuntimeError("index out of range"), undefined) : x$11.$array[x$11.$offset + 0]));
|
|
if (sub.Op > 13 || (sub.Op === 3) && sub.Rune.$length > 1) {
|
|
b.WriteString("(?:");
|
|
writeRegexp(b, sub);
|
|
b.WriteString(")");
|
|
} else {
|
|
writeRegexp(b, sub);
|
|
}
|
|
_2 = re.Op;
|
|
if (_2 === (14)) {
|
|
b.WriteRune(42);
|
|
} else if (_2 === (15)) {
|
|
b.WriteRune(43);
|
|
} else if (_2 === (16)) {
|
|
b.WriteRune(63);
|
|
} else if (_2 === (17)) {
|
|
b.WriteRune(123);
|
|
b.WriteString(strconv.Itoa(re.Min));
|
|
if (!((re.Max === re.Min))) {
|
|
b.WriteRune(44);
|
|
if (re.Max >= 0) {
|
|
b.WriteString(strconv.Itoa(re.Max));
|
|
}
|
|
}
|
|
b.WriteRune(125);
|
|
}
|
|
if (!((((re.Flags & 32) >>> 0) === 0))) {
|
|
b.WriteRune(63);
|
|
}
|
|
} else if (_1 === (18)) {
|
|
_ref$1 = re.Sub;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
sub$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
if (sub$1.Op === 19) {
|
|
b.WriteString("(?:");
|
|
writeRegexp(b, sub$1);
|
|
b.WriteString(")");
|
|
} else {
|
|
writeRegexp(b, sub$1);
|
|
}
|
|
_i$1++;
|
|
}
|
|
} else if (_1 === (19)) {
|
|
_ref$2 = re.Sub;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
i$2 = _i$2;
|
|
sub$2 = ((_i$2 < 0 || _i$2 >= _ref$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$2.$array[_ref$2.$offset + _i$2]);
|
|
if (i$2 > 0) {
|
|
b.WriteRune(124);
|
|
}
|
|
writeRegexp(b, sub$2);
|
|
_i$2++;
|
|
}
|
|
} else {
|
|
b.WriteString("<invalid op" + strconv.Itoa(((re.Op >> 0))) + ">");
|
|
}
|
|
}
|
|
};
|
|
Regexp.ptr.prototype.String = function() {
|
|
var b, re;
|
|
re = this;
|
|
b = new strings.Builder.ptr(ptrType$4.nil, sliceType$6.nil);
|
|
writeRegexp(b, re);
|
|
return b.String();
|
|
};
|
|
Regexp.prototype.String = function() { return this.$val.String(); };
|
|
escape = function(b, r, force) {
|
|
var _1, b, force, r, s;
|
|
if (unicode.IsPrint(r)) {
|
|
if (strings.ContainsRune("\\.+*?()|[]{}^$", r) || force) {
|
|
b.WriteRune(92);
|
|
}
|
|
b.WriteRune(r);
|
|
return;
|
|
}
|
|
switch (0) { default:
|
|
_1 = r;
|
|
if (_1 === (7)) {
|
|
b.WriteString("\\a");
|
|
} else if (_1 === (12)) {
|
|
b.WriteString("\\f");
|
|
} else if (_1 === (10)) {
|
|
b.WriteString("\\n");
|
|
} else if (_1 === (13)) {
|
|
b.WriteString("\\r");
|
|
} else if (_1 === (9)) {
|
|
b.WriteString("\\t");
|
|
} else if (_1 === (11)) {
|
|
b.WriteString("\\v");
|
|
} else {
|
|
if (r < 256) {
|
|
b.WriteString("\\x");
|
|
s = strconv.FormatInt((new $Int64(0, r)), 16);
|
|
if (s.length === 1) {
|
|
b.WriteRune(48);
|
|
}
|
|
b.WriteString(s);
|
|
break;
|
|
}
|
|
b.WriteString("\\x{");
|
|
b.WriteString(strconv.FormatInt((new $Int64(0, r)), 16));
|
|
b.WriteString("}");
|
|
}
|
|
}
|
|
};
|
|
Regexp.ptr.prototype.MaxCap = function() {
|
|
var _i, _ref, m, n, re, sub;
|
|
re = this;
|
|
m = 0;
|
|
if (re.Op === 13) {
|
|
m = re.Cap;
|
|
}
|
|
_ref = re.Sub;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
sub = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
n = sub.MaxCap();
|
|
if (m < n) {
|
|
m = n;
|
|
}
|
|
_i++;
|
|
}
|
|
return m;
|
|
};
|
|
Regexp.prototype.MaxCap = function() { return this.$val.MaxCap(); };
|
|
Regexp.ptr.prototype.CapNames = function() {
|
|
var names, re;
|
|
re = this;
|
|
names = $makeSlice(sliceType$3, (re.MaxCap() + 1 >> 0));
|
|
re.capNames(names);
|
|
return names;
|
|
};
|
|
Regexp.prototype.CapNames = function() { return this.$val.CapNames(); };
|
|
Regexp.ptr.prototype.capNames = function(names) {
|
|
var _i, _ref, names, re, sub, x;
|
|
re = this;
|
|
if (re.Op === 13) {
|
|
(x = re.Cap, ((x < 0 || x >= names.$length) ? ($throwRuntimeError("index out of range"), undefined) : names.$array[names.$offset + x] = re.Name));
|
|
}
|
|
_ref = re.Sub;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
sub = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
sub.capNames(names);
|
|
_i++;
|
|
}
|
|
};
|
|
Regexp.prototype.capNames = function(names) { return this.$val.capNames(names); };
|
|
Regexp.ptr.prototype.Simplify = function() {
|
|
var _1, _i, _ref, i, i$1, i$2, i$3, nre, nre$1, nre2, nsub, prefix, re, sub, sub$1, sub$2, suffix, x, x$1;
|
|
re = this;
|
|
if (re === ptrType$1.nil) {
|
|
return ptrType$1.nil;
|
|
}
|
|
_1 = re.Op;
|
|
if ((_1 === (13)) || (_1 === (18)) || (_1 === (19))) {
|
|
nre = re;
|
|
_ref = re.Sub;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
sub = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
nsub = sub.Simplify();
|
|
if (nre === re && !(nsub === sub)) {
|
|
nre = new Regexp.ptr(0, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
Regexp.copy(nre, re);
|
|
nre.Rune = sliceType.nil;
|
|
nre.Sub = $appendSlice($subslice(new sliceType$5(nre.Sub0), 0, 0), $subslice(re.Sub, 0, i));
|
|
}
|
|
if (!(nre === re)) {
|
|
nre.Sub = $append(nre.Sub, nsub);
|
|
}
|
|
_i++;
|
|
}
|
|
return nre;
|
|
} else if ((_1 === (14)) || (_1 === (15)) || (_1 === (16))) {
|
|
sub$1 = (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])).Simplify();
|
|
return simplify1(re.Op, re.Flags, sub$1, re);
|
|
} else if (_1 === (17)) {
|
|
if ((re.Min === 0) && (re.Max === 0)) {
|
|
return new Regexp.ptr(2, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
}
|
|
sub$2 = (x$1 = re.Sub, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])).Simplify();
|
|
if (re.Max === -1) {
|
|
if (re.Min === 0) {
|
|
return simplify1(14, re.Flags, sub$2, ptrType$1.nil);
|
|
}
|
|
if (re.Min === 1) {
|
|
return simplify1(15, re.Flags, sub$2, ptrType$1.nil);
|
|
}
|
|
nre$1 = new Regexp.ptr(18, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
nre$1.Sub = $subslice(new sliceType$5(nre$1.Sub0), 0, 0);
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < (re.Min - 1 >> 0))) { break; }
|
|
nre$1.Sub = $append(nre$1.Sub, sub$2);
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
nre$1.Sub = $append(nre$1.Sub, simplify1(15, re.Flags, sub$2, ptrType$1.nil));
|
|
return nre$1;
|
|
}
|
|
if ((re.Min === 1) && (re.Max === 1)) {
|
|
return sub$2;
|
|
}
|
|
prefix = ptrType$1.nil;
|
|
if (re.Min > 0) {
|
|
prefix = new Regexp.ptr(18, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
prefix.Sub = $subslice(new sliceType$5(prefix.Sub0), 0, 0);
|
|
i$2 = 0;
|
|
while (true) {
|
|
if (!(i$2 < re.Min)) { break; }
|
|
prefix.Sub = $append(prefix.Sub, sub$2);
|
|
i$2 = i$2 + (1) >> 0;
|
|
}
|
|
}
|
|
if (re.Max > re.Min) {
|
|
suffix = simplify1(16, re.Flags, sub$2, ptrType$1.nil);
|
|
i$3 = re.Min + 1 >> 0;
|
|
while (true) {
|
|
if (!(i$3 < re.Max)) { break; }
|
|
nre2 = new Regexp.ptr(18, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
nre2.Sub = $append($subslice(new sliceType$5(nre2.Sub0), 0, 0), sub$2, suffix);
|
|
suffix = simplify1(16, re.Flags, nre2, ptrType$1.nil);
|
|
i$3 = i$3 + (1) >> 0;
|
|
}
|
|
if (prefix === ptrType$1.nil) {
|
|
return suffix;
|
|
}
|
|
prefix.Sub = $append(prefix.Sub, suffix);
|
|
}
|
|
if (!(prefix === ptrType$1.nil)) {
|
|
return prefix;
|
|
}
|
|
return new Regexp.ptr(1, 0, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
}
|
|
return re;
|
|
};
|
|
Regexp.prototype.Simplify = function() { return this.$val.Simplify(); };
|
|
simplify1 = function(op, flags, sub, re) {
|
|
var flags, op, re, sub, x;
|
|
if (sub.Op === 2) {
|
|
return sub;
|
|
}
|
|
if ((op === sub.Op) && (((flags & 32) >>> 0) === ((sub.Flags & 32) >>> 0))) {
|
|
return sub;
|
|
}
|
|
if (!(re === ptrType$1.nil) && (re.Op === op) && (((re.Flags & 32) >>> 0) === ((flags & 32) >>> 0)) && sub === (x = re.Sub, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]))) {
|
|
return re;
|
|
}
|
|
re = new Regexp.ptr(op, flags, sliceType$5.nil, arrayType.zero(), sliceType.nil, arrayType$1.zero(), 0, 0, 0, "");
|
|
re.Sub = $append($subslice(new sliceType$5(re.Sub0), 0, 0), sub);
|
|
return re;
|
|
};
|
|
patchList.methods = [{prop: "next", name: "next", pkg: "regexp/syntax", typ: $funcType([ptrType], [patchList], false)}, {prop: "patch", name: "patch", pkg: "regexp/syntax", typ: $funcType([ptrType, $Uint32], [], false)}, {prop: "append", name: "append", pkg: "regexp/syntax", typ: $funcType([ptrType, patchList], [patchList], false)}];
|
|
ptrType$5.methods = [{prop: "init", name: "init", pkg: "regexp/syntax", typ: $funcType([], [], false)}, {prop: "compile", name: "compile", pkg: "regexp/syntax", typ: $funcType([ptrType$1], [frag], false)}, {prop: "inst", name: "inst", pkg: "regexp/syntax", typ: $funcType([InstOp], [frag], false)}, {prop: "nop", name: "nop", pkg: "regexp/syntax", typ: $funcType([], [frag], false)}, {prop: "fail", name: "fail", pkg: "regexp/syntax", typ: $funcType([], [frag], false)}, {prop: "cap", name: "cap", pkg: "regexp/syntax", typ: $funcType([$Uint32], [frag], false)}, {prop: "cat", name: "cat", pkg: "regexp/syntax", typ: $funcType([frag, frag], [frag], false)}, {prop: "alt", name: "alt", pkg: "regexp/syntax", typ: $funcType([frag, frag], [frag], false)}, {prop: "quest", name: "quest", pkg: "regexp/syntax", typ: $funcType([frag, $Bool], [frag], false)}, {prop: "star", name: "star", pkg: "regexp/syntax", typ: $funcType([frag, $Bool], [frag], false)}, {prop: "plus", name: "plus", pkg: "regexp/syntax", typ: $funcType([frag, $Bool], [frag], false)}, {prop: "empty", name: "empty", pkg: "regexp/syntax", typ: $funcType([EmptyOp], [frag], false)}, {prop: "rune", name: "rune", pkg: "regexp/syntax", typ: $funcType([sliceType, Flags], [frag], false)}];
|
|
ptrType$6.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ErrorCode.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$7.methods = [{prop: "newRegexp", name: "newRegexp", pkg: "regexp/syntax", typ: $funcType([Op], [ptrType$1], false)}, {prop: "reuse", name: "reuse", pkg: "regexp/syntax", typ: $funcType([ptrType$1], [], false)}, {prop: "push", name: "push", pkg: "regexp/syntax", typ: $funcType([ptrType$1], [ptrType$1], false)}, {prop: "maybeConcat", name: "maybeConcat", pkg: "regexp/syntax", typ: $funcType([$Int32, Flags], [$Bool], false)}, {prop: "newLiteral", name: "newLiteral", pkg: "regexp/syntax", typ: $funcType([$Int32, Flags], [ptrType$1], false)}, {prop: "literal", name: "literal", pkg: "regexp/syntax", typ: $funcType([$Int32], [], false)}, {prop: "op", name: "op", pkg: "regexp/syntax", typ: $funcType([Op], [ptrType$1], false)}, {prop: "repeat", name: "repeat", pkg: "regexp/syntax", typ: $funcType([Op, $Int, $Int, $String, $String, $String], [$String, $error], false)}, {prop: "concat", name: "concat", pkg: "regexp/syntax", typ: $funcType([], [ptrType$1], false)}, {prop: "alternate", name: "alternate", pkg: "regexp/syntax", typ: $funcType([], [ptrType$1], false)}, {prop: "collapse", name: "collapse", pkg: "regexp/syntax", typ: $funcType([sliceType$5, Op], [ptrType$1], false)}, {prop: "factor", name: "factor", pkg: "regexp/syntax", typ: $funcType([sliceType$5], [sliceType$5], false)}, {prop: "leadingString", name: "leadingString", pkg: "regexp/syntax", typ: $funcType([ptrType$1], [sliceType, Flags], false)}, {prop: "removeLeadingString", name: "removeLeadingString", pkg: "regexp/syntax", typ: $funcType([ptrType$1, $Int], [ptrType$1], false)}, {prop: "leadingRegexp", name: "leadingRegexp", pkg: "regexp/syntax", typ: $funcType([ptrType$1], [ptrType$1], false)}, {prop: "removeLeadingRegexp", name: "removeLeadingRegexp", pkg: "regexp/syntax", typ: $funcType([ptrType$1, $Bool], [ptrType$1], false)}, {prop: "parseRepeat", name: "parseRepeat", pkg: "regexp/syntax", typ: $funcType([$String], [$Int, $Int, $String, $Bool], false)}, {prop: "parsePerlFlags", name: "parsePerlFlags", pkg: "regexp/syntax", typ: $funcType([$String], [$String, $error], false)}, {prop: "parseInt", name: "parseInt", pkg: "regexp/syntax", typ: $funcType([$String], [$Int, $String, $Bool], false)}, {prop: "parseVerticalBar", name: "parseVerticalBar", pkg: "regexp/syntax", typ: $funcType([], [$error], false)}, {prop: "swapVerticalBar", name: "swapVerticalBar", pkg: "regexp/syntax", typ: $funcType([], [$Bool], false)}, {prop: "parseRightParen", name: "parseRightParen", pkg: "regexp/syntax", typ: $funcType([], [$error], false)}, {prop: "parseEscape", name: "parseEscape", pkg: "regexp/syntax", typ: $funcType([$String], [$Int32, $String, $error], false)}, {prop: "parseClassChar", name: "parseClassChar", pkg: "regexp/syntax", typ: $funcType([$String, $String], [$Int32, $String, $error], false)}, {prop: "parsePerlClassEscape", name: "parsePerlClassEscape", pkg: "regexp/syntax", typ: $funcType([$String, sliceType], [sliceType, $String], false)}, {prop: "parseNamedClass", name: "parseNamedClass", pkg: "regexp/syntax", typ: $funcType([$String, sliceType], [sliceType, $String, $error], false)}, {prop: "appendGroup", name: "appendGroup", pkg: "regexp/syntax", typ: $funcType([sliceType, charGroup], [sliceType], false)}, {prop: "parseUnicodeClass", name: "parseUnicodeClass", pkg: "regexp/syntax", typ: $funcType([$String, sliceType], [sliceType, $String, $error], false)}, {prop: "parseClass", name: "parseClass", pkg: "regexp/syntax", typ: $funcType([$String], [$String, $error], false)}];
|
|
ranges.methods = [{prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}];
|
|
ptrType.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "skipNop", name: "skipNop", pkg: "regexp/syntax", typ: $funcType([$Uint32], [ptrType$8], false)}, {prop: "Prefix", name: "Prefix", pkg: "", typ: $funcType([], [$String, $Bool], false)}, {prop: "StartCond", name: "StartCond", pkg: "", typ: $funcType([], [EmptyOp], false)}];
|
|
InstOp.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$8.methods = [{prop: "op", name: "op", pkg: "regexp/syntax", typ: $funcType([], [InstOp], false)}, {prop: "MatchRune", name: "MatchRune", pkg: "", typ: $funcType([$Int32], [$Bool], false)}, {prop: "MatchRunePos", name: "MatchRunePos", pkg: "", typ: $funcType([$Int32], [$Int], false)}, {prop: "MatchEmptyWidth", name: "MatchEmptyWidth", pkg: "", typ: $funcType([$Int32, $Int32], [$Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$1.methods = [{prop: "Equal", name: "Equal", pkg: "", typ: $funcType([ptrType$1], [$Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "MaxCap", name: "MaxCap", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "CapNames", name: "CapNames", pkg: "", typ: $funcType([], [sliceType$3], false)}, {prop: "capNames", name: "capNames", pkg: "regexp/syntax", typ: $funcType([sliceType$3], [], false)}, {prop: "Simplify", name: "Simplify", pkg: "", typ: $funcType([], [ptrType$1], false)}];
|
|
Op.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
frag.init("regexp/syntax", [{prop: "i", name: "i", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "out", name: "out", embedded: false, exported: false, typ: patchList, tag: ""}]);
|
|
compiler.init("regexp/syntax", [{prop: "p", name: "p", embedded: false, exported: false, typ: ptrType, tag: ""}]);
|
|
Error.init("", [{prop: "Code", name: "Code", embedded: false, exported: true, typ: ErrorCode, tag: ""}, {prop: "Expr", name: "Expr", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
parser.init("regexp/syntax", [{prop: "flags", name: "flags", embedded: false, exported: false, typ: Flags, tag: ""}, {prop: "stack", name: "stack", embedded: false, exported: false, typ: sliceType$5, tag: ""}, {prop: "free", name: "free", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "numCap", name: "numCap", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "wholeRegexp", name: "wholeRegexp", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "tmpClass", name: "tmpClass", embedded: false, exported: false, typ: sliceType, tag: ""}]);
|
|
charGroup.init("regexp/syntax", [{prop: "sign", name: "sign", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "class$1", name: "class", embedded: false, exported: false, typ: sliceType, tag: ""}]);
|
|
ranges.init("regexp/syntax", [{prop: "p", name: "p", embedded: false, exported: false, typ: ptrType$2, tag: ""}]);
|
|
Prog.init("", [{prop: "Inst", name: "Inst", embedded: false, exported: true, typ: sliceType$4, tag: ""}, {prop: "Start", name: "Start", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "NumCap", name: "NumCap", embedded: false, exported: true, typ: $Int, tag: ""}]);
|
|
Inst.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: InstOp, tag: ""}, {prop: "Out", name: "Out", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Arg", name: "Arg", embedded: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Rune", name: "Rune", embedded: false, exported: true, typ: sliceType, tag: ""}]);
|
|
Regexp.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: Op, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: Flags, tag: ""}, {prop: "Sub", name: "Sub", embedded: false, exported: true, typ: sliceType$5, tag: ""}, {prop: "Sub0", name: "Sub0", embedded: false, exported: true, typ: arrayType, tag: ""}, {prop: "Rune", name: "Rune", embedded: false, exported: true, typ: sliceType, tag: ""}, {prop: "Rune0", name: "Rune0", embedded: false, exported: true, typ: arrayType$1, tag: ""}, {prop: "Min", name: "Min", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Max", name: "Max", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Cap", name: "Cap", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = sort.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strings.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unicode.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
anyRuneNotNL = new sliceType([0, 9, 11, 1114111]);
|
|
anyRune = new sliceType([0, 1114111]);
|
|
_Op_index_0 = $toNativeArray($kindUint8, [0, 7, 17, 24, 33, 45, 52, 61, 68, 77, 84, 96, 110, 117, 121, 125, 130, 136, 142, 151]);
|
|
anyTable = new unicode.RangeTable.ptr(new sliceType$1([new unicode.Range16.ptr(0, 65535, 1)]), new sliceType$2([new unicode.Range32.ptr(65536, 1114111, 1)]), 0);
|
|
code1 = new sliceType([48, 57]);
|
|
code2 = new sliceType([9, 10, 12, 13, 32, 32]);
|
|
code3 = new sliceType([48, 57, 65, 90, 95, 95, 97, 122]);
|
|
perlGroup = $makeMap($String.keyFor, [{ k: "\\d", v: new charGroup.ptr(1, code1) }, { k: "\\D", v: new charGroup.ptr(-1, code1) }, { k: "\\s", v: new charGroup.ptr(1, code2) }, { k: "\\S", v: new charGroup.ptr(-1, code2) }, { k: "\\w", v: new charGroup.ptr(1, code3) }, { k: "\\W", v: new charGroup.ptr(-1, code3) }]);
|
|
code4 = new sliceType([48, 57, 65, 90, 97, 122]);
|
|
code5 = new sliceType([65, 90, 97, 122]);
|
|
code6 = new sliceType([0, 127]);
|
|
code7 = new sliceType([9, 9, 32, 32]);
|
|
code8 = new sliceType([0, 31, 127, 127]);
|
|
code9 = new sliceType([48, 57]);
|
|
code10 = new sliceType([33, 126]);
|
|
code11 = new sliceType([97, 122]);
|
|
code12 = new sliceType([32, 126]);
|
|
code13 = new sliceType([33, 47, 58, 64, 91, 96, 123, 126]);
|
|
code14 = new sliceType([9, 13, 32, 32]);
|
|
code15 = new sliceType([65, 90]);
|
|
code16 = new sliceType([48, 57, 65, 90, 95, 95, 97, 122]);
|
|
code17 = new sliceType([48, 57, 65, 70, 97, 102]);
|
|
posixGroup = $makeMap($String.keyFor, [{ k: "[:alnum:]", v: new charGroup.ptr(1, code4) }, { k: "[:^alnum:]", v: new charGroup.ptr(-1, code4) }, { k: "[:alpha:]", v: new charGroup.ptr(1, code5) }, { k: "[:^alpha:]", v: new charGroup.ptr(-1, code5) }, { k: "[:ascii:]", v: new charGroup.ptr(1, code6) }, { k: "[:^ascii:]", v: new charGroup.ptr(-1, code6) }, { k: "[:blank:]", v: new charGroup.ptr(1, code7) }, { k: "[:^blank:]", v: new charGroup.ptr(-1, code7) }, { k: "[:cntrl:]", v: new charGroup.ptr(1, code8) }, { k: "[:^cntrl:]", v: new charGroup.ptr(-1, code8) }, { k: "[:digit:]", v: new charGroup.ptr(1, code9) }, { k: "[:^digit:]", v: new charGroup.ptr(-1, code9) }, { k: "[:graph:]", v: new charGroup.ptr(1, code10) }, { k: "[:^graph:]", v: new charGroup.ptr(-1, code10) }, { k: "[:lower:]", v: new charGroup.ptr(1, code11) }, { k: "[:^lower:]", v: new charGroup.ptr(-1, code11) }, { k: "[:print:]", v: new charGroup.ptr(1, code12) }, { k: "[:^print:]", v: new charGroup.ptr(-1, code12) }, { k: "[:punct:]", v: new charGroup.ptr(1, code13) }, { k: "[:^punct:]", v: new charGroup.ptr(-1, code13) }, { k: "[:space:]", v: new charGroup.ptr(1, code14) }, { k: "[:^space:]", v: new charGroup.ptr(-1, code14) }, { k: "[:upper:]", v: new charGroup.ptr(1, code15) }, { k: "[:^upper:]", v: new charGroup.ptr(-1, code15) }, { k: "[:word:]", v: new charGroup.ptr(1, code16) }, { k: "[:^word:]", v: new charGroup.ptr(-1, code16) }, { k: "[:xdigit:]", v: new charGroup.ptr(1, code17) }, { k: "[:^xdigit:]", v: new charGroup.ptr(-1, code17) }]);
|
|
instOpNames = new sliceType$3(["InstAlt", "InstAltMatch", "InstCapture", "InstEmptyWidth", "InstMatch", "InstFail", "InstNop", "InstRune", "InstRune1", "InstRuneAny", "InstRuneAnyNotNL"]);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["regexp"] = (function() {
|
|
var $pkg = {}, $init, bytes, nosync, io, syntax, sort, strconv, strings, unicode, utf8, job, bitState, queue, entry, thread, machine, inputs, lazyFlag, onePassMachine, onePassProg, onePassInst, queueOnePass, runeSlice, Regexp, input, inputString, inputBytes, inputReader, sliceType, arrayType, arrayType$1, arrayType$2, sliceType$1, sliceType$2, ptrType, sliceType$3, sliceType$4, sliceType$5, ptrType$1, ptrType$2, ptrType$3, ptrType$4, ptrType$5, ptrType$6, ptrType$7, ptrType$8, sliceType$6, ptrType$9, sliceType$7, ptrType$10, sliceType$8, ptrType$11, ptrType$12, sliceType$9, ptrType$13, sliceType$10, sliceType$11, arrayType$3, arrayType$4, sliceType$12, sliceType$13, sliceType$14, sliceType$15, ptrType$14, ptrType$15, funcType, funcType$1, funcType$2, funcType$3, ptrType$16, ptrType$17, ptrType$18, bitStatePool, onePassPool, arrayNoInts, noRune, noNext, anyRuneNotNL, anyRune, matchSize, matchPool, specialBytes, newBitState, freeBitState, maxBitStateLen, shouldBacktrack, newLazyFlag, newOnePassMachine, freeOnePassMachine, onePassPrefix, onePassNext, iop, newQueue, mergeRuneSets, cleanupOnePass, onePassCopy, makeOnePass, compileOnePass, Compile, compile, MustCompile, quote, init, extract;
|
|
bytes = $packages["bytes"];
|
|
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
|
|
io = $packages["io"];
|
|
syntax = $packages["regexp/syntax"];
|
|
sort = $packages["sort"];
|
|
strconv = $packages["strconv"];
|
|
strings = $packages["strings"];
|
|
unicode = $packages["unicode"];
|
|
utf8 = $packages["unicode/utf8"];
|
|
job = $pkg.job = $newType(0, $kindStruct, "regexp.job", true, "regexp", false, function(pc_, arg_, pos_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.pc = 0;
|
|
this.arg = false;
|
|
this.pos = 0;
|
|
return;
|
|
}
|
|
this.pc = pc_;
|
|
this.arg = arg_;
|
|
this.pos = pos_;
|
|
});
|
|
bitState = $pkg.bitState = $newType(0, $kindStruct, "regexp.bitState", true, "regexp", false, function(end_, cap_, matchcap_, jobs_, visited_, inputs_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.end = 0;
|
|
this.cap = sliceType$3.nil;
|
|
this.matchcap = sliceType$3.nil;
|
|
this.jobs = sliceType$4.nil;
|
|
this.visited = sliceType$2.nil;
|
|
this.inputs = new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0));
|
|
return;
|
|
}
|
|
this.end = end_;
|
|
this.cap = cap_;
|
|
this.matchcap = matchcap_;
|
|
this.jobs = jobs_;
|
|
this.visited = visited_;
|
|
this.inputs = inputs_;
|
|
});
|
|
queue = $pkg.queue = $newType(0, $kindStruct, "regexp.queue", true, "regexp", false, function(sparse_, dense_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.sparse = sliceType$2.nil;
|
|
this.dense = sliceType$10.nil;
|
|
return;
|
|
}
|
|
this.sparse = sparse_;
|
|
this.dense = dense_;
|
|
});
|
|
entry = $pkg.entry = $newType(0, $kindStruct, "regexp.entry", true, "regexp", false, function(pc_, t_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.pc = 0;
|
|
this.t = ptrType$1.nil;
|
|
return;
|
|
}
|
|
this.pc = pc_;
|
|
this.t = t_;
|
|
});
|
|
thread = $pkg.thread = $newType(0, $kindStruct, "regexp.thread", true, "regexp", false, function(inst_, cap_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.inst = ptrType$2.nil;
|
|
this.cap = sliceType$3.nil;
|
|
return;
|
|
}
|
|
this.inst = inst_;
|
|
this.cap = cap_;
|
|
});
|
|
machine = $pkg.machine = $newType(0, $kindStruct, "regexp.machine", true, "regexp", false, function(re_, p_, q0_, q1_, pool_, matched_, matchcap_, inputs_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.re = ptrType$11.nil;
|
|
this.p = ptrType$12.nil;
|
|
this.q0 = new queue.ptr(sliceType$2.nil, sliceType$10.nil);
|
|
this.q1 = new queue.ptr(sliceType$2.nil, sliceType$10.nil);
|
|
this.pool = sliceType$11.nil;
|
|
this.matched = false;
|
|
this.matchcap = sliceType$3.nil;
|
|
this.inputs = new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0));
|
|
return;
|
|
}
|
|
this.re = re_;
|
|
this.p = p_;
|
|
this.q0 = q0_;
|
|
this.q1 = q1_;
|
|
this.pool = pool_;
|
|
this.matched = matched_;
|
|
this.matchcap = matchcap_;
|
|
this.inputs = inputs_;
|
|
});
|
|
inputs = $pkg.inputs = $newType(0, $kindStruct, "regexp.inputs", true, "regexp", false, function(bytes_, string_, reader_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.bytes = new inputBytes.ptr(sliceType$5.nil);
|
|
this.string = new inputString.ptr("");
|
|
this.reader = new inputReader.ptr($ifaceNil, false, 0);
|
|
return;
|
|
}
|
|
this.bytes = bytes_;
|
|
this.string = string_;
|
|
this.reader = reader_;
|
|
});
|
|
lazyFlag = $pkg.lazyFlag = $newType(8, $kindUint64, "regexp.lazyFlag", true, "regexp", false, null);
|
|
onePassMachine = $pkg.onePassMachine = $newType(0, $kindStruct, "regexp.onePassMachine", true, "regexp", false, function(inputs_, matchcap_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.inputs = new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0));
|
|
this.matchcap = sliceType$3.nil;
|
|
return;
|
|
}
|
|
this.inputs = inputs_;
|
|
this.matchcap = matchcap_;
|
|
});
|
|
onePassProg = $pkg.onePassProg = $newType(0, $kindStruct, "regexp.onePassProg", true, "regexp", false, function(Inst_, Start_, NumCap_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Inst = sliceType$6.nil;
|
|
this.Start = 0;
|
|
this.NumCap = 0;
|
|
return;
|
|
}
|
|
this.Inst = Inst_;
|
|
this.Start = Start_;
|
|
this.NumCap = NumCap_;
|
|
});
|
|
onePassInst = $pkg.onePassInst = $newType(0, $kindStruct, "regexp.onePassInst", true, "regexp", false, function(Inst_, Next_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Inst = new syntax.Inst.ptr(0, 0, 0, sliceType$1.nil);
|
|
this.Next = sliceType$2.nil;
|
|
return;
|
|
}
|
|
this.Inst = Inst_;
|
|
this.Next = Next_;
|
|
});
|
|
queueOnePass = $pkg.queueOnePass = $newType(0, $kindStruct, "regexp.queueOnePass", true, "regexp", false, function(sparse_, dense_, size_, nextIndex_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.sparse = sliceType$2.nil;
|
|
this.dense = sliceType$2.nil;
|
|
this.size = 0;
|
|
this.nextIndex = 0;
|
|
return;
|
|
}
|
|
this.sparse = sparse_;
|
|
this.dense = dense_;
|
|
this.size = size_;
|
|
this.nextIndex = nextIndex_;
|
|
});
|
|
runeSlice = $pkg.runeSlice = $newType(12, $kindSlice, "regexp.runeSlice", true, "regexp", false, null);
|
|
Regexp = $pkg.Regexp = $newType(0, $kindStruct, "regexp.Regexp", true, "regexp", true, function(expr_, prog_, onepass_, numSubexp_, maxBitStateLen_, subexpNames_, prefix_, prefixBytes_, prefixRune_, prefixEnd_, mpool_, matchcap_, prefixComplete_, cond_, longest_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.expr = "";
|
|
this.prog = ptrType$12.nil;
|
|
this.onepass = ptrType$6.nil;
|
|
this.numSubexp = 0;
|
|
this.maxBitStateLen = 0;
|
|
this.subexpNames = sliceType$9.nil;
|
|
this.prefix = "";
|
|
this.prefixBytes = sliceType$5.nil;
|
|
this.prefixRune = 0;
|
|
this.prefixEnd = 0;
|
|
this.mpool = 0;
|
|
this.matchcap = 0;
|
|
this.prefixComplete = false;
|
|
this.cond = 0;
|
|
this.longest = false;
|
|
return;
|
|
}
|
|
this.expr = expr_;
|
|
this.prog = prog_;
|
|
this.onepass = onepass_;
|
|
this.numSubexp = numSubexp_;
|
|
this.maxBitStateLen = maxBitStateLen_;
|
|
this.subexpNames = subexpNames_;
|
|
this.prefix = prefix_;
|
|
this.prefixBytes = prefixBytes_;
|
|
this.prefixRune = prefixRune_;
|
|
this.prefixEnd = prefixEnd_;
|
|
this.mpool = mpool_;
|
|
this.matchcap = matchcap_;
|
|
this.prefixComplete = prefixComplete_;
|
|
this.cond = cond_;
|
|
this.longest = longest_;
|
|
});
|
|
input = $pkg.input = $newType(8, $kindInterface, "regexp.input", true, "regexp", false, null);
|
|
inputString = $pkg.inputString = $newType(0, $kindStruct, "regexp.inputString", true, "regexp", false, function(str_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.str = "";
|
|
return;
|
|
}
|
|
this.str = str_;
|
|
});
|
|
inputBytes = $pkg.inputBytes = $newType(0, $kindStruct, "regexp.inputBytes", true, "regexp", false, function(str_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.str = sliceType$5.nil;
|
|
return;
|
|
}
|
|
this.str = str_;
|
|
});
|
|
inputReader = $pkg.inputReader = $newType(0, $kindStruct, "regexp.inputReader", true, "regexp", false, function(r_, atEOT_, pos_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.r = $ifaceNil;
|
|
this.atEOT = false;
|
|
this.pos = 0;
|
|
return;
|
|
}
|
|
this.r = r_;
|
|
this.atEOT = atEOT_;
|
|
this.pos = pos_;
|
|
});
|
|
sliceType = $sliceType($emptyInterface);
|
|
arrayType = $arrayType($Int, 0);
|
|
arrayType$1 = $arrayType(nosync.Pool, 5);
|
|
arrayType$2 = $arrayType($Uint8, 16);
|
|
sliceType$1 = $sliceType($Int32);
|
|
sliceType$2 = $sliceType($Uint32);
|
|
ptrType = $ptrType(bitState);
|
|
sliceType$3 = $sliceType($Int);
|
|
sliceType$4 = $sliceType(job);
|
|
sliceType$5 = $sliceType($Uint8);
|
|
ptrType$1 = $ptrType(thread);
|
|
ptrType$2 = $ptrType(syntax.Inst);
|
|
ptrType$3 = $ptrType(lazyFlag);
|
|
ptrType$4 = $ptrType($Int);
|
|
ptrType$5 = $ptrType(onePassMachine);
|
|
ptrType$6 = $ptrType(onePassProg);
|
|
ptrType$7 = $ptrType(strings.Builder);
|
|
ptrType$8 = $ptrType(queueOnePass);
|
|
sliceType$6 = $sliceType(onePassInst);
|
|
ptrType$9 = $ptrType($Uint32);
|
|
sliceType$7 = $sliceType(sliceType$1);
|
|
ptrType$10 = $ptrType(sliceType$1);
|
|
sliceType$8 = $sliceType($Bool);
|
|
ptrType$11 = $ptrType(Regexp);
|
|
ptrType$12 = $ptrType(syntax.Prog);
|
|
sliceType$9 = $sliceType($String);
|
|
ptrType$13 = $ptrType(machine);
|
|
sliceType$10 = $sliceType(entry);
|
|
sliceType$11 = $sliceType(ptrType$1);
|
|
arrayType$3 = $arrayType($Int, 2);
|
|
arrayType$4 = $arrayType($Int, 4);
|
|
sliceType$12 = $sliceType(sliceType$5);
|
|
sliceType$13 = $sliceType(sliceType$3);
|
|
sliceType$14 = $sliceType(sliceType$12);
|
|
sliceType$15 = $sliceType(sliceType$9);
|
|
ptrType$14 = $ptrType(queue);
|
|
ptrType$15 = $ptrType(inputs);
|
|
funcType = $funcType([$String], [$String], false);
|
|
funcType$1 = $funcType([sliceType$5, sliceType$3], [sliceType$5], false);
|
|
funcType$2 = $funcType([sliceType$5], [sliceType$5], false);
|
|
funcType$3 = $funcType([sliceType$3], [], false);
|
|
ptrType$16 = $ptrType(inputString);
|
|
ptrType$17 = $ptrType(inputBytes);
|
|
ptrType$18 = $ptrType(inputReader);
|
|
newBitState = function() {
|
|
var _r, _tuple, b, ok, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; b = $f.b; ok = $f.ok; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = bitStatePool.Get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = $assertType(_r, ptrType, true);
|
|
b = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!ok) {
|
|
b = new bitState.ptr(0, sliceType$3.nil, sliceType$3.nil, sliceType$4.nil, sliceType$2.nil, new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0)));
|
|
}
|
|
$s = -1; return b;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: newBitState }; } $f._r = _r; $f._tuple = _tuple; $f.b = b; $f.ok = ok; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
freeBitState = function(b) {
|
|
var b;
|
|
b.inputs.clear();
|
|
bitStatePool.Put(b);
|
|
};
|
|
maxBitStateLen = function(prog) {
|
|
var _q, prog;
|
|
if (!shouldBacktrack(prog)) {
|
|
return 0;
|
|
}
|
|
return (_q = 262144 / prog.Inst.$length, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
};
|
|
shouldBacktrack = function(prog) {
|
|
var prog;
|
|
return prog.Inst.$length <= 500;
|
|
};
|
|
bitState.ptr.prototype.reset = function(prog, end, ncap) {
|
|
var _i, _i$1, _i$2, _q, _ref, _ref$1, _ref$2, b, end, i, i$1, i$2, ncap, prog, visitedSize, x, x$1, x$2;
|
|
b = this;
|
|
b.end = end;
|
|
if (b.jobs.$capacity === 0) {
|
|
b.jobs = $makeSlice(sliceType$4, 0, 256);
|
|
} else {
|
|
b.jobs = $subslice(b.jobs, 0, 0);
|
|
}
|
|
visitedSize = (_q = (((($imul(prog.Inst.$length, ((end + 1 >> 0)))) + 32 >> 0) - 1 >> 0)) / 32, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
if (b.visited.$capacity < visitedSize) {
|
|
b.visited = $makeSlice(sliceType$2, visitedSize, 8192);
|
|
} else {
|
|
b.visited = $subslice(b.visited, 0, visitedSize);
|
|
_ref = b.visited;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
(x = b.visited, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i] = 0));
|
|
_i++;
|
|
}
|
|
}
|
|
if (b.cap.$capacity < ncap) {
|
|
b.cap = $makeSlice(sliceType$3, ncap);
|
|
} else {
|
|
b.cap = $subslice(b.cap, 0, ncap);
|
|
}
|
|
_ref$1 = b.cap;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
(x$1 = b.cap, ((i$1 < 0 || i$1 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i$1] = -1));
|
|
_i$1++;
|
|
}
|
|
if (b.matchcap.$capacity < ncap) {
|
|
b.matchcap = $makeSlice(sliceType$3, ncap);
|
|
} else {
|
|
b.matchcap = $subslice(b.matchcap, 0, ncap);
|
|
}
|
|
_ref$2 = b.matchcap;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
i$2 = _i$2;
|
|
(x$2 = b.matchcap, ((i$2 < 0 || i$2 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i$2] = -1));
|
|
_i$2++;
|
|
}
|
|
};
|
|
bitState.prototype.reset = function(prog, end, ncap) { return this.$val.reset(prog, end, ncap); };
|
|
bitState.ptr.prototype.shouldVisit = function(pc, pos) {
|
|
var _index, _q, _q$1, b, n, pc, pos, x, x$1, x$2, x$3, y, y$1;
|
|
b = this;
|
|
n = (((($imul(((pc >> 0)), ((b.end + 1 >> 0)))) + pos >> 0) >>> 0));
|
|
if (!(((((x = b.visited, x$1 = (_q = n / 32, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero")), ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])) & (((y = (((n & 31) >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0) === 0))) {
|
|
return false;
|
|
}
|
|
_index = (_q$1 = n / 32, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
(x$3 = b.visited, ((_index < 0 || _index >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + _index] = (((x$2 = b.visited, ((_index < 0 || _index >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + _index])) | (((y$1 = (((n & 31) >>> 0)), y$1 < 32 ? (1 << y$1) : 0) >>> 0))) >>> 0)));
|
|
return true;
|
|
};
|
|
bitState.prototype.shouldVisit = function(pc, pos) { return this.$val.shouldVisit(pc, pos); };
|
|
bitState.ptr.prototype.push = function(re, pc, pos, arg) {
|
|
var arg, b, pc, pos, re, x;
|
|
b = this;
|
|
if (!(((x = re.prog.Inst, ((pc < 0 || pc >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pc])).Op === 5)) && (arg || b.shouldVisit(pc, pos))) {
|
|
b.jobs = $append(b.jobs, new job.ptr(pc, arg, pos));
|
|
}
|
|
};
|
|
bitState.prototype.push = function(re, pc, pos, arg) { return this.$val.push(re, pc, pos, arg); };
|
|
Regexp.ptr.prototype.tryBacktrack = function(b, i, pc, pos) {
|
|
var _1, _2, _r, _r$1, _r$2, _r$3, _r$4, _tuple, _tuple$1, _tuple$2, _tuple$3, arg, b, flag, i, inst, l, longest, old, pc, pc$1, pos, pos$1, r, r$1, r$2, r$3, re, width, width$1, width$2, width$3, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; arg = $f.arg; b = $f.b; flag = $f.flag; i = $f.i; inst = $f.inst; l = $f.l; longest = $f.longest; old = $f.old; pc = $f.pc; pc$1 = $f.pc$1; pos = $f.pos; pos$1 = $f.pos$1; r = $f.r; r$1 = $f.r$1; r$2 = $f.r$2; r$3 = $f.r$3; re = $f.re; width = $f.width; width$1 = $f.width$1; width$2 = $f.width$2; width$3 = $f.width$3; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$15 = $f.x$15; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
longest = re.longest;
|
|
b.push(re, pc, pos, false);
|
|
/* while (true) { */ case 1:
|
|
/* if (!(b.jobs.$length > 0)) { break; } */ if(!(b.jobs.$length > 0)) { $s = 2; continue; }
|
|
l = b.jobs.$length - 1 >> 0;
|
|
pc$1 = (x = b.jobs, ((l < 0 || l >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + l])).pc;
|
|
pos$1 = (x$1 = b.jobs, ((l < 0 || l >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + l])).pos;
|
|
arg = (x$2 = b.jobs, ((l < 0 || l >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + l])).arg;
|
|
b.jobs = $subslice(b.jobs, 0, l);
|
|
/* goto Skip */ $s = 3; continue;
|
|
/* CheckAndLoop: */ case 4:
|
|
if (!b.shouldVisit(pc$1, pos$1)) {
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
/* Skip: */ case 3:
|
|
inst = $clone((x$3 = re.prog.Inst, ((pc$1 < 0 || pc$1 >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + pc$1])), syntax.Inst);
|
|
_1 = inst.Op;
|
|
/* */ if (_1 === (5)) { $s = 6; continue; }
|
|
/* */ if (_1 === (0)) { $s = 7; continue; }
|
|
/* */ if (_1 === (1)) { $s = 8; continue; }
|
|
/* */ if (_1 === (7)) { $s = 9; continue; }
|
|
/* */ if (_1 === (8)) { $s = 10; continue; }
|
|
/* */ if (_1 === (10)) { $s = 11; continue; }
|
|
/* */ if (_1 === (9)) { $s = 12; continue; }
|
|
/* */ if (_1 === (2)) { $s = 13; continue; }
|
|
/* */ if (_1 === (3)) { $s = 14; continue; }
|
|
/* */ if (_1 === (6)) { $s = 15; continue; }
|
|
/* */ if (_1 === (4)) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if (_1 === (5)) { */ case 6:
|
|
$panic(new $String("unexpected InstFail"));
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (0)) { */ case 7:
|
|
/* */ if (arg) { $s = 19; continue; }
|
|
/* */ $s = 20; continue;
|
|
/* if (arg) { */ case 19:
|
|
arg = false;
|
|
pc$1 = inst.Arg;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 21; continue;
|
|
/* } else { */ case 20:
|
|
b.push(re, pc$1, pos$1, true);
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
/* } */ case 21:
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (1)) { */ case 8:
|
|
_2 = (x$4 = re.prog.Inst, x$5 = inst.Out, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])).Op;
|
|
/* */ if ((_2 === (7)) || (_2 === (8)) || (_2 === (9)) || (_2 === (10))) { $s = 23; continue; }
|
|
/* */ $s = 24; continue;
|
|
/* if ((_2 === (7)) || (_2 === (8)) || (_2 === (9)) || (_2 === (10))) { */ case 23:
|
|
b.push(re, inst.Arg, pos$1, false);
|
|
pc$1 = inst.Arg;
|
|
pos$1 = b.end;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
/* } */ case 24:
|
|
case 22:
|
|
b.push(re, inst.Out, b.end, false);
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (7)) { */ case 9:
|
|
_r = i.step(pos$1); /* */ $s = 25; case 25: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
width = _tuple[1];
|
|
/* */ if (!inst.MatchRune(r)) { $s = 26; continue; }
|
|
/* */ $s = 27; continue;
|
|
/* if (!inst.MatchRune(r)) { */ case 26:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 27:
|
|
pos$1 = pos$1 + (width) >> 0;
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (8)) { */ case 10:
|
|
_r$1 = i.step(pos$1); /* */ $s = 28; case 28: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
r$1 = _tuple$1[0];
|
|
width$1 = _tuple$1[1];
|
|
/* */ if (!((r$1 === (x$6 = inst.Rune, (0 >= x$6.$length ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + 0]))))) { $s = 29; continue; }
|
|
/* */ $s = 30; continue;
|
|
/* if (!((r$1 === (x$6 = inst.Rune, (0 >= x$6.$length ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + 0]))))) { */ case 29:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 30:
|
|
pos$1 = pos$1 + (width$1) >> 0;
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (10)) { */ case 11:
|
|
_r$2 = i.step(pos$1); /* */ $s = 31; case 31: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$2;
|
|
r$2 = _tuple$2[0];
|
|
width$2 = _tuple$2[1];
|
|
/* */ if ((r$2 === 10) || (r$2 === -1)) { $s = 32; continue; }
|
|
/* */ $s = 33; continue;
|
|
/* if ((r$2 === 10) || (r$2 === -1)) { */ case 32:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 33:
|
|
pos$1 = pos$1 + (width$2) >> 0;
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (9)) { */ case 12:
|
|
_r$3 = i.step(pos$1); /* */ $s = 34; case 34: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$3;
|
|
r$3 = _tuple$3[0];
|
|
width$3 = _tuple$3[1];
|
|
/* */ if (r$3 === -1) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if (r$3 === -1) { */ case 35:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 36:
|
|
pos$1 = pos$1 + (width$3) >> 0;
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (2)) { */ case 13:
|
|
/* */ if (arg) { $s = 37; continue; }
|
|
/* */ $s = 38; continue;
|
|
/* if (arg) { */ case 37:
|
|
(x$7 = b.cap, x$8 = inst.Arg, ((x$8 < 0 || x$8 >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + x$8] = pos$1));
|
|
/* continue; */ $s = 1; continue;
|
|
$s = 39; continue;
|
|
/* } else { */ case 38:
|
|
if (0 <= inst.Arg && inst.Arg < ((b.cap.$length >>> 0))) {
|
|
b.push(re, pc$1, (x$9 = b.cap, x$10 = inst.Arg, ((x$10 < 0 || x$10 >= x$9.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + x$10])), true);
|
|
(x$11 = b.cap, x$12 = inst.Arg, ((x$12 < 0 || x$12 >= x$11.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$11.$array[x$11.$offset + x$12] = pos$1));
|
|
}
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
/* } */ case 39:
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (3)) { */ case 14:
|
|
_r$4 = i.context(pos$1); /* */ $s = 40; case 40: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
flag = _r$4;
|
|
/* */ if (!flag.match(((inst.Arg << 24 >>> 24)))) { $s = 41; continue; }
|
|
/* */ $s = 42; continue;
|
|
/* if (!flag.match(((inst.Arg << 24 >>> 24)))) { */ case 41:
|
|
/* continue; */ $s = 1; continue;
|
|
/* } */ case 42:
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (6)) { */ case 15:
|
|
pc$1 = inst.Out;
|
|
/* goto CheckAndLoop */ $s = 4; continue;
|
|
$s = 18; continue;
|
|
/* } else if (_1 === (4)) { */ case 16:
|
|
if (b.cap.$length === 0) {
|
|
$s = -1; return true;
|
|
}
|
|
if (b.cap.$length > 1) {
|
|
(x$13 = b.cap, (1 >= x$13.$length ? ($throwRuntimeError("index out of range"), undefined) : x$13.$array[x$13.$offset + 1] = pos$1));
|
|
}
|
|
old = (x$14 = b.matchcap, (1 >= x$14.$length ? ($throwRuntimeError("index out of range"), undefined) : x$14.$array[x$14.$offset + 1]));
|
|
if ((old === -1) || (longest && pos$1 > 0 && pos$1 > old)) {
|
|
$copySlice(b.matchcap, b.cap);
|
|
}
|
|
if (!longest) {
|
|
$s = -1; return true;
|
|
}
|
|
if (pos$1 === b.end) {
|
|
$s = -1; return true;
|
|
}
|
|
/* continue; */ $s = 1; continue;
|
|
$s = 18; continue;
|
|
/* } else { */ case 17:
|
|
$panic(new $String("bad inst"));
|
|
/* } */ case 18:
|
|
case 5:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return longest && b.matchcap.$length > 1 && (x$15 = b.matchcap, (1 >= x$15.$length ? ($throwRuntimeError("index out of range"), undefined) : x$15.$array[x$15.$offset + 1])) >= 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.tryBacktrack }; } $f._1 = _1; $f._2 = _2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.arg = arg; $f.b = b; $f.flag = flag; $f.i = i; $f.inst = inst; $f.l = l; $f.longest = longest; $f.old = old; $f.pc = pc; $f.pc$1 = pc$1; $f.pos = pos; $f.pos$1 = pos$1; $f.r = r; $f.r$1 = r$1; $f.r$2 = r$2; $f.r$3 = r$3; $f.re = re; $f.width = width; $f.width$1 = width$1; $f.width$2 = width$2; $f.width$3 = width$3; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$15 = x$15; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.tryBacktrack = function(b, i, pc, pos) { return this.$val.tryBacktrack(b, i, pc, pos); };
|
|
Regexp.ptr.prototype.backtrack = function(ib, is, pos, ncap, dstCap) {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, _tuple, _tuple$1, advance, b, dstCap, end, i, ib, is, ncap, pos, re, startCond, width, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; advance = $f.advance; b = $f.b; dstCap = $f.dstCap; end = $f.end; i = $f.i; ib = $f.ib; is = $f.is; ncap = $f.ncap; pos = $f.pos; re = $f.re; startCond = $f.startCond; width = $f.width; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
startCond = re.cond;
|
|
if (startCond === 255) {
|
|
$s = -1; return sliceType$3.nil;
|
|
}
|
|
if (!((((startCond & 4) >>> 0) === 0)) && !((pos === 0))) {
|
|
$s = -1; return sliceType$3.nil;
|
|
}
|
|
_r = newBitState(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
b = _r;
|
|
_tuple = b.inputs.init($ifaceNil, ib, is);
|
|
i = _tuple[0];
|
|
end = _tuple[1];
|
|
b.reset(re.prog, end, ncap);
|
|
/* */ if (!((((startCond & 4) >>> 0) === 0))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((((startCond & 4) >>> 0) === 0))) { */ case 2:
|
|
if (b.cap.$length > 0) {
|
|
(x = b.cap, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0] = pos));
|
|
}
|
|
_r$1 = re.tryBacktrack(b, i, ((re.prog.Start >>> 0)), pos); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (!_r$1) { */ case 5:
|
|
freeBitState(b);
|
|
$s = -1; return sliceType$3.nil;
|
|
/* } */ case 6:
|
|
$s = 4; continue;
|
|
/* } else { */ case 3:
|
|
width = -1;
|
|
/* while (true) { */ case 8:
|
|
/* if (!(pos <= end && !((width === 0)))) { break; } */ if(!(pos <= end && !((width === 0)))) { $s = 9; continue; }
|
|
/* */ if (re.prefix.length > 0) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (re.prefix.length > 0) { */ case 10:
|
|
_r$2 = i.index(re, pos); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
advance = _r$2;
|
|
if (advance < 0) {
|
|
freeBitState(b);
|
|
$s = -1; return sliceType$3.nil;
|
|
}
|
|
pos = pos + (advance) >> 0;
|
|
/* } */ case 11:
|
|
if (b.cap.$length > 0) {
|
|
(x$1 = b.cap, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0] = pos));
|
|
}
|
|
_r$3 = re.tryBacktrack(b, i, ((re.prog.Start >>> 0)), pos); /* */ $s = 15; case 15: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (_r$3) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (_r$3) { */ case 13:
|
|
/* goto Match */ $s = 16; continue;
|
|
/* } */ case 14:
|
|
_r$4 = i.step(pos); /* */ $s = 17; case 17: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$4;
|
|
width = _tuple$1[1];
|
|
pos = pos + (width) >> 0;
|
|
/* } */ $s = 8; continue; case 9:
|
|
freeBitState(b);
|
|
$s = -1; return sliceType$3.nil;
|
|
/* } */ case 4:
|
|
/* Match: */ case 16:
|
|
dstCap = $appendSlice(dstCap, b.matchcap);
|
|
freeBitState(b);
|
|
$s = -1; return dstCap;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.backtrack }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.advance = advance; $f.b = b; $f.dstCap = dstCap; $f.end = end; $f.i = i; $f.ib = ib; $f.is = is; $f.ncap = ncap; $f.pos = pos; $f.re = re; $f.startCond = startCond; $f.width = width; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.backtrack = function(ib, is, pos, ncap, dstCap) { return this.$val.backtrack(ib, is, pos, ncap, dstCap); };
|
|
inputs.ptr.prototype.newBytes = function(b) {
|
|
var b, i;
|
|
i = this;
|
|
i.bytes.str = b;
|
|
return i.bytes;
|
|
};
|
|
inputs.prototype.newBytes = function(b) { return this.$val.newBytes(b); };
|
|
inputs.ptr.prototype.newString = function(s) {
|
|
var i, s;
|
|
i = this;
|
|
i.string.str = s;
|
|
return i.string;
|
|
};
|
|
inputs.prototype.newString = function(s) { return this.$val.newString(s); };
|
|
inputs.ptr.prototype.newReader = function(r) {
|
|
var i, r;
|
|
i = this;
|
|
i.reader.r = r;
|
|
i.reader.atEOT = false;
|
|
i.reader.pos = 0;
|
|
return i.reader;
|
|
};
|
|
inputs.prototype.newReader = function(r) { return this.$val.newReader(r); };
|
|
inputs.ptr.prototype.clear = function() {
|
|
var i;
|
|
i = this;
|
|
if (!(i.bytes.str === sliceType$5.nil)) {
|
|
i.bytes.str = sliceType$5.nil;
|
|
} else if (!($interfaceIsEqual(i.reader.r, $ifaceNil))) {
|
|
i.reader.r = $ifaceNil;
|
|
} else {
|
|
i.string.str = "";
|
|
}
|
|
};
|
|
inputs.prototype.clear = function() { return this.$val.clear(); };
|
|
inputs.ptr.prototype.init = function(r, b, s) {
|
|
var b, i, r, s;
|
|
i = this;
|
|
if (!($interfaceIsEqual(r, $ifaceNil))) {
|
|
return [i.newReader(r), 0];
|
|
}
|
|
if (!(b === sliceType$5.nil)) {
|
|
return [i.newBytes(b), b.$length];
|
|
}
|
|
return [i.newString(s), s.length];
|
|
};
|
|
inputs.prototype.init = function(r, b, s) { return this.$val.init(r, b, s); };
|
|
machine.ptr.prototype.init = function(ncap) {
|
|
var _i, _ref, m, ncap, t;
|
|
m = this;
|
|
_ref = m.pool;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
t = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
t.cap = $subslice(t.cap, 0, ncap);
|
|
_i++;
|
|
}
|
|
m.matchcap = $subslice(m.matchcap, 0, ncap);
|
|
};
|
|
machine.prototype.init = function(ncap) { return this.$val.init(ncap); };
|
|
machine.ptr.prototype.alloc = function(i) {
|
|
var i, m, n, t, x, x$1;
|
|
m = this;
|
|
t = ptrType$1.nil;
|
|
n = m.pool.$length;
|
|
if (n > 0) {
|
|
t = (x = m.pool, x$1 = n - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
m.pool = $subslice(m.pool, 0, (n - 1 >> 0));
|
|
} else {
|
|
t = new thread.ptr(ptrType$2.nil, sliceType$3.nil);
|
|
t.cap = $makeSlice(sliceType$3, m.matchcap.$length, m.matchcap.$capacity);
|
|
}
|
|
t.inst = i;
|
|
return t;
|
|
};
|
|
machine.prototype.alloc = function(i) { return this.$val.alloc(i); };
|
|
newLazyFlag = function(r1, r2) {
|
|
var r1, r2, x, x$1, x$2;
|
|
return ((x = (x$1 = $shiftLeft64((new $Uint64(0, r1)), 32), x$2 = (new $Uint64(0, ((r2 >>> 0)))), new $Uint64(x$1.$high | x$2.$high, (x$1.$low | x$2.$low) >>> 0)), new lazyFlag(x.$high, x.$low)));
|
|
};
|
|
lazyFlag.prototype.match = function(op) {
|
|
var f, op, r1, r2;
|
|
f = this;
|
|
if (op === 0) {
|
|
return true;
|
|
}
|
|
r1 = (($shiftRightUint64(f, 32).$low >> 0));
|
|
if (!((((op & 1) >>> 0) === 0))) {
|
|
if (!((r1 === 10)) && r1 >= 0) {
|
|
return false;
|
|
}
|
|
op = (op & ~(1)) << 24 >>> 24;
|
|
}
|
|
if (!((((op & 4) >>> 0) === 0))) {
|
|
if (r1 >= 0) {
|
|
return false;
|
|
}
|
|
op = (op & ~(4)) << 24 >>> 24;
|
|
}
|
|
if (op === 0) {
|
|
return true;
|
|
}
|
|
r2 = ((f.$low >> 0));
|
|
if (!((((op & 2) >>> 0) === 0))) {
|
|
if (!((r2 === 10)) && r2 >= 0) {
|
|
return false;
|
|
}
|
|
op = (op & ~(2)) << 24 >>> 24;
|
|
}
|
|
if (!((((op & 8) >>> 0) === 0))) {
|
|
if (r2 >= 0) {
|
|
return false;
|
|
}
|
|
op = (op & ~(8)) << 24 >>> 24;
|
|
}
|
|
if (op === 0) {
|
|
return true;
|
|
}
|
|
if (!(syntax.IsWordChar(r1) === syntax.IsWordChar(r2))) {
|
|
op = (op & ~(16)) << 24 >>> 24;
|
|
} else {
|
|
op = (op & ~(32)) << 24 >>> 24;
|
|
}
|
|
return op === 0;
|
|
};
|
|
$ptrType(lazyFlag).prototype.match = function(op) { return this.$get().match(op); };
|
|
machine.ptr.prototype.match = function(i, pos) {
|
|
var _i, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _v, advance, flag, i, i$1, m, nextq, pos, r, r1, runq, startCond, width, width1, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _v = $f._v; advance = $f.advance; flag = $f.flag; i = $f.i; i$1 = $f.i$1; m = $f.m; nextq = $f.nextq; pos = $f.pos; r = $f.r; r1 = $f.r1; runq = $f.runq; startCond = $f.startCond; width = $f.width; width1 = $f.width1; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
flag = [flag];
|
|
m = this;
|
|
startCond = m.re.cond;
|
|
if (startCond === 255) {
|
|
$s = -1; return false;
|
|
}
|
|
m.matched = false;
|
|
_ref = m.matchcap;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i$1 = _i;
|
|
(x = m.matchcap, ((i$1 < 0 || i$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i$1] = -1));
|
|
_i++;
|
|
}
|
|
_tmp = m.q0;
|
|
_tmp$1 = m.q1;
|
|
runq = _tmp;
|
|
nextq = _tmp$1;
|
|
_tmp$2 = -1;
|
|
_tmp$3 = -1;
|
|
r = _tmp$2;
|
|
r1 = _tmp$3;
|
|
_tmp$4 = 0;
|
|
_tmp$5 = 0;
|
|
width = _tmp$4;
|
|
width1 = _tmp$5;
|
|
_r = i.step(pos); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
width = _tuple[1];
|
|
/* */ if (!((r === -1))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!((r === -1))) { */ case 2:
|
|
_r$1 = i.step(pos + width >> 0); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
r1 = _tuple$1[0];
|
|
width1 = _tuple$1[1];
|
|
/* } */ case 3:
|
|
flag[0] = new lazyFlag(0, 0);
|
|
/* */ if (pos === 0) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (pos === 0) { */ case 5:
|
|
flag[0] = newLazyFlag(-1, r);
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
_r$2 = i.context(pos); /* */ $s = 8; case 8: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
flag[0] = _r$2;
|
|
/* } */ case 7:
|
|
/* while (true) { */ case 9:
|
|
/* */ if (runq.dense.$length === 0) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (runq.dense.$length === 0) { */ case 11:
|
|
if (!((((startCond & 4) >>> 0) === 0)) && !((pos === 0))) {
|
|
/* break; */ $s = 10; continue;
|
|
}
|
|
if (m.matched) {
|
|
/* break; */ $s = 10; continue;
|
|
}
|
|
if (!(m.re.prefix.length > 0 && !((r1 === m.re.prefixRune)))) { _v = false; $s = 15; continue s; }
|
|
_r$3 = i.canCheckPrefix(); /* */ $s = 16; case 16: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_v = _r$3; case 15:
|
|
/* */ if (_v) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (_v) { */ case 13:
|
|
_r$4 = i.index(m.re, pos); /* */ $s = 17; case 17: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
advance = _r$4;
|
|
if (advance < 0) {
|
|
/* break; */ $s = 10; continue;
|
|
}
|
|
pos = pos + (advance) >> 0;
|
|
_r$5 = i.step(pos); /* */ $s = 18; case 18: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$5;
|
|
r = _tuple$2[0];
|
|
width = _tuple$2[1];
|
|
_r$6 = i.step(pos + width >> 0); /* */ $s = 19; case 19: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$6;
|
|
r1 = _tuple$3[0];
|
|
width1 = _tuple$3[1];
|
|
/* } */ case 14:
|
|
/* } */ case 12:
|
|
if (!m.matched) {
|
|
if (m.matchcap.$length > 0) {
|
|
(x$1 = m.matchcap, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0] = pos));
|
|
}
|
|
m.add(runq, ((m.p.Start >>> 0)), pos, m.matchcap, (flag.$ptr || (flag.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, flag))), ptrType$1.nil);
|
|
}
|
|
flag[0] = newLazyFlag(r, r1);
|
|
m.step(runq, nextq, pos, pos + width >> 0, r, (flag.$ptr || (flag.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, flag))));
|
|
if (width === 0) {
|
|
/* break; */ $s = 10; continue;
|
|
}
|
|
if ((m.matchcap.$length === 0) && m.matched) {
|
|
/* break; */ $s = 10; continue;
|
|
}
|
|
pos = pos + (width) >> 0;
|
|
_tmp$6 = r1;
|
|
_tmp$7 = width1;
|
|
r = _tmp$6;
|
|
width = _tmp$7;
|
|
/* */ if (!((r === -1))) { $s = 20; continue; }
|
|
/* */ $s = 21; continue;
|
|
/* if (!((r === -1))) { */ case 20:
|
|
_r$7 = i.step(pos + width >> 0); /* */ $s = 22; case 22: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$7;
|
|
r1 = _tuple$4[0];
|
|
width1 = _tuple$4[1];
|
|
/* } */ case 21:
|
|
_tmp$8 = nextq;
|
|
_tmp$9 = runq;
|
|
runq = _tmp$8;
|
|
nextq = _tmp$9;
|
|
/* } */ $s = 9; continue; case 10:
|
|
m.clear(nextq);
|
|
$s = -1; return m.matched;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: machine.ptr.prototype.match }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._v = _v; $f.advance = advance; $f.flag = flag; $f.i = i; $f.i$1 = i$1; $f.m = m; $f.nextq = nextq; $f.pos = pos; $f.r = r; $f.r1 = r1; $f.runq = runq; $f.startCond = startCond; $f.width = width; $f.width1 = width1; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
machine.prototype.match = function(i, pos) { return this.$val.match(i, pos); };
|
|
machine.ptr.prototype.clear = function(q) {
|
|
var _i, _ref, d, m, q;
|
|
m = this;
|
|
_ref = q.dense;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
d = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), entry);
|
|
if (!(d.t === ptrType$1.nil)) {
|
|
m.pool = $append(m.pool, d.t);
|
|
}
|
|
_i++;
|
|
}
|
|
q.dense = $subslice(q.dense, 0, 0);
|
|
};
|
|
machine.prototype.clear = function(q) { return this.$val.clear(q); };
|
|
machine.ptr.prototype.step = function(runq, nextq, pos, nextPos, c, nextCond) {
|
|
var _1, _i, _ref, add, c, d, d$1, i, j, longest, m, nextCond, nextPos, nextq, pos, runq, t, x, x$1, x$2, x$3, x$4, x$5;
|
|
m = this;
|
|
longest = m.re.longest;
|
|
j = 0;
|
|
while (true) {
|
|
if (!(j < runq.dense.$length)) { break; }
|
|
d = (x = runq.dense, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j]));
|
|
t = d.t;
|
|
if (t === ptrType$1.nil) {
|
|
j = j + (1) >> 0;
|
|
continue;
|
|
}
|
|
if (longest && m.matched && t.cap.$length > 0 && (x$1 = m.matchcap, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])) < (x$2 = t.cap, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0]))) {
|
|
m.pool = $append(m.pool, t);
|
|
j = j + (1) >> 0;
|
|
continue;
|
|
}
|
|
i = t.inst;
|
|
add = false;
|
|
_1 = i.Op;
|
|
if (_1 === (4)) {
|
|
if (t.cap.$length > 0 && (!longest || !m.matched || (x$3 = m.matchcap, (1 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 1])) < pos)) {
|
|
(x$4 = t.cap, (1 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 1] = pos));
|
|
$copySlice(m.matchcap, t.cap);
|
|
}
|
|
if (!longest) {
|
|
_ref = $subslice(runq.dense, (j + 1 >> 0));
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
d$1 = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), entry);
|
|
if (!(d$1.t === ptrType$1.nil)) {
|
|
m.pool = $append(m.pool, d$1.t);
|
|
}
|
|
_i++;
|
|
}
|
|
runq.dense = $subslice(runq.dense, 0, 0);
|
|
}
|
|
m.matched = true;
|
|
} else if (_1 === (7)) {
|
|
add = i.MatchRune(c);
|
|
} else if (_1 === (8)) {
|
|
add = c === (x$5 = i.Rune, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0]));
|
|
} else if (_1 === (9)) {
|
|
add = true;
|
|
} else if (_1 === (10)) {
|
|
add = !((c === 10));
|
|
} else {
|
|
$panic(new $String("bad inst"));
|
|
}
|
|
if (add) {
|
|
t = m.add(nextq, i.Out, nextPos, t.cap, nextCond, t);
|
|
}
|
|
if (!(t === ptrType$1.nil)) {
|
|
m.pool = $append(m.pool, t);
|
|
}
|
|
j = j + (1) >> 0;
|
|
}
|
|
runq.dense = $subslice(runq.dense, 0, 0);
|
|
};
|
|
machine.prototype.step = function(runq, nextq, pos, nextPos, c, nextCond) { return this.$val.step(runq, nextq, pos, nextPos, c, nextCond); };
|
|
machine.ptr.prototype.add = function(q, pc, pos, cap, cond, t) {
|
|
var _1, cap, cond, d, i, j, j$1, m, opos, pc, pos, q, t, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, $s;
|
|
/* */ $s = 0; s: while (true) { switch ($s) { case 0:
|
|
m = this;
|
|
/* Again: */ case 1:
|
|
if (pc === 0) {
|
|
$s = -1; return t;
|
|
}
|
|
j = (x = q.sparse, ((pc < 0 || pc >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pc]));
|
|
if (j < ((q.dense.$length >>> 0)) && ((x$1 = q.dense, ((j < 0 || j >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + j])).pc === pc)) {
|
|
$s = -1; return t;
|
|
}
|
|
j$1 = q.dense.$length;
|
|
q.dense = $subslice(q.dense, 0, (j$1 + 1 >> 0));
|
|
d = (x$2 = q.dense, ((j$1 < 0 || j$1 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + j$1]));
|
|
d.t = ptrType$1.nil;
|
|
d.pc = pc;
|
|
(x$3 = q.sparse, ((pc < 0 || pc >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + pc] = ((j$1 >>> 0))));
|
|
i = (x$4 = m.p.Inst, ((pc < 0 || pc >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + pc]));
|
|
_1 = i.Op;
|
|
/* */ if (_1 === (5)) { $s = 3; continue; }
|
|
/* */ if ((_1 === (0)) || (_1 === (1))) { $s = 4; continue; }
|
|
/* */ if (_1 === (3)) { $s = 5; continue; }
|
|
/* */ if (_1 === (6)) { $s = 6; continue; }
|
|
/* */ if (_1 === (2)) { $s = 7; continue; }
|
|
/* */ if ((_1 === (4)) || (_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10))) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (_1 === (5)) { */ case 3:
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (0)) || (_1 === (1))) { */ case 4:
|
|
t = m.add(q, i.Out, pos, cap, cond, t);
|
|
pc = i.Arg;
|
|
/* goto Again */ $s = 1; continue;
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (3)) { */ case 5:
|
|
/* */ if (cond.match(((i.Arg << 24 >>> 24)))) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (cond.match(((i.Arg << 24 >>> 24)))) { */ case 11:
|
|
pc = i.Out;
|
|
/* goto Again */ $s = 1; continue;
|
|
/* } */ case 12:
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (6)) { */ case 6:
|
|
pc = i.Out;
|
|
/* goto Again */ $s = 1; continue;
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (2)) { */ case 7:
|
|
/* */ if (((i.Arg >> 0)) < cap.$length) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (((i.Arg >> 0)) < cap.$length) { */ case 13:
|
|
opos = (x$5 = i.Arg, ((x$5 < 0 || x$5 >= cap.$length) ? ($throwRuntimeError("index out of range"), undefined) : cap.$array[cap.$offset + x$5]));
|
|
(x$6 = i.Arg, ((x$6 < 0 || x$6 >= cap.$length) ? ($throwRuntimeError("index out of range"), undefined) : cap.$array[cap.$offset + x$6] = pos));
|
|
m.add(q, i.Out, pos, cap, cond, ptrType$1.nil);
|
|
(x$7 = i.Arg, ((x$7 < 0 || x$7 >= cap.$length) ? ($throwRuntimeError("index out of range"), undefined) : cap.$array[cap.$offset + x$7] = opos));
|
|
$s = 15; continue;
|
|
/* } else { */ case 14:
|
|
pc = i.Out;
|
|
/* goto Again */ $s = 1; continue;
|
|
/* } */ case 15:
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (4)) || (_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10))) { */ case 8:
|
|
if (t === ptrType$1.nil) {
|
|
t = m.alloc(i);
|
|
} else {
|
|
t.inst = i;
|
|
}
|
|
if (cap.$length > 0 && !((x$8 = t.cap, $indexPtr(x$8.$array, x$8.$offset + 0, ptrType$4)) === $indexPtr(cap.$array, cap.$offset + 0, ptrType$4))) {
|
|
$copySlice(t.cap, cap);
|
|
}
|
|
d.t = t;
|
|
t = ptrType$1.nil;
|
|
$s = 10; continue;
|
|
/* } else { */ case 9:
|
|
$panic(new $String("unhandled"));
|
|
/* } */ case 10:
|
|
case 2:
|
|
$s = -1; return t;
|
|
/* */ } return; }
|
|
};
|
|
machine.prototype.add = function(q, pc, pos, cap, cond, t) { return this.$val.add(q, pc, pos, cap, cond, t); };
|
|
newOnePassMachine = function() {
|
|
var _r, _tuple, m, ok, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; m = $f.m; ok = $f.ok; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = onePassPool.Get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = $assertType(_r, ptrType$5, true);
|
|
m = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!ok) {
|
|
m = new onePassMachine.ptr(new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0)), sliceType$3.nil);
|
|
}
|
|
$s = -1; return m;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: newOnePassMachine }; } $f._r = _r; $f._tuple = _tuple; $f.m = m; $f.ok = ok; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
freeOnePassMachine = function(m) {
|
|
var m;
|
|
m.inputs.clear();
|
|
onePassPool.Put(m);
|
|
};
|
|
Regexp.ptr.prototype.doOnePass = function(ir, ib, is, pos, ncap, dstCap) {
|
|
var _1, _i, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _v, dstCap, flag, i, i$1, ib, inst, ir, is, m, matched, ncap, pc, pos, r, r1, re, startCond, width, width1, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _v = $f._v; dstCap = $f.dstCap; flag = $f.flag; i = $f.i; i$1 = $f.i$1; ib = $f.ib; inst = $f.inst; ir = $f.ir; is = $f.is; m = $f.m; matched = $f.matched; ncap = $f.ncap; pc = $f.pc; pos = $f.pos; r = $f.r; r1 = $f.r1; re = $f.re; startCond = $f.startCond; width = $f.width; width1 = $f.width1; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
inst = [inst];
|
|
re = this;
|
|
startCond = re.cond;
|
|
if (startCond === 255) {
|
|
$s = -1; return sliceType$3.nil;
|
|
}
|
|
_r = newOnePassMachine(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
m = _r;
|
|
if (m.matchcap.$capacity < ncap) {
|
|
m.matchcap = $makeSlice(sliceType$3, ncap);
|
|
} else {
|
|
m.matchcap = $subslice(m.matchcap, 0, ncap);
|
|
}
|
|
matched = false;
|
|
_ref = m.matchcap;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
(x = m.matchcap, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i] = -1));
|
|
_i++;
|
|
}
|
|
_tuple = m.inputs.init(ir, ib, is);
|
|
i$1 = _tuple[0];
|
|
_tmp = -1;
|
|
_tmp$1 = -1;
|
|
r = _tmp;
|
|
r1 = _tmp$1;
|
|
_tmp$2 = 0;
|
|
_tmp$3 = 0;
|
|
width = _tmp$2;
|
|
width1 = _tmp$3;
|
|
_r$1 = i$1.step(pos); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
r = _tuple$1[0];
|
|
width = _tuple$1[1];
|
|
/* */ if (!((r === -1))) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!((r === -1))) { */ case 3:
|
|
_r$2 = i$1.step(pos + width >> 0); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$2;
|
|
r1 = _tuple$2[0];
|
|
width1 = _tuple$2[1];
|
|
/* } */ case 4:
|
|
flag = new lazyFlag(0, 0);
|
|
/* */ if (pos === 0) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (pos === 0) { */ case 6:
|
|
flag = newLazyFlag(-1, r);
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
_r$3 = i$1.context(pos); /* */ $s = 9; case 9: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
flag = _r$3;
|
|
/* } */ case 8:
|
|
pc = re.onepass.Start;
|
|
inst[0] = $clone((x$1 = re.onepass.Inst, ((pc < 0 || pc >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + pc])), onePassInst);
|
|
if (!((pos === 0) && flag.match(((inst[0].Inst.Arg << 24 >>> 24))) && re.prefix.length > 0)) { _v = false; $s = 12; continue s; }
|
|
_r$4 = i$1.canCheckPrefix(); /* */ $s = 13; case 13: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_v = _r$4; case 12:
|
|
/* */ if (_v) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_v) { */ case 10:
|
|
_r$5 = i$1.hasPrefix(re); /* */ $s = 16; case 16: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$5) { $s = 14; continue; }
|
|
/* */ $s = 15; continue;
|
|
/* if (!_r$5) { */ case 14:
|
|
/* goto Return */ $s = 17; continue;
|
|
/* } */ case 15:
|
|
pos = pos + (re.prefix.length) >> 0;
|
|
_r$6 = i$1.step(pos); /* */ $s = 18; case 18: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$6;
|
|
r = _tuple$3[0];
|
|
width = _tuple$3[1];
|
|
_r$7 = i$1.step(pos + width >> 0); /* */ $s = 19; case 19: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$7;
|
|
r1 = _tuple$4[0];
|
|
width1 = _tuple$4[1];
|
|
_r$8 = i$1.context(pos); /* */ $s = 20; case 20: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
flag = _r$8;
|
|
pc = ((re.prefixEnd >> 0));
|
|
/* } */ case 11:
|
|
/* while (true) { */ case 21:
|
|
onePassInst.copy(inst[0], (x$2 = re.onepass.Inst, ((pc < 0 || pc >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + pc])));
|
|
pc = ((inst[0].Inst.Out >> 0));
|
|
_1 = inst[0].Inst.Op;
|
|
/* */ if (_1 === (4)) { $s = 24; continue; }
|
|
/* */ if (_1 === (7)) { $s = 25; continue; }
|
|
/* */ if (_1 === (8)) { $s = 26; continue; }
|
|
/* */ if (_1 === (9)) { $s = 27; continue; }
|
|
/* */ if (_1 === (10)) { $s = 28; continue; }
|
|
/* */ if ((_1 === (0)) || (_1 === (1))) { $s = 29; continue; }
|
|
/* */ if (_1 === (5)) { $s = 30; continue; }
|
|
/* */ if (_1 === (6)) { $s = 31; continue; }
|
|
/* */ if (_1 === (3)) { $s = 32; continue; }
|
|
/* */ if (_1 === (2)) { $s = 33; continue; }
|
|
/* */ $s = 34; continue;
|
|
/* if (_1 === (4)) { */ case 24:
|
|
matched = true;
|
|
if (m.matchcap.$length > 0) {
|
|
(x$3 = m.matchcap, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0] = 0));
|
|
(x$4 = m.matchcap, (1 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 1] = pos));
|
|
}
|
|
/* goto Return */ $s = 17; continue;
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (7)) { */ case 25:
|
|
/* */ if (!inst[0].Inst.MatchRune(r)) { $s = 36; continue; }
|
|
/* */ $s = 37; continue;
|
|
/* if (!inst[0].Inst.MatchRune(r)) { */ case 36:
|
|
/* goto Return */ $s = 17; continue;
|
|
/* } */ case 37:
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (8)) { */ case 26:
|
|
/* */ if (!((r === (x$5 = inst[0].Inst.Rune, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0]))))) { $s = 38; continue; }
|
|
/* */ $s = 39; continue;
|
|
/* if (!((r === (x$5 = inst[0].Inst.Rune, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0]))))) { */ case 38:
|
|
/* goto Return */ $s = 17; continue;
|
|
/* } */ case 39:
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (9)) { */ case 27:
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (10)) { */ case 28:
|
|
/* */ if (r === 10) { $s = 40; continue; }
|
|
/* */ $s = 41; continue;
|
|
/* if (r === 10) { */ case 40:
|
|
/* goto Return */ $s = 17; continue;
|
|
/* } */ case 41:
|
|
$s = 35; continue;
|
|
/* } else if ((_1 === (0)) || (_1 === (1))) { */ case 29:
|
|
pc = ((onePassNext(inst[0], r) >> 0));
|
|
/* continue; */ $s = 21; continue;
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (5)) { */ case 30:
|
|
/* goto Return */ $s = 17; continue;
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (6)) { */ case 31:
|
|
/* continue; */ $s = 21; continue;
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (3)) { */ case 32:
|
|
/* */ if (!flag.match(((inst[0].Inst.Arg << 24 >>> 24)))) { $s = 42; continue; }
|
|
/* */ $s = 43; continue;
|
|
/* if (!flag.match(((inst[0].Inst.Arg << 24 >>> 24)))) { */ case 42:
|
|
/* goto Return */ $s = 17; continue;
|
|
/* } */ case 43:
|
|
/* continue; */ $s = 21; continue;
|
|
$s = 35; continue;
|
|
/* } else if (_1 === (2)) { */ case 33:
|
|
if (((inst[0].Inst.Arg >> 0)) < m.matchcap.$length) {
|
|
(x$6 = m.matchcap, x$7 = inst[0].Inst.Arg, ((x$7 < 0 || x$7 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + x$7] = pos));
|
|
}
|
|
/* continue; */ $s = 21; continue;
|
|
$s = 35; continue;
|
|
/* } else { */ case 34:
|
|
$panic(new $String("bad inst"));
|
|
/* } */ case 35:
|
|
case 23:
|
|
if (width === 0) {
|
|
/* break; */ $s = 22; continue;
|
|
}
|
|
flag = newLazyFlag(r, r1);
|
|
pos = pos + (width) >> 0;
|
|
_tmp$4 = r1;
|
|
_tmp$5 = width1;
|
|
r = _tmp$4;
|
|
width = _tmp$5;
|
|
/* */ if (!((r === -1))) { $s = 44; continue; }
|
|
/* */ $s = 45; continue;
|
|
/* if (!((r === -1))) { */ case 44:
|
|
_r$9 = i$1.step(pos + width >> 0); /* */ $s = 46; case 46: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple$5 = _r$9;
|
|
r1 = _tuple$5[0];
|
|
width1 = _tuple$5[1];
|
|
/* } */ case 45:
|
|
/* } */ $s = 21; continue; case 22:
|
|
/* Return: */ case 17:
|
|
if (!matched) {
|
|
freeOnePassMachine(m);
|
|
$s = -1; return sliceType$3.nil;
|
|
}
|
|
dstCap = $appendSlice(dstCap, m.matchcap);
|
|
freeOnePassMachine(m);
|
|
$s = -1; return dstCap;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.doOnePass }; } $f._1 = _1; $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._v = _v; $f.dstCap = dstCap; $f.flag = flag; $f.i = i; $f.i$1 = i$1; $f.ib = ib; $f.inst = inst; $f.ir = ir; $f.is = is; $f.m = m; $f.matched = matched; $f.ncap = ncap; $f.pc = pc; $f.pos = pos; $f.r = r; $f.r1 = r1; $f.re = re; $f.startCond = startCond; $f.width = width; $f.width1 = width1; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.doOnePass = function(ir, ib, is, pos, ncap, dstCap) { return this.$val.doOnePass(ir, ib, is, pos, ncap, dstCap); };
|
|
Regexp.ptr.prototype.doMatch = function(r, b, s) {
|
|
var _r, b, r, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; r = $f.r; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doExecute(r, b, s, 0, 0, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return !(_r === sliceType$3.nil);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.doMatch }; } $f._r = _r; $f.b = b; $f.r = r; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.doMatch = function(r, b, s) { return this.$val.doMatch(r, b, s); };
|
|
Regexp.ptr.prototype.doExecute = function(r, b, s, pos, ncap, dstCap) {
|
|
var _r, _r$1, _r$2, _r$3, _tuple, b, dstCap, i, m, ncap, pos, r, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tuple = $f._tuple; b = $f.b; dstCap = $f.dstCap; i = $f.i; m = $f.m; ncap = $f.ncap; pos = $f.pos; r = $f.r; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
if (dstCap === sliceType$3.nil) {
|
|
dstCap = $subslice(new sliceType$3(arrayNoInts), 0, 0, 0);
|
|
}
|
|
/* */ if (!(re.onepass === ptrType$6.nil)) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!(re.onepass === ptrType$6.nil)) { */ case 1:
|
|
_r = re.doOnePass(r, b, s, pos, ncap, dstCap); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
/* */ if ($interfaceIsEqual(r, $ifaceNil) && (b.$length + s.length >> 0) < re.maxBitStateLen) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ($interfaceIsEqual(r, $ifaceNil) && (b.$length + s.length >> 0) < re.maxBitStateLen) { */ case 4:
|
|
_r$1 = re.backtrack(b, s, pos, ncap, dstCap); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } */ case 5:
|
|
_r$2 = re.get(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
m = _r$2;
|
|
_tuple = m.inputs.init(r, b, s);
|
|
i = _tuple[0];
|
|
m.init(ncap);
|
|
_r$3 = m.match(i, pos); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$3) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (!_r$3) { */ case 8:
|
|
re.put(m);
|
|
$s = -1; return sliceType$3.nil;
|
|
/* } */ case 9:
|
|
dstCap = $appendSlice(dstCap, m.matchcap);
|
|
re.put(m);
|
|
$s = -1; return dstCap;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.doExecute }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tuple = _tuple; $f.b = b; $f.dstCap = dstCap; $f.i = i; $f.m = m; $f.ncap = ncap; $f.pos = pos; $f.r = r; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.doExecute = function(r, b, s, pos, ncap, dstCap) { return this.$val.doExecute(r, b, s, pos, ncap, dstCap); };
|
|
onePassPrefix = function(p) {
|
|
var _tmp, _tmp$1, _tmp$10, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, buf, complete, i, p, pc, prefix, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
|
|
prefix = "";
|
|
complete = false;
|
|
pc = 0;
|
|
i = (x = p.Inst, x$1 = p.Start, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
if (!((i.Op === 3)) || ((((((i.Arg << 24 >>> 24))) & 4) >>> 0) === 0)) {
|
|
_tmp = "";
|
|
_tmp$1 = i.Op === 4;
|
|
_tmp$2 = ((p.Start >>> 0));
|
|
prefix = _tmp;
|
|
complete = _tmp$1;
|
|
pc = _tmp$2;
|
|
return [prefix, complete, pc];
|
|
}
|
|
pc = i.Out;
|
|
i = (x$2 = p.Inst, ((pc < 0 || pc >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + pc]));
|
|
while (true) {
|
|
if (!(i.Op === 6)) { break; }
|
|
pc = i.Out;
|
|
i = (x$3 = p.Inst, ((pc < 0 || pc >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + pc]));
|
|
}
|
|
if (!((iop(i) === 7)) || !((i.Rune.$length === 1))) {
|
|
_tmp$3 = "";
|
|
_tmp$4 = i.Op === 4;
|
|
_tmp$5 = ((p.Start >>> 0));
|
|
prefix = _tmp$3;
|
|
complete = _tmp$4;
|
|
pc = _tmp$5;
|
|
return [prefix, complete, pc];
|
|
}
|
|
buf = new strings.Builder.ptr(ptrType$7.nil, sliceType$5.nil);
|
|
while (true) {
|
|
if (!((iop(i) === 7) && (i.Rune.$length === 1) && (((((i.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { break; }
|
|
buf.WriteRune((x$4 = i.Rune, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0])));
|
|
_tmp$6 = i.Out;
|
|
_tmp$7 = (x$5 = p.Inst, x$6 = i.Out, ((x$6 < 0 || x$6 >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + x$6]));
|
|
pc = _tmp$6;
|
|
i = _tmp$7;
|
|
}
|
|
if ((i.Op === 3) && !((((((i.Arg << 24 >>> 24)) & 8) >>> 0) === 0)) && ((x$7 = p.Inst, x$8 = i.Out, ((x$8 < 0 || x$8 >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + x$8])).Op === 4)) {
|
|
complete = true;
|
|
}
|
|
_tmp$8 = buf.String();
|
|
_tmp$9 = complete;
|
|
_tmp$10 = pc;
|
|
prefix = _tmp$8;
|
|
complete = _tmp$9;
|
|
pc = _tmp$10;
|
|
return [prefix, complete, pc];
|
|
};
|
|
onePassNext = function(i, r) {
|
|
var i, next, r, x;
|
|
next = i.Inst.MatchRunePos(r);
|
|
if (next >= 0) {
|
|
return (x = i.Next, ((next < 0 || next >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + next]));
|
|
}
|
|
if (i.Inst.Op === 1) {
|
|
return i.Inst.Out;
|
|
}
|
|
return 0;
|
|
};
|
|
iop = function(i) {
|
|
var _1, i, op;
|
|
op = i.Op;
|
|
_1 = op;
|
|
if ((_1 === (8)) || (_1 === (9)) || (_1 === (10))) {
|
|
op = 7;
|
|
}
|
|
return op;
|
|
};
|
|
queueOnePass.ptr.prototype.empty = function() {
|
|
var q;
|
|
q = this;
|
|
return q.nextIndex >= q.size;
|
|
};
|
|
queueOnePass.prototype.empty = function() { return this.$val.empty(); };
|
|
queueOnePass.ptr.prototype.next = function() {
|
|
var n, q, x, x$1;
|
|
n = 0;
|
|
q = this;
|
|
n = (x = q.dense, x$1 = q.nextIndex, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
|
|
q.nextIndex = q.nextIndex + (1) >>> 0;
|
|
return n;
|
|
};
|
|
queueOnePass.prototype.next = function() { return this.$val.next(); };
|
|
queueOnePass.ptr.prototype.clear = function() {
|
|
var q;
|
|
q = this;
|
|
q.size = 0;
|
|
q.nextIndex = 0;
|
|
};
|
|
queueOnePass.prototype.clear = function() { return this.$val.clear(); };
|
|
queueOnePass.ptr.prototype.contains = function(u) {
|
|
var q, u, x, x$1, x$2, x$3;
|
|
q = this;
|
|
if (u >= ((q.sparse.$length >>> 0))) {
|
|
return false;
|
|
}
|
|
return (x = q.sparse, ((u < 0 || u >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + u])) < q.size && ((x$1 = q.dense, x$2 = (x$3 = q.sparse, ((u < 0 || u >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + u])), ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2])) === u);
|
|
};
|
|
queueOnePass.prototype.contains = function(u) { return this.$val.contains(u); };
|
|
queueOnePass.ptr.prototype.insert = function(u) {
|
|
var q, u;
|
|
q = this;
|
|
if (!q.contains(u)) {
|
|
q.insertNew(u);
|
|
}
|
|
};
|
|
queueOnePass.prototype.insert = function(u) { return this.$val.insert(u); };
|
|
queueOnePass.ptr.prototype.insertNew = function(u) {
|
|
var q, u, x, x$1, x$2;
|
|
q = this;
|
|
if (u >= ((q.sparse.$length >>> 0))) {
|
|
return;
|
|
}
|
|
(x = q.sparse, ((u < 0 || u >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + u] = q.size));
|
|
(x$1 = q.dense, x$2 = q.size, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2] = u));
|
|
q.size = q.size + (1) >>> 0;
|
|
};
|
|
queueOnePass.prototype.insertNew = function(u) { return this.$val.insertNew(u); };
|
|
newQueue = function(size) {
|
|
var q, size;
|
|
q = ptrType$8.nil;
|
|
q = new queueOnePass.ptr($makeSlice(sliceType$2, size), $makeSlice(sliceType$2, size), 0, 0);
|
|
return q;
|
|
};
|
|
mergeRuneSets = function(leftRunes, rightRunes, leftPC, rightPC) {
|
|
var _r, _r$1, _r$2, _r$3, _tmp, _tmp$1, extend, ix, leftLen, leftPC, leftRunes, lx, merged, next, ok, rightLen, rightPC, rightRunes, rx, x, x$1, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; extend = $f.extend; ix = $f.ix; leftLen = $f.leftLen; leftPC = $f.leftPC; leftRunes = $f.leftRunes; lx = $f.lx; merged = $f.merged; next = $f.next; ok = $f.ok; rightLen = $f.rightLen; rightPC = $f.rightPC; rightRunes = $f.rightRunes; rx = $f.rx; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
ix = [ix];
|
|
lx = [lx];
|
|
merged = [merged];
|
|
next = [next];
|
|
ok = [ok];
|
|
rx = [rx];
|
|
leftLen = leftRunes.$get().$length;
|
|
rightLen = rightRunes.$get().$length;
|
|
if (!(((leftLen & 1) === 0)) || !(((rightLen & 1) === 0))) {
|
|
$panic(new $String("mergeRuneSets odd length []rune"));
|
|
}
|
|
_tmp = 0;
|
|
_tmp$1 = 0;
|
|
lx[0] = _tmp;
|
|
rx[0] = _tmp$1;
|
|
merged[0] = $makeSlice(sliceType$1, 0);
|
|
next[0] = $makeSlice(sliceType$2, 0);
|
|
ok[0] = true;
|
|
$deferred.push([(function(ix, lx, merged, next, ok, rx) { return function() {
|
|
if (!ok[0]) {
|
|
merged[0] = sliceType$1.nil;
|
|
next[0] = sliceType$2.nil;
|
|
}
|
|
}; })(ix, lx, merged, next, ok, rx), []]);
|
|
ix[0] = -1;
|
|
extend = (function(ix, lx, merged, next, ok, rx) { return function(newLow, newArray, pc) {
|
|
var newArray, newLow, pc, x, x$1, x$2, x$3, x$4, x$5;
|
|
if (ix[0] > 0 && (x = newArray.$get(), x$1 = newLow.$get(), ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])) <= ((ix[0] < 0 || ix[0] >= merged[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : merged[0].$array[merged[0].$offset + ix[0]])) {
|
|
return false;
|
|
}
|
|
merged[0] = $append(merged[0], (x$2 = newArray.$get(), x$3 = newLow.$get(), ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3])), (x$4 = newArray.$get(), x$5 = newLow.$get() + 1 >> 0, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])));
|
|
newLow.$set(newLow.$get() + (2) >> 0);
|
|
ix[0] = ix[0] + (2) >> 0;
|
|
next[0] = $append(next[0], pc);
|
|
return true;
|
|
}; })(ix, lx, merged, next, ok, rx);
|
|
/* while (true) { */ case 1:
|
|
/* if (!(lx[0] < leftLen || rx[0] < rightLen)) { break; } */ if(!(lx[0] < leftLen || rx[0] < rightLen)) { $s = 2; continue; }
|
|
/* */ if (rx[0] >= rightLen) { $s = 4; continue; }
|
|
/* */ if (lx[0] >= leftLen) { $s = 5; continue; }
|
|
/* */ if ((x = rightRunes.$get(), ((rx[0] < 0 || rx[0] >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + rx[0]])) < (x$1 = leftRunes.$get(), ((lx[0] < 0 || lx[0] >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + lx[0]]))) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (rx[0] >= rightLen) { */ case 4:
|
|
_r = extend((lx.$ptr || (lx.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, lx))), leftRunes, leftPC); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
ok[0] = _r;
|
|
$s = 8; continue;
|
|
/* } else if (lx[0] >= leftLen) { */ case 5:
|
|
_r$1 = extend((rx.$ptr || (rx.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, rx))), rightRunes, rightPC); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
ok[0] = _r$1;
|
|
$s = 8; continue;
|
|
/* } else if ((x = rightRunes.$get(), ((rx[0] < 0 || rx[0] >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + rx[0]])) < (x$1 = leftRunes.$get(), ((lx[0] < 0 || lx[0] >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + lx[0]]))) { */ case 6:
|
|
_r$2 = extend((rx.$ptr || (rx.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, rx))), rightRunes, rightPC); /* */ $s = 11; case 11: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
ok[0] = _r$2;
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
_r$3 = extend((lx.$ptr || (lx.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, lx))), leftRunes, leftPC); /* */ $s = 12; case 12: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
ok[0] = _r$3;
|
|
/* } */ case 8:
|
|
case 3:
|
|
if (!ok[0]) {
|
|
$s = -1; return [noRune, noNext];
|
|
}
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [merged[0], next[0]];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [sliceType$1.nil, sliceType$2.nil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: mergeRuneSets }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f.extend = extend; $f.ix = ix; $f.leftLen = leftLen; $f.leftPC = leftPC; $f.leftRunes = leftRunes; $f.lx = lx; $f.merged = merged; $f.next = next; $f.ok = ok; $f.rightLen = rightLen; $f.rightPC = rightPC; $f.rightRunes = rightRunes; $f.rx = rx; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
cleanupOnePass = function(prog, original) {
|
|
var _1, _i, _ref, instOriginal, ix, original, prog, x, x$1, x$2;
|
|
_ref = original.Inst;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
ix = _i;
|
|
instOriginal = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syntax.Inst);
|
|
_1 = instOriginal.Op;
|
|
if ((_1 === (0)) || (_1 === (1)) || (_1 === (7))) {
|
|
} else if ((_1 === (2)) || (_1 === (3)) || (_1 === (6)) || (_1 === (4)) || (_1 === (5))) {
|
|
(x = prog.Inst, ((ix < 0 || ix >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + ix])).Next = sliceType$2.nil;
|
|
} else if ((_1 === (8)) || (_1 === (9)) || (_1 === (10))) {
|
|
(x$1 = prog.Inst, ((ix < 0 || ix >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + ix])).Next = sliceType$2.nil;
|
|
onePassInst.copy((x$2 = prog.Inst, ((ix < 0 || ix >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + ix])), new onePassInst.ptr($clone(instOriginal, syntax.Inst), sliceType$2.nil));
|
|
}
|
|
_i++;
|
|
}
|
|
};
|
|
onePassCopy = function(prog) {
|
|
var _1, _i, _i$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, i, inst, instAlt, instOther, p, p_A_Alt, p_A_Other, p_B_Alt, p_B_Other, patch, pc, prog, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
p = new onePassProg.ptr($makeSlice(sliceType$6, prog.Inst.$length), prog.Start, prog.NumCap);
|
|
_ref = prog.Inst;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
inst = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syntax.Inst);
|
|
onePassInst.copy((x = p.Inst, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])), new onePassInst.ptr($clone(inst, syntax.Inst), sliceType$2.nil));
|
|
_i++;
|
|
}
|
|
_ref$1 = p.Inst;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
pc = _i$1;
|
|
_1 = (x$1 = p.Inst, ((pc < 0 || pc >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + pc])).Inst.Op;
|
|
if ((_1 === (0)) || (_1 === (1))) {
|
|
p_A_Other = (x$2 = (x$3 = p.Inst, ((pc < 0 || pc >= x$3.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + pc])), (x$2.$ptr_Out || (x$2.$ptr_Out = new ptrType$9(function() { return this.$target.Inst.Out; }, function($v) { this.$target.Inst.Out = $v; }, x$2))));
|
|
p_A_Alt = (x$4 = (x$5 = p.Inst, ((pc < 0 || pc >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + pc])), (x$4.$ptr_Arg || (x$4.$ptr_Arg = new ptrType$9(function() { return this.$target.Inst.Arg; }, function($v) { this.$target.Inst.Arg = $v; }, x$4))));
|
|
instAlt = $clone((x$6 = p.Inst, x$7 = p_A_Alt.$get(), ((x$7 < 0 || x$7 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + x$7])), onePassInst);
|
|
if (!((instAlt.Inst.Op === 0) || (instAlt.Inst.Op === 1))) {
|
|
_tmp = p_A_Other;
|
|
_tmp$1 = p_A_Alt;
|
|
p_A_Alt = _tmp;
|
|
p_A_Other = _tmp$1;
|
|
onePassInst.copy(instAlt, (x$8 = p.Inst, x$9 = p_A_Alt.$get(), ((x$9 < 0 || x$9 >= x$8.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$8.$array[x$8.$offset + x$9])));
|
|
if (!((instAlt.Inst.Op === 0) || (instAlt.Inst.Op === 1))) {
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
}
|
|
instOther = $clone((x$10 = p.Inst, x$11 = p_A_Other.$get(), ((x$11 < 0 || x$11 >= x$10.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + x$11])), onePassInst);
|
|
if ((instOther.Inst.Op === 0) || (instOther.Inst.Op === 1)) {
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
p_B_Alt = (x$12 = (x$13 = p.Inst, x$14 = p_A_Alt.$get(), ((x$14 < 0 || x$14 >= x$13.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$13.$array[x$13.$offset + x$14])), (x$12.$ptr_Out || (x$12.$ptr_Out = new ptrType$9(function() { return this.$target.Inst.Out; }, function($v) { this.$target.Inst.Out = $v; }, x$12))));
|
|
p_B_Other = (x$15 = (x$16 = p.Inst, x$17 = p_A_Alt.$get(), ((x$17 < 0 || x$17 >= x$16.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$16.$array[x$16.$offset + x$17])), (x$15.$ptr_Arg || (x$15.$ptr_Arg = new ptrType$9(function() { return this.$target.Inst.Arg; }, function($v) { this.$target.Inst.Arg = $v; }, x$15))));
|
|
patch = false;
|
|
if (instAlt.Inst.Out === ((pc >>> 0))) {
|
|
patch = true;
|
|
} else if (instAlt.Inst.Arg === ((pc >>> 0))) {
|
|
patch = true;
|
|
_tmp$2 = p_B_Other;
|
|
_tmp$3 = p_B_Alt;
|
|
p_B_Alt = _tmp$2;
|
|
p_B_Other = _tmp$3;
|
|
}
|
|
if (patch) {
|
|
p_B_Alt.$set(p_A_Other.$get());
|
|
}
|
|
if (p_A_Other.$get() === p_B_Alt.$get()) {
|
|
p_A_Alt.$set(p_B_Other.$get());
|
|
}
|
|
} else {
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
_i$1++;
|
|
}
|
|
return p;
|
|
};
|
|
runeSlice.prototype.Len = function() {
|
|
var p;
|
|
p = this;
|
|
return p.$length;
|
|
};
|
|
$ptrType(runeSlice).prototype.Len = function() { return this.$get().Len(); };
|
|
runeSlice.prototype.Less = function(i, j) {
|
|
var i, j, p;
|
|
p = this;
|
|
return ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]) < ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]);
|
|
};
|
|
$ptrType(runeSlice).prototype.Less = function(i, j) { return this.$get().Less(i, j); };
|
|
runeSlice.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, i, j, p;
|
|
p = this;
|
|
_tmp = ((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]);
|
|
_tmp$1 = ((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]);
|
|
((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i] = _tmp);
|
|
((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j] = _tmp$1);
|
|
};
|
|
$ptrType(runeSlice).prototype.Swap = function(i, j) { return this.$get().Swap(i, j); };
|
|
makeOnePass = function(p) {
|
|
var _i, _r, _ref, check, i, instQueue, m, onePassRunes, p, pc, visitQueue, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; check = $f.check; i = $f.i; instQueue = $f.instQueue; m = $f.m; onePassRunes = $f.onePassRunes; p = $f.p; pc = $f.pc; visitQueue = $f.visitQueue; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
check = [check];
|
|
instQueue = [instQueue];
|
|
onePassRunes = [onePassRunes];
|
|
p = [p];
|
|
visitQueue = [visitQueue];
|
|
if (p[0].Inst.$length >= 1000) {
|
|
$s = -1; return ptrType$6.nil;
|
|
}
|
|
instQueue[0] = newQueue(p[0].Inst.$length);
|
|
visitQueue[0] = newQueue(p[0].Inst.$length);
|
|
check[0] = $throwNilPointerError;
|
|
onePassRunes[0] = $makeSlice(sliceType$7, p[0].Inst.$length);
|
|
check[0] = (function(check, instQueue, onePassRunes, p, visitQueue) { return function $b(pc, m) {
|
|
var _1, _i, _i$1, _i$2, _i$3, _i$4, _q, _q$1, _q$2, _q$3, _q$4, _r, _r$1, _r$2, _r$3, _r$4, _ref, _ref$1, _ref$2, _ref$3, _ref$4, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, _v, i, i$1, i$2, i$3, i$4, inst, m, matchArg, matchOut, ok, pc, r0, r0$1, r1, r1$1, runes, runes$1, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _i$3 = $f._i$3; _i$4 = $f._i$4; _q = $f._q; _q$1 = $f._q$1; _q$2 = $f._q$2; _q$3 = $f._q$3; _q$4 = $f._q$4; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; _ref$3 = $f._ref$3; _ref$4 = $f._ref$4; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; _v = $f._v; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; i$4 = $f.i$4; inst = $f.inst; m = $f.m; matchArg = $f.matchArg; matchOut = $f.matchOut; ok = $f.ok; pc = $f.pc; r0 = $f.r0; r0$1 = $f.r0$1; r1 = $f.r1; r1$1 = $f.r1$1; runes = $f.runes; runes$1 = $f.runes$1; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$15 = $f.x$15; x$16 = $f.x$16; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ok = false;
|
|
ok = true;
|
|
inst = (x = p[0].Inst, ((pc < 0 || pc >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pc]));
|
|
if (visitQueue[0].contains(pc)) {
|
|
$s = -1; return ok;
|
|
}
|
|
visitQueue[0].insert(pc);
|
|
_1 = inst.Inst.Op;
|
|
/* */ if ((_1 === (0)) || (_1 === (1))) { $s = 2; continue; }
|
|
/* */ if ((_1 === (2)) || (_1 === (6))) { $s = 3; continue; }
|
|
/* */ if (_1 === (3)) { $s = 4; continue; }
|
|
/* */ if ((_1 === (4)) || (_1 === (5))) { $s = 5; continue; }
|
|
/* */ if (_1 === (7)) { $s = 6; continue; }
|
|
/* */ if (_1 === (8)) { $s = 7; continue; }
|
|
/* */ if (_1 === (9)) { $s = 8; continue; }
|
|
/* */ if (_1 === (10)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if ((_1 === (0)) || (_1 === (1))) { */ case 2:
|
|
_r = check[0](inst.Inst.Out, m); /* */ $s = 12; case 12: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
if (!(_r)) { _v = false; $s = 11; continue s; }
|
|
_r$1 = check[0](inst.Inst.Arg, m); /* */ $s = 13; case 13: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_v = _r$1; case 11:
|
|
ok = _v;
|
|
matchOut = (x$1 = inst.Inst.Out, ((x$1 < 0 || x$1 >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + x$1]));
|
|
matchArg = (x$2 = inst.Inst.Arg, ((x$2 < 0 || x$2 >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + x$2]));
|
|
if (matchOut && matchArg) {
|
|
ok = false;
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
if (matchArg) {
|
|
_tmp = inst.Inst.Arg;
|
|
_tmp$1 = inst.Inst.Out;
|
|
inst.Inst.Out = _tmp;
|
|
inst.Inst.Arg = _tmp$1;
|
|
_tmp$2 = matchArg;
|
|
_tmp$3 = matchOut;
|
|
matchOut = _tmp$2;
|
|
matchArg = _tmp$3;
|
|
}
|
|
if (matchOut) {
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = true);
|
|
inst.Inst.Op = 1;
|
|
}
|
|
_r$2 = mergeRuneSets($indexPtr(onePassRunes[0].$array, onePassRunes[0].$offset + inst.Inst.Out, ptrType$10), $indexPtr(onePassRunes[0].$array, onePassRunes[0].$offset + inst.Inst.Arg, ptrType$10), inst.Inst.Out, inst.Inst.Arg); /* */ $s = 14; case 14: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple = _r$2;
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = _tuple[0]);
|
|
inst.Next = _tuple[1];
|
|
if (inst.Next.$length > 0 && ((x$3 = inst.Next, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])) === 4294967295)) {
|
|
ok = false;
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (2)) || (_1 === (6))) { */ case 3:
|
|
_r$3 = check[0](inst.Inst.Out, m); /* */ $s = 15; case 15: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
ok = _r$3;
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = (x$4 = inst.Inst.Out, ((x$4 < 0 || x$4 >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + x$4])));
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = $appendSlice(new sliceType$1([]), (x$5 = inst.Inst.Out, ((x$5 < 0 || x$5 >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + x$5]))));
|
|
inst.Next = $makeSlice(sliceType$2, ((_q = ((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc]).$length / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0));
|
|
_ref = inst.Next;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
(x$6 = inst.Next, ((i < 0 || i >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + i] = inst.Inst.Out));
|
|
_i++;
|
|
}
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (3)) { */ case 4:
|
|
_r$4 = check[0](inst.Inst.Out, m); /* */ $s = 16; case 16: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
ok = _r$4;
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = (x$7 = inst.Inst.Out, ((x$7 < 0 || x$7 >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + x$7])));
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = $appendSlice(new sliceType$1([]), (x$8 = inst.Inst.Out, ((x$8 < 0 || x$8 >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + x$8]))));
|
|
inst.Next = $makeSlice(sliceType$2, ((_q$1 = ((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc]).$length / 2, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0));
|
|
_ref$1 = inst.Next;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
i$1 = _i$1;
|
|
(x$9 = inst.Next, ((i$1 < 0 || i$1 >= x$9.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$9.$array[x$9.$offset + i$1] = inst.Inst.Out));
|
|
_i$1++;
|
|
}
|
|
$s = 10; continue;
|
|
/* } else if ((_1 === (4)) || (_1 === (5))) { */ case 5:
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = (inst.Inst.Op === 4));
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (7)) { */ case 6:
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = false);
|
|
if (inst.Next.$length > 0) {
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
instQueue[0].insert(inst.Inst.Out);
|
|
if (inst.Inst.Rune.$length === 0) {
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = new sliceType$1([]));
|
|
inst.Next = new sliceType$2([inst.Inst.Out]);
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
runes = $makeSlice(sliceType$1, 0);
|
|
/* */ if ((inst.Inst.Rune.$length === 1) && !((((((inst.Inst.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { $s = 17; continue; }
|
|
/* */ $s = 18; continue;
|
|
/* if ((inst.Inst.Rune.$length === 1) && !((((((inst.Inst.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { */ case 17:
|
|
r0 = (x$10 = inst.Inst.Rune, (0 >= x$10.$length ? ($throwRuntimeError("index out of range"), undefined) : x$10.$array[x$10.$offset + 0]));
|
|
runes = $append(runes, r0, r0);
|
|
r1 = unicode.SimpleFold(r0);
|
|
while (true) {
|
|
if (!(!((r1 === r0)))) { break; }
|
|
runes = $append(runes, r1, r1);
|
|
r1 = unicode.SimpleFold(r1);
|
|
}
|
|
$r = sort.Sort(($subslice(new runeSlice(runes.$array), runes.$offset, runes.$offset + runes.$length))); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 19; continue;
|
|
/* } else { */ case 18:
|
|
runes = $appendSlice(runes, inst.Inst.Rune);
|
|
/* } */ case 19:
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = runes);
|
|
inst.Next = $makeSlice(sliceType$2, ((_q$2 = ((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc]).$length / 2, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0));
|
|
_ref$2 = inst.Next;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
i$2 = _i$2;
|
|
(x$11 = inst.Next, ((i$2 < 0 || i$2 >= x$11.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$11.$array[x$11.$offset + i$2] = inst.Inst.Out));
|
|
_i$2++;
|
|
}
|
|
inst.Inst.Op = 7;
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (8)) { */ case 7:
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = false);
|
|
if (inst.Next.$length > 0) {
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
instQueue[0].insert(inst.Inst.Out);
|
|
runes$1 = new sliceType$1([]);
|
|
/* */ if (!((((((inst.Inst.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { $s = 21; continue; }
|
|
/* */ $s = 22; continue;
|
|
/* if (!((((((inst.Inst.Arg << 16 >>> 16)) & 1) >>> 0) === 0))) { */ case 21:
|
|
r0$1 = (x$12 = inst.Inst.Rune, (0 >= x$12.$length ? ($throwRuntimeError("index out of range"), undefined) : x$12.$array[x$12.$offset + 0]));
|
|
runes$1 = $append(runes$1, r0$1, r0$1);
|
|
r1$1 = unicode.SimpleFold(r0$1);
|
|
while (true) {
|
|
if (!(!((r1$1 === r0$1)))) { break; }
|
|
runes$1 = $append(runes$1, r1$1, r1$1);
|
|
r1$1 = unicode.SimpleFold(r1$1);
|
|
}
|
|
$r = sort.Sort(($subslice(new runeSlice(runes$1.$array), runes$1.$offset, runes$1.$offset + runes$1.$length))); /* */ $s = 24; case 24: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 23; continue;
|
|
/* } else { */ case 22:
|
|
runes$1 = $append(runes$1, (x$13 = inst.Inst.Rune, (0 >= x$13.$length ? ($throwRuntimeError("index out of range"), undefined) : x$13.$array[x$13.$offset + 0])), (x$14 = inst.Inst.Rune, (0 >= x$14.$length ? ($throwRuntimeError("index out of range"), undefined) : x$14.$array[x$14.$offset + 0])));
|
|
/* } */ case 23:
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = runes$1);
|
|
inst.Next = $makeSlice(sliceType$2, ((_q$3 = ((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc]).$length / 2, (_q$3 === _q$3 && _q$3 !== 1/0 && _q$3 !== -1/0) ? _q$3 >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0));
|
|
_ref$3 = inst.Next;
|
|
_i$3 = 0;
|
|
while (true) {
|
|
if (!(_i$3 < _ref$3.$length)) { break; }
|
|
i$3 = _i$3;
|
|
(x$15 = inst.Next, ((i$3 < 0 || i$3 >= x$15.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$15.$array[x$15.$offset + i$3] = inst.Inst.Out));
|
|
_i$3++;
|
|
}
|
|
inst.Inst.Op = 7;
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (9)) { */ case 8:
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = false);
|
|
if (inst.Next.$length > 0) {
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
instQueue[0].insert(inst.Inst.Out);
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = $appendSlice(new sliceType$1([]), anyRune));
|
|
inst.Next = new sliceType$2([inst.Inst.Out]);
|
|
$s = 10; continue;
|
|
/* } else if (_1 === (10)) { */ case 9:
|
|
((pc < 0 || pc >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + pc] = false);
|
|
if (inst.Next.$length > 0) {
|
|
/* break; */ $s = 1; continue;
|
|
}
|
|
instQueue[0].insert(inst.Inst.Out);
|
|
((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc] = $appendSlice(new sliceType$1([]), anyRuneNotNL));
|
|
inst.Next = $makeSlice(sliceType$2, ((_q$4 = ((pc < 0 || pc >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + pc]).$length / 2, (_q$4 === _q$4 && _q$4 !== 1/0 && _q$4 !== -1/0) ? _q$4 >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0));
|
|
_ref$4 = inst.Next;
|
|
_i$4 = 0;
|
|
while (true) {
|
|
if (!(_i$4 < _ref$4.$length)) { break; }
|
|
i$4 = _i$4;
|
|
(x$16 = inst.Next, ((i$4 < 0 || i$4 >= x$16.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$16.$array[x$16.$offset + i$4] = inst.Inst.Out));
|
|
_i$4++;
|
|
}
|
|
/* } */ case 10:
|
|
case 1:
|
|
$s = -1; return ok;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._1 = _1; $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._i$3 = _i$3; $f._i$4 = _i$4; $f._q = _q; $f._q$1 = _q$1; $f._q$2 = _q$2; $f._q$3 = _q$3; $f._q$4 = _q$4; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f._ref$3 = _ref$3; $f._ref$4 = _ref$4; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f._v = _v; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.i$4 = i$4; $f.inst = inst; $f.m = m; $f.matchArg = matchArg; $f.matchOut = matchOut; $f.ok = ok; $f.pc = pc; $f.r0 = r0; $f.r0$1 = r0$1; $f.r1 = r1; $f.r1$1 = r1$1; $f.runes = runes; $f.runes$1 = runes$1; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$15 = x$15; $f.x$16 = x$16; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(check, instQueue, onePassRunes, p, visitQueue);
|
|
instQueue[0].clear();
|
|
instQueue[0].insert(((p[0].Start >>> 0)));
|
|
m = $makeSlice(sliceType$8, p[0].Inst.$length);
|
|
/* while (true) { */ case 1:
|
|
/* if (!(!instQueue[0].empty())) { break; } */ if(!(!instQueue[0].empty())) { $s = 2; continue; }
|
|
visitQueue[0].clear();
|
|
pc = instQueue[0].next();
|
|
_r = check[0](pc, m); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
/* */ if (!_r) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!_r) { */ case 3:
|
|
p[0] = ptrType$6.nil;
|
|
/* break; */ $s = 2; continue;
|
|
/* } */ case 4:
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (!(p[0] === ptrType$6.nil)) {
|
|
_ref = p[0].Inst;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
(x = p[0].Inst, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])).Inst.Rune = ((i < 0 || i >= onePassRunes[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : onePassRunes[0].$array[onePassRunes[0].$offset + i]);
|
|
_i++;
|
|
}
|
|
}
|
|
$s = -1; return p[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: makeOnePass }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.check = check; $f.i = i; $f.instQueue = instQueue; $f.m = m; $f.onePassRunes = onePassRunes; $f.p = p; $f.pc = pc; $f.visitQueue = visitQueue; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
compileOnePass = function(prog) {
|
|
var _1, _i, _r, _ref, inst, opOut, p, prog, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _r = $f._r; _ref = $f._ref; inst = $f.inst; opOut = $f.opOut; p = $f.p; prog = $f.prog; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
p = ptrType$6.nil;
|
|
if (prog.Start === 0) {
|
|
p = ptrType$6.nil;
|
|
$s = -1; return p;
|
|
}
|
|
if (!(((x = prog.Inst, x$1 = prog.Start, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).Op === 3)) || !(((((((x$2 = prog.Inst, x$3 = prog.Start, ((x$3 < 0 || x$3 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + x$3])).Arg << 24 >>> 24)) & 4) >>> 0) === 4))) {
|
|
p = ptrType$6.nil;
|
|
$s = -1; return p;
|
|
}
|
|
_ref = prog.Inst;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
inst = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syntax.Inst);
|
|
opOut = (x$4 = prog.Inst, x$5 = inst.Out, ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5])).Op;
|
|
_1 = inst.Op;
|
|
if ((_1 === (0)) || (_1 === (1))) {
|
|
if ((opOut === 4) || ((x$6 = prog.Inst, x$7 = inst.Arg, ((x$7 < 0 || x$7 >= x$6.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + x$7])).Op === 4)) {
|
|
p = ptrType$6.nil;
|
|
$s = -1; return p;
|
|
}
|
|
} else if (_1 === (3)) {
|
|
if (opOut === 4) {
|
|
if (((((inst.Arg << 24 >>> 24)) & 8) >>> 0) === 8) {
|
|
_i++;
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
p = ptrType$6.nil;
|
|
$s = -1; return p;
|
|
}
|
|
} else if (opOut === 4) {
|
|
p = ptrType$6.nil;
|
|
$s = -1; return p;
|
|
}
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
p = onePassCopy(prog);
|
|
_r = makeOnePass(p); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
p = _r;
|
|
if (!(p === ptrType$6.nil)) {
|
|
cleanupOnePass(p, prog);
|
|
}
|
|
p = p;
|
|
$s = -1; return p;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: compileOnePass }; } $f._1 = _1; $f._i = _i; $f._r = _r; $f._ref = _ref; $f.inst = inst; $f.opOut = opOut; $f.p = p; $f.prog = prog; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.ptr.prototype.String = function() {
|
|
var re;
|
|
re = this;
|
|
return re.expr;
|
|
};
|
|
Regexp.prototype.String = function() { return this.$val.String(); };
|
|
Regexp.ptr.prototype.Copy = function() {
|
|
var re, re2;
|
|
re = this;
|
|
re2 = $clone(re, Regexp);
|
|
return re2;
|
|
};
|
|
Regexp.prototype.Copy = function() { return this.$val.Copy(); };
|
|
Compile = function(expr) {
|
|
var _r, expr, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; expr = $f.expr; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = compile(expr, 212, false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Compile }; } $f._r = _r; $f.expr = expr; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Compile = Compile;
|
|
Regexp.ptr.prototype.Longest = function() {
|
|
var re;
|
|
re = this;
|
|
re.longest = true;
|
|
};
|
|
Regexp.prototype.Longest = function() { return this.$val.Longest(); };
|
|
compile = function(expr, mode, longest) {
|
|
var _r, _r$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, capNames, err, expr, i, longest, matchcap, maxCap, mode, n, prog, re, regexp, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; capNames = $f.capNames; err = $f.err; expr = $f.expr; i = $f.i; longest = $f.longest; matchcap = $f.matchcap; maxCap = $f.maxCap; mode = $f.mode; n = $f.n; prog = $f.prog; re = $f.re; regexp = $f.regexp; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = syntax.Parse(expr, mode); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
re = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$11.nil, err];
|
|
}
|
|
maxCap = re.MaxCap();
|
|
capNames = re.CapNames();
|
|
re = re.Simplify();
|
|
_tuple$1 = syntax.Compile(re);
|
|
prog = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$11.nil, err];
|
|
}
|
|
matchcap = prog.NumCap;
|
|
if (matchcap < 2) {
|
|
matchcap = 2;
|
|
}
|
|
_r$1 = compileOnePass(prog); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
regexp = new Regexp.ptr(expr, prog, _r$1, maxCap, 0, capNames, "", sliceType$5.nil, 0, 0, 0, matchcap, false, prog.StartCond(), longest);
|
|
if (regexp.onepass === ptrType$6.nil) {
|
|
_tuple$2 = prog.Prefix();
|
|
regexp.prefix = _tuple$2[0];
|
|
regexp.prefixComplete = _tuple$2[1];
|
|
regexp.maxBitStateLen = maxBitStateLen(prog);
|
|
} else {
|
|
_tuple$3 = onePassPrefix(prog);
|
|
regexp.prefix = _tuple$3[0];
|
|
regexp.prefixComplete = _tuple$3[1];
|
|
regexp.prefixEnd = _tuple$3[2];
|
|
}
|
|
if (!(regexp.prefix === "")) {
|
|
regexp.prefixBytes = (new sliceType$5($stringToBytes(regexp.prefix)));
|
|
_tuple$4 = utf8.DecodeRuneInString(regexp.prefix);
|
|
regexp.prefixRune = _tuple$4[0];
|
|
}
|
|
n = prog.Inst.$length;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(!((((i < 0 || i >= matchSize.length) ? ($throwRuntimeError("index out of range"), undefined) : matchSize[i]) === 0)) && ((i < 0 || i >= matchSize.length) ? ($throwRuntimeError("index out of range"), undefined) : matchSize[i]) < n)) { break; }
|
|
i = i + (1) >> 0;
|
|
}
|
|
regexp.mpool = i;
|
|
$s = -1; return [regexp, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: compile }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.capNames = capNames; $f.err = err; $f.expr = expr; $f.i = i; $f.longest = longest; $f.matchcap = matchcap; $f.maxCap = maxCap; $f.mode = mode; $f.n = n; $f.prog = prog; $f.re = re; $f.regexp = regexp; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.ptr.prototype.get = function() {
|
|
var _i, _r, _ref, _tuple, m, n, ok, re, t, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _tuple = $f._tuple; m = $f.m; n = $f.n; ok = $f.ok; re = $f.re; t = $f.t; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = (x = re.mpool, ((x < 0 || x >= matchPool.length) ? ($throwRuntimeError("index out of range"), undefined) : matchPool[x])).Get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = $assertType(_r, ptrType$13, true);
|
|
m = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!ok) {
|
|
m = new machine.ptr(ptrType$11.nil, ptrType$12.nil, new queue.ptr(sliceType$2.nil, sliceType$10.nil), new queue.ptr(sliceType$2.nil, sliceType$10.nil), sliceType$11.nil, false, sliceType$3.nil, new inputs.ptr(new inputBytes.ptr(sliceType$5.nil), new inputString.ptr(""), new inputReader.ptr($ifaceNil, false, 0)));
|
|
}
|
|
m.re = re;
|
|
m.p = re.prog;
|
|
if (m.matchcap.$capacity < re.matchcap) {
|
|
m.matchcap = $makeSlice(sliceType$3, re.matchcap);
|
|
_ref = m.pool;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
t = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
t.cap = $makeSlice(sliceType$3, re.matchcap);
|
|
_i++;
|
|
}
|
|
}
|
|
n = (x$1 = re.mpool, ((x$1 < 0 || x$1 >= matchSize.length) ? ($throwRuntimeError("index out of range"), undefined) : matchSize[x$1]));
|
|
if (n === 0) {
|
|
n = re.prog.Inst.$length;
|
|
}
|
|
if (m.q0.sparse.$length < n) {
|
|
queue.copy(m.q0, new queue.ptr($makeSlice(sliceType$2, n), $makeSlice(sliceType$10, 0, n)));
|
|
queue.copy(m.q1, new queue.ptr($makeSlice(sliceType$2, n), $makeSlice(sliceType$10, 0, n)));
|
|
}
|
|
$s = -1; return m;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.get }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._tuple = _tuple; $f.m = m; $f.n = n; $f.ok = ok; $f.re = re; $f.t = t; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.get = function() { return this.$val.get(); };
|
|
Regexp.ptr.prototype.put = function(m) {
|
|
var m, re, x;
|
|
re = this;
|
|
m.re = ptrType$11.nil;
|
|
m.p = ptrType$12.nil;
|
|
m.inputs.clear();
|
|
(x = re.mpool, ((x < 0 || x >= matchPool.length) ? ($throwRuntimeError("index out of range"), undefined) : matchPool[x])).Put(m);
|
|
};
|
|
Regexp.prototype.put = function(m) { return this.$val.put(m); };
|
|
MustCompile = function(str) {
|
|
var _r, _r$1, _tuple, err, regexp, str, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; err = $f.err; regexp = $f.regexp; str = $f.str; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = Compile(str); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
regexp = _tuple[0];
|
|
err = _tuple[1];
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 2:
|
|
_r$1 = err.Error(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$panic(new $String("regexp: Compile(" + quote(str) + "): " + _r$1));
|
|
/* } */ case 3:
|
|
$s = -1; return regexp;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: MustCompile }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.err = err; $f.regexp = regexp; $f.str = str; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.MustCompile = MustCompile;
|
|
quote = function(s) {
|
|
var s;
|
|
if (strconv.CanBackquote(s)) {
|
|
return "`" + s + "`";
|
|
}
|
|
return strconv.Quote(s);
|
|
};
|
|
Regexp.ptr.prototype.NumSubexp = function() {
|
|
var re;
|
|
re = this;
|
|
return re.numSubexp;
|
|
};
|
|
Regexp.prototype.NumSubexp = function() { return this.$val.NumSubexp(); };
|
|
Regexp.ptr.prototype.SubexpNames = function() {
|
|
var re;
|
|
re = this;
|
|
return re.subexpNames;
|
|
};
|
|
Regexp.prototype.SubexpNames = function() { return this.$val.SubexpNames(); };
|
|
inputString.ptr.prototype.step = function(pos) {
|
|
var c, i, pos;
|
|
i = this;
|
|
if (pos < i.str.length) {
|
|
c = i.str.charCodeAt(pos);
|
|
if (c < 128) {
|
|
return [((c >> 0)), 1];
|
|
}
|
|
return utf8.DecodeRuneInString($substring(i.str, pos));
|
|
}
|
|
return [-1, 0];
|
|
};
|
|
inputString.prototype.step = function(pos) { return this.$val.step(pos); };
|
|
inputString.ptr.prototype.canCheckPrefix = function() {
|
|
var i;
|
|
i = this;
|
|
return true;
|
|
};
|
|
inputString.prototype.canCheckPrefix = function() { return this.$val.canCheckPrefix(); };
|
|
inputString.ptr.prototype.hasPrefix = function(re) {
|
|
var i, re;
|
|
i = this;
|
|
return strings.HasPrefix(i.str, re.prefix);
|
|
};
|
|
inputString.prototype.hasPrefix = function(re) { return this.$val.hasPrefix(re); };
|
|
inputString.ptr.prototype.index = function(re, pos) {
|
|
var i, pos, re;
|
|
i = this;
|
|
return strings.Index($substring(i.str, pos), re.prefix);
|
|
};
|
|
inputString.prototype.index = function(re, pos) { return this.$val.index(re, pos); };
|
|
inputString.ptr.prototype.context = function(pos) {
|
|
var _tmp, _tmp$1, _tuple, _tuple$1, i, pos, r1, r2;
|
|
i = this;
|
|
_tmp = -1;
|
|
_tmp$1 = -1;
|
|
r1 = _tmp;
|
|
r2 = _tmp$1;
|
|
if ((((pos - 1 >> 0) >>> 0)) < ((i.str.length >>> 0))) {
|
|
r1 = ((i.str.charCodeAt((pos - 1 >> 0)) >> 0));
|
|
if (r1 >= 128) {
|
|
_tuple = utf8.DecodeLastRuneInString($substring(i.str, 0, pos));
|
|
r1 = _tuple[0];
|
|
}
|
|
}
|
|
if (((pos >>> 0)) < ((i.str.length >>> 0))) {
|
|
r2 = ((i.str.charCodeAt(pos) >> 0));
|
|
if (r2 >= 128) {
|
|
_tuple$1 = utf8.DecodeRuneInString($substring(i.str, pos));
|
|
r2 = _tuple$1[0];
|
|
}
|
|
}
|
|
return newLazyFlag(r1, r2);
|
|
};
|
|
inputString.prototype.context = function(pos) { return this.$val.context(pos); };
|
|
inputBytes.ptr.prototype.step = function(pos) {
|
|
var c, i, pos, x;
|
|
i = this;
|
|
if (pos < i.str.$length) {
|
|
c = (x = i.str, ((pos < 0 || pos >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + pos]));
|
|
if (c < 128) {
|
|
return [((c >> 0)), 1];
|
|
}
|
|
return utf8.DecodeRune($subslice(i.str, pos));
|
|
}
|
|
return [-1, 0];
|
|
};
|
|
inputBytes.prototype.step = function(pos) { return this.$val.step(pos); };
|
|
inputBytes.ptr.prototype.canCheckPrefix = function() {
|
|
var i;
|
|
i = this;
|
|
return true;
|
|
};
|
|
inputBytes.prototype.canCheckPrefix = function() { return this.$val.canCheckPrefix(); };
|
|
inputBytes.ptr.prototype.hasPrefix = function(re) {
|
|
var i, re;
|
|
i = this;
|
|
return bytes.HasPrefix(i.str, re.prefixBytes);
|
|
};
|
|
inputBytes.prototype.hasPrefix = function(re) { return this.$val.hasPrefix(re); };
|
|
inputBytes.ptr.prototype.index = function(re, pos) {
|
|
var i, pos, re;
|
|
i = this;
|
|
return bytes.Index($subslice(i.str, pos), re.prefixBytes);
|
|
};
|
|
inputBytes.prototype.index = function(re, pos) { return this.$val.index(re, pos); };
|
|
inputBytes.ptr.prototype.context = function(pos) {
|
|
var _tmp, _tmp$1, _tuple, _tuple$1, i, pos, r1, r2, x, x$1, x$2;
|
|
i = this;
|
|
_tmp = -1;
|
|
_tmp$1 = -1;
|
|
r1 = _tmp;
|
|
r2 = _tmp$1;
|
|
if ((((pos - 1 >> 0) >>> 0)) < ((i.str.$length >>> 0))) {
|
|
r1 = (((x = i.str, x$1 = pos - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])) >> 0));
|
|
if (r1 >= 128) {
|
|
_tuple = utf8.DecodeLastRune($subslice(i.str, 0, pos));
|
|
r1 = _tuple[0];
|
|
}
|
|
}
|
|
if (((pos >>> 0)) < ((i.str.$length >>> 0))) {
|
|
r2 = (((x$2 = i.str, ((pos < 0 || pos >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + pos])) >> 0));
|
|
if (r2 >= 128) {
|
|
_tuple$1 = utf8.DecodeRune($subslice(i.str, pos));
|
|
r2 = _tuple$1[0];
|
|
}
|
|
}
|
|
return newLazyFlag(r1, r2);
|
|
};
|
|
inputBytes.prototype.context = function(pos) { return this.$val.context(pos); };
|
|
inputReader.ptr.prototype.step = function(pos) {
|
|
var _r, _tuple, err, i, pos, r, w, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; i = $f.i; pos = $f.pos; r = $f.r; w = $f.w; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = this;
|
|
if (!i.atEOT && !((pos === i.pos))) {
|
|
$s = -1; return [-1, 0];
|
|
}
|
|
_r = i.r.ReadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
r = _tuple[0];
|
|
w = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
i.atEOT = true;
|
|
$s = -1; return [-1, 0];
|
|
}
|
|
i.pos = i.pos + (w) >> 0;
|
|
$s = -1; return [r, w];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: inputReader.ptr.prototype.step }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.i = i; $f.pos = pos; $f.r = r; $f.w = w; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
inputReader.prototype.step = function(pos) { return this.$val.step(pos); };
|
|
inputReader.ptr.prototype.canCheckPrefix = function() {
|
|
var i;
|
|
i = this;
|
|
return false;
|
|
};
|
|
inputReader.prototype.canCheckPrefix = function() { return this.$val.canCheckPrefix(); };
|
|
inputReader.ptr.prototype.hasPrefix = function(re) {
|
|
var i, re;
|
|
i = this;
|
|
return false;
|
|
};
|
|
inputReader.prototype.hasPrefix = function(re) { return this.$val.hasPrefix(re); };
|
|
inputReader.ptr.prototype.index = function(re, pos) {
|
|
var i, pos, re;
|
|
i = this;
|
|
return -1;
|
|
};
|
|
inputReader.prototype.index = function(re, pos) { return this.$val.index(re, pos); };
|
|
inputReader.ptr.prototype.context = function(pos) {
|
|
var i, pos;
|
|
i = this;
|
|
return new lazyFlag(0, 0);
|
|
};
|
|
inputReader.prototype.context = function(pos) { return this.$val.context(pos); };
|
|
Regexp.ptr.prototype.LiteralPrefix = function() {
|
|
var _tmp, _tmp$1, complete, prefix, re;
|
|
prefix = "";
|
|
complete = false;
|
|
re = this;
|
|
_tmp = re.prefix;
|
|
_tmp$1 = re.prefixComplete;
|
|
prefix = _tmp;
|
|
complete = _tmp$1;
|
|
return [prefix, complete];
|
|
};
|
|
Regexp.prototype.LiteralPrefix = function() { return this.$val.LiteralPrefix(); };
|
|
Regexp.ptr.prototype.MatchReader = function(r) {
|
|
var _r, r, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doMatch(r, sliceType$5.nil, ""); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.MatchReader }; } $f._r = _r; $f.r = r; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.MatchReader = function(r) { return this.$val.MatchReader(r); };
|
|
Regexp.ptr.prototype.MatchString = function(s) {
|
|
var _r, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doMatch($ifaceNil, sliceType$5.nil, s); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.MatchString }; } $f._r = _r; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.MatchString = function(s) { return this.$val.MatchString(s); };
|
|
Regexp.ptr.prototype.Match = function(b) {
|
|
var _r, b, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doMatch($ifaceNil, b, ""); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.Match }; } $f._r = _r; $f.b = b; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.Match = function(b) { return this.$val.Match(b); };
|
|
Regexp.ptr.prototype.ReplaceAllString = function(src, repl) {
|
|
var _r, b, n, re, repl, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; n = $f.n; re = $f.re; repl = $f.repl; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = [re];
|
|
repl = [repl];
|
|
src = [src];
|
|
re[0] = this;
|
|
n = 2;
|
|
if (strings.Contains(repl[0], "$")) {
|
|
n = $imul(2, ((re[0].numSubexp + 1 >> 0)));
|
|
}
|
|
_r = re[0].replaceAll(sliceType$5.nil, src[0], n, (function(re, repl, src) { return function(dst, match) {
|
|
var dst, match;
|
|
return re[0].expand(dst, repl[0], sliceType$5.nil, src[0], match);
|
|
}; })(re, repl, src)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
b = _r;
|
|
$s = -1; return ($bytesToString(b));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAllString }; } $f._r = _r; $f.b = b; $f.n = n; $f.re = re; $f.repl = repl; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAllString = function(src, repl) { return this.$val.ReplaceAllString(src, repl); };
|
|
Regexp.ptr.prototype.ReplaceAllLiteralString = function(src, repl) {
|
|
var _r, re, repl, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; re = $f.re; repl = $f.repl; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
repl = [repl];
|
|
re = this;
|
|
_r = re.replaceAll(sliceType$5.nil, src, 2, (function(repl) { return function(dst, match) {
|
|
var dst, match;
|
|
return $appendSlice(dst, repl[0]);
|
|
}; })(repl)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ($bytesToString(_r));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAllLiteralString }; } $f._r = _r; $f.re = re; $f.repl = repl; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAllLiteralString = function(src, repl) { return this.$val.ReplaceAllLiteralString(src, repl); };
|
|
Regexp.ptr.prototype.ReplaceAllStringFunc = function(src, repl) {
|
|
var _r, b, re, repl, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; re = $f.re; repl = $f.repl; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
repl = [repl];
|
|
src = [src];
|
|
re = this;
|
|
_r = re.replaceAll(sliceType$5.nil, src[0], 2, (function(repl, src) { return function $b(dst, match) {
|
|
var _arg, _arg$1, _r, dst, match, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; dst = $f.dst; match = $f.match; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = dst;
|
|
_r = repl[0]($substring(src[0], (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]), (1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1]))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = _r;
|
|
$s = -1; return $appendSlice(_arg, _arg$1);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f.dst = dst; $f.match = match; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(repl, src)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
b = _r;
|
|
$s = -1; return ($bytesToString(b));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAllStringFunc }; } $f._r = _r; $f.b = b; $f.re = re; $f.repl = repl; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAllStringFunc = function(src, repl) { return this.$val.ReplaceAllStringFunc(src, repl); };
|
|
Regexp.ptr.prototype.replaceAll = function(bsrc, src, nmatch, repl) {
|
|
var _r, _r$1, _tuple, _tuple$1, a, bsrc, buf, dstCap, endPos, lastMatchEnd, nmatch, re, repl, searchPos, src, width, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; a = $f.a; bsrc = $f.bsrc; buf = $f.buf; dstCap = $f.dstCap; endPos = $f.endPos; lastMatchEnd = $f.lastMatchEnd; nmatch = $f.nmatch; re = $f.re; repl = $f.repl; searchPos = $f.searchPos; src = $f.src; width = $f.width; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
lastMatchEnd = 0;
|
|
searchPos = 0;
|
|
buf = sliceType$5.nil;
|
|
endPos = 0;
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
endPos = bsrc.$length;
|
|
} else {
|
|
endPos = src.length;
|
|
}
|
|
if (nmatch > re.prog.NumCap) {
|
|
nmatch = re.prog.NumCap;
|
|
}
|
|
dstCap = arrayType$3.zero();
|
|
/* while (true) { */ case 1:
|
|
/* if (!(searchPos <= endPos)) { break; } */ if(!(searchPos <= endPos)) { $s = 2; continue; }
|
|
_r = re.doExecute($ifaceNil, bsrc, src, searchPos, nmatch, $subslice(new sliceType$3(dstCap), 0, 0)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a.$length === 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
buf = $appendSlice(buf, $subslice(bsrc, lastMatchEnd, (0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0])));
|
|
} else {
|
|
buf = $appendSlice(buf, $substring(src, lastMatchEnd, (0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0])));
|
|
}
|
|
/* */ if ((1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]) > lastMatchEnd || ((0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]) === 0)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ((1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]) > lastMatchEnd || ((0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]) === 0)) { */ case 4:
|
|
_r$1 = repl(buf, a); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
buf = _r$1;
|
|
/* } */ case 5:
|
|
lastMatchEnd = (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]);
|
|
width = 0;
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
_tuple = utf8.DecodeRune($subslice(bsrc, searchPos));
|
|
width = _tuple[1];
|
|
} else {
|
|
_tuple$1 = utf8.DecodeRuneInString($substring(src, searchPos));
|
|
width = _tuple$1[1];
|
|
}
|
|
if ((searchPos + width >> 0) > (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1])) {
|
|
searchPos = searchPos + (width) >> 0;
|
|
} else if ((searchPos + 1 >> 0) > (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1])) {
|
|
searchPos = searchPos + (1) >> 0;
|
|
} else {
|
|
searchPos = (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]);
|
|
}
|
|
/* } */ $s = 1; continue; case 2:
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
buf = $appendSlice(buf, $subslice(bsrc, lastMatchEnd));
|
|
} else {
|
|
buf = $appendSlice(buf, $substring(src, lastMatchEnd));
|
|
}
|
|
$s = -1; return buf;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.replaceAll }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.a = a; $f.bsrc = bsrc; $f.buf = buf; $f.dstCap = dstCap; $f.endPos = endPos; $f.lastMatchEnd = lastMatchEnd; $f.nmatch = nmatch; $f.re = re; $f.repl = repl; $f.searchPos = searchPos; $f.src = src; $f.width = width; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.replaceAll = function(bsrc, src, nmatch, repl) { return this.$val.replaceAll(bsrc, src, nmatch, repl); };
|
|
Regexp.ptr.prototype.ReplaceAll = function(src, repl) {
|
|
var _r, b, n, re, repl, src, srepl, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; n = $f.n; re = $f.re; repl = $f.repl; src = $f.src; srepl = $f.srepl; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = [re];
|
|
repl = [repl];
|
|
src = [src];
|
|
srepl = [srepl];
|
|
re[0] = this;
|
|
n = 2;
|
|
if (bytes.IndexByte(repl[0], 36) >= 0) {
|
|
n = $imul(2, ((re[0].numSubexp + 1 >> 0)));
|
|
}
|
|
srepl[0] = "";
|
|
_r = re[0].replaceAll(src[0], "", n, (function(re, repl, src, srepl) { return function(dst, match) {
|
|
var dst, match;
|
|
if (!((srepl[0].length === repl[0].$length))) {
|
|
srepl[0] = ($bytesToString(repl[0]));
|
|
}
|
|
return re[0].expand(dst, srepl[0], src[0], "", match);
|
|
}; })(re, repl, src, srepl)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
b = _r;
|
|
$s = -1; return b;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAll }; } $f._r = _r; $f.b = b; $f.n = n; $f.re = re; $f.repl = repl; $f.src = src; $f.srepl = srepl; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAll = function(src, repl) { return this.$val.ReplaceAll(src, repl); };
|
|
Regexp.ptr.prototype.ReplaceAllLiteral = function(src, repl) {
|
|
var _r, re, repl, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; re = $f.re; repl = $f.repl; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
repl = [repl];
|
|
re = this;
|
|
_r = re.replaceAll(src, "", 2, (function(repl) { return function(dst, match) {
|
|
var dst, match;
|
|
return $appendSlice(dst, repl[0]);
|
|
}; })(repl)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAllLiteral }; } $f._r = _r; $f.re = re; $f.repl = repl; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAllLiteral = function(src, repl) { return this.$val.ReplaceAllLiteral(src, repl); };
|
|
Regexp.ptr.prototype.ReplaceAllFunc = function(src, repl) {
|
|
var _r, re, repl, src, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; re = $f.re; repl = $f.repl; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
repl = [repl];
|
|
src = [src];
|
|
re = this;
|
|
_r = re.replaceAll(src[0], "", 2, (function(repl, src) { return function $b(dst, match) {
|
|
var _arg, _arg$1, _r, dst, match, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; dst = $f.dst; match = $f.match; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_arg = dst;
|
|
_r = repl[0]($subslice(src[0], (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]), (1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1]))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = _r;
|
|
$s = -1; return $appendSlice(_arg, _arg$1);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f.dst = dst; $f.match = match; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(repl, src)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.ReplaceAllFunc }; } $f._r = _r; $f.re = re; $f.repl = repl; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.ReplaceAllFunc = function(src, repl) { return this.$val.ReplaceAllFunc(src, repl); };
|
|
init = function() {
|
|
var _i, _index, _q, _r, _ref, b, y;
|
|
_ref = (new sliceType$5($stringToBytes("\\.+*?()|[]{}^$")));
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
_index = (_r = b % 16, _r === _r ? _r : $throwRuntimeError("integer divide by zero"));
|
|
((_index < 0 || _index >= specialBytes.length) ? ($throwRuntimeError("index out of range"), undefined) : specialBytes[_index] = ((((_index < 0 || _index >= specialBytes.length) ? ($throwRuntimeError("index out of range"), undefined) : specialBytes[_index]) | (((y = ((_q = b / 16, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"))), y < 32 ? (1 << y) : 0) << 24 >>> 24))) >>> 0));
|
|
_i++;
|
|
}
|
|
};
|
|
Regexp.ptr.prototype.pad = function(a) {
|
|
var a, n, re;
|
|
re = this;
|
|
if (a === sliceType$3.nil) {
|
|
return sliceType$3.nil;
|
|
}
|
|
n = $imul(((1 + re.numSubexp >> 0)), 2);
|
|
while (true) {
|
|
if (!(a.$length < n)) { break; }
|
|
a = $append(a, -1);
|
|
}
|
|
return a;
|
|
};
|
|
Regexp.prototype.pad = function(a) { return this.$val.pad(a); };
|
|
Regexp.ptr.prototype.allMatches = function(s, b, n, deliver) {
|
|
var _r, _tmp, _tmp$1, _tmp$2, _tuple, _tuple$1, accept, b, deliver, end, i, matches, n, pos, prevMatchEnd, re, s, width, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; accept = $f.accept; b = $f.b; deliver = $f.deliver; end = $f.end; i = $f.i; matches = $f.matches; n = $f.n; pos = $f.pos; prevMatchEnd = $f.prevMatchEnd; re = $f.re; s = $f.s; width = $f.width; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
end = 0;
|
|
if (b === sliceType$5.nil) {
|
|
end = s.length;
|
|
} else {
|
|
end = b.$length;
|
|
}
|
|
_tmp = 0;
|
|
_tmp$1 = 0;
|
|
_tmp$2 = -1;
|
|
pos = _tmp;
|
|
i = _tmp$1;
|
|
prevMatchEnd = _tmp$2;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < n && pos <= end)) { break; } */ if(!(i < n && pos <= end)) { $s = 2; continue; }
|
|
_r = re.doExecute($ifaceNil, b, s, pos, re.prog.NumCap, sliceType$3.nil); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
matches = _r;
|
|
if (matches.$length === 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
accept = true;
|
|
if ((1 >= matches.$length ? ($throwRuntimeError("index out of range"), undefined) : matches.$array[matches.$offset + 1]) === pos) {
|
|
if ((0 >= matches.$length ? ($throwRuntimeError("index out of range"), undefined) : matches.$array[matches.$offset + 0]) === prevMatchEnd) {
|
|
accept = false;
|
|
}
|
|
width = 0;
|
|
if (b === sliceType$5.nil) {
|
|
_tuple = utf8.DecodeRuneInString($substring(s, pos, end));
|
|
width = _tuple[1];
|
|
} else {
|
|
_tuple$1 = utf8.DecodeRune($subslice(b, pos, end));
|
|
width = _tuple$1[1];
|
|
}
|
|
if (width > 0) {
|
|
pos = pos + (width) >> 0;
|
|
} else {
|
|
pos = end + 1 >> 0;
|
|
}
|
|
} else {
|
|
pos = (1 >= matches.$length ? ($throwRuntimeError("index out of range"), undefined) : matches.$array[matches.$offset + 1]);
|
|
}
|
|
prevMatchEnd = (1 >= matches.$length ? ($throwRuntimeError("index out of range"), undefined) : matches.$array[matches.$offset + 1]);
|
|
/* */ if (accept) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (accept) { */ case 4:
|
|
$r = deliver(re.pad(matches)); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i + (1) >> 0;
|
|
/* } */ case 5:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.allMatches }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.accept = accept; $f.b = b; $f.deliver = deliver; $f.end = end; $f.i = i; $f.matches = matches; $f.n = n; $f.pos = pos; $f.prevMatchEnd = prevMatchEnd; $f.re = re; $f.s = s; $f.width = width; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.allMatches = function(s, b, n, deliver) { return this.$val.allMatches(s, b, n, deliver); };
|
|
Regexp.ptr.prototype.Find = function(b) {
|
|
var _r, a, b, dstCap, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; b = $f.b; dstCap = $f.dstCap; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
dstCap = arrayType$3.zero();
|
|
_r = re.doExecute($ifaceNil, b, "", 0, 2, $subslice(new sliceType$3(dstCap), 0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
$s = -1; return sliceType$5.nil;
|
|
}
|
|
$s = -1; return $subslice(b, (0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]), (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.Find }; } $f._r = _r; $f.a = a; $f.b = b; $f.dstCap = dstCap; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.Find = function(b) { return this.$val.Find(b); };
|
|
Regexp.ptr.prototype.FindIndex = function(b) {
|
|
var _r, a, b, loc, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; b = $f.b; loc = $f.loc; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
loc = sliceType$3.nil;
|
|
re = this;
|
|
_r = re.doExecute($ifaceNil, b, "", 0, 2, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
loc = sliceType$3.nil;
|
|
$s = -1; return loc;
|
|
}
|
|
loc = $subslice(a, 0, 2);
|
|
$s = -1; return loc;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindIndex }; } $f._r = _r; $f.a = a; $f.b = b; $f.loc = loc; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindIndex = function(b) { return this.$val.FindIndex(b); };
|
|
Regexp.ptr.prototype.FindString = function(s) {
|
|
var _r, a, dstCap, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; dstCap = $f.dstCap; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
dstCap = arrayType$3.zero();
|
|
_r = re.doExecute($ifaceNil, sliceType$5.nil, s, 0, 2, $subslice(new sliceType$3(dstCap), 0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
$s = -1; return "";
|
|
}
|
|
$s = -1; return $substring(s, (0 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 0]), (1 >= a.$length ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + 1]));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindString }; } $f._r = _r; $f.a = a; $f.dstCap = dstCap; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindString = function(s) { return this.$val.FindString(s); };
|
|
Regexp.ptr.prototype.FindStringIndex = function(s) {
|
|
var _r, a, loc, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; loc = $f.loc; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
loc = sliceType$3.nil;
|
|
re = this;
|
|
_r = re.doExecute($ifaceNil, sliceType$5.nil, s, 0, 2, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
loc = sliceType$3.nil;
|
|
$s = -1; return loc;
|
|
}
|
|
loc = $subslice(a, 0, 2);
|
|
$s = -1; return loc;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindStringIndex }; } $f._r = _r; $f.a = a; $f.loc = loc; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindStringIndex = function(s) { return this.$val.FindStringIndex(s); };
|
|
Regexp.ptr.prototype.FindReaderIndex = function(r) {
|
|
var _r, a, loc, r, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; loc = $f.loc; r = $f.r; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
loc = sliceType$3.nil;
|
|
re = this;
|
|
_r = re.doExecute(r, sliceType$5.nil, "", 0, 2, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
loc = sliceType$3.nil;
|
|
$s = -1; return loc;
|
|
}
|
|
loc = $subslice(a, 0, 2);
|
|
$s = -1; return loc;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindReaderIndex }; } $f._r = _r; $f.a = a; $f.loc = loc; $f.r = r; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindReaderIndex = function(r) { return this.$val.FindReaderIndex(r); };
|
|
Regexp.ptr.prototype.FindSubmatch = function(b) {
|
|
var _i, _r, _ref, a, b, dstCap, i, re, ret, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; a = $f.a; b = $f.b; dstCap = $f.dstCap; i = $f.i; re = $f.re; ret = $f.ret; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
dstCap = arrayType$4.zero();
|
|
_r = re.doExecute($ifaceNil, b, "", 0, re.prog.NumCap, $subslice(new sliceType$3(dstCap), 0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
$s = -1; return sliceType$12.nil;
|
|
}
|
|
ret = $makeSlice(sliceType$12, (1 + re.numSubexp >> 0));
|
|
_ref = ret;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
if (($imul(2, i)) < a.$length && (x = $imul(2, i), ((x < 0 || x >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x])) >= 0) {
|
|
((i < 0 || i >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i] = $subslice(b, (x$1 = $imul(2, i), ((x$1 < 0 || x$1 >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x$1])), (x$2 = ($imul(2, i)) + 1 >> 0, ((x$2 < 0 || x$2 >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x$2]))));
|
|
}
|
|
_i++;
|
|
}
|
|
$s = -1; return ret;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindSubmatch }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.a = a; $f.b = b; $f.dstCap = dstCap; $f.i = i; $f.re = re; $f.ret = ret; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindSubmatch = function(b) { return this.$val.FindSubmatch(b); };
|
|
Regexp.ptr.prototype.Expand = function(dst, template, src, match) {
|
|
var dst, match, re, src, template;
|
|
re = this;
|
|
return re.expand(dst, ($bytesToString(template)), src, "", match);
|
|
};
|
|
Regexp.prototype.Expand = function(dst, template, src, match) { return this.$val.Expand(dst, template, src, match); };
|
|
Regexp.ptr.prototype.ExpandString = function(dst, template, src, match) {
|
|
var dst, match, re, src, template;
|
|
re = this;
|
|
return re.expand(dst, template, sliceType$5.nil, src, match);
|
|
};
|
|
Regexp.prototype.ExpandString = function(dst, template, src, match) { return this.$val.ExpandString(dst, template, src, match); };
|
|
Regexp.ptr.prototype.expand = function(dst, template, bsrc, src, match) {
|
|
var _i, _ref, _tuple, bsrc, dst, i, i$1, match, name, namei, num, ok, re, rest, src, template, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
|
|
re = this;
|
|
while (true) {
|
|
if (!(template.length > 0)) { break; }
|
|
i = strings.Index(template, "$");
|
|
if (i < 0) {
|
|
break;
|
|
}
|
|
dst = $appendSlice(dst, $substring(template, 0, i));
|
|
template = $substring(template, i);
|
|
if (template.length > 1 && (template.charCodeAt(1) === 36)) {
|
|
dst = $append(dst, 36);
|
|
template = $substring(template, 2);
|
|
continue;
|
|
}
|
|
_tuple = extract(template);
|
|
name = _tuple[0];
|
|
num = _tuple[1];
|
|
rest = _tuple[2];
|
|
ok = _tuple[3];
|
|
if (!ok) {
|
|
dst = $append(dst, 36);
|
|
template = $substring(template, 1);
|
|
continue;
|
|
}
|
|
template = rest;
|
|
if (num >= 0) {
|
|
if ((($imul(2, num)) + 1 >> 0) < match.$length && (x = $imul(2, num), ((x < 0 || x >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x])) >= 0) {
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
dst = $appendSlice(dst, $subslice(bsrc, (x$1 = $imul(2, num), ((x$1 < 0 || x$1 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$1])), (x$2 = ($imul(2, num)) + 1 >> 0, ((x$2 < 0 || x$2 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$2]))));
|
|
} else {
|
|
dst = $appendSlice(dst, $substring(src, (x$3 = $imul(2, num), ((x$3 < 0 || x$3 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$3])), (x$4 = ($imul(2, num)) + 1 >> 0, ((x$4 < 0 || x$4 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$4]))));
|
|
}
|
|
}
|
|
} else {
|
|
_ref = re.subexpNames;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i$1 = _i;
|
|
namei = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (name === namei && (($imul(2, i$1)) + 1 >> 0) < match.$length && (x$5 = $imul(2, i$1), ((x$5 < 0 || x$5 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$5])) >= 0) {
|
|
if (!(bsrc === sliceType$5.nil)) {
|
|
dst = $appendSlice(dst, $subslice(bsrc, (x$6 = $imul(2, i$1), ((x$6 < 0 || x$6 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$6])), (x$7 = ($imul(2, i$1)) + 1 >> 0, ((x$7 < 0 || x$7 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$7]))));
|
|
} else {
|
|
dst = $appendSlice(dst, $substring(src, (x$8 = $imul(2, i$1), ((x$8 < 0 || x$8 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$8])), (x$9 = ($imul(2, i$1)) + 1 >> 0, ((x$9 < 0 || x$9 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$9]))));
|
|
}
|
|
break;
|
|
}
|
|
_i++;
|
|
}
|
|
}
|
|
}
|
|
dst = $appendSlice(dst, template);
|
|
return dst;
|
|
};
|
|
Regexp.prototype.expand = function(dst, template, bsrc, src, match) { return this.$val.expand(dst, template, bsrc, src, match); };
|
|
extract = function(str) {
|
|
var _tuple, brace, i, i$1, name, num, ok, rest, rune, size, str;
|
|
name = "";
|
|
num = 0;
|
|
rest = "";
|
|
ok = false;
|
|
if (str.length < 2 || !((str.charCodeAt(0) === 36))) {
|
|
return [name, num, rest, ok];
|
|
}
|
|
brace = false;
|
|
if (str.charCodeAt(1) === 123) {
|
|
brace = true;
|
|
str = $substring(str, 2);
|
|
} else {
|
|
str = $substring(str, 1);
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < str.length)) { break; }
|
|
_tuple = utf8.DecodeRuneInString($substring(str, i));
|
|
rune = _tuple[0];
|
|
size = _tuple[1];
|
|
if (!unicode.IsLetter(rune) && !unicode.IsDigit(rune) && !((rune === 95))) {
|
|
break;
|
|
}
|
|
i = i + (size) >> 0;
|
|
}
|
|
if (i === 0) {
|
|
return [name, num, rest, ok];
|
|
}
|
|
name = $substring(str, 0, i);
|
|
if (brace) {
|
|
if (i >= str.length || !((str.charCodeAt(i) === 125))) {
|
|
return [name, num, rest, ok];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
num = 0;
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < name.length)) { break; }
|
|
if (name.charCodeAt(i$1) < 48 || 57 < name.charCodeAt(i$1) || num >= 100000000) {
|
|
num = -1;
|
|
break;
|
|
}
|
|
num = (($imul(num, 10)) + ((name.charCodeAt(i$1) >> 0)) >> 0) - 48 >> 0;
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
if ((name.charCodeAt(0) === 48) && name.length > 1) {
|
|
num = -1;
|
|
}
|
|
rest = $substring(str, i);
|
|
ok = true;
|
|
return [name, num, rest, ok];
|
|
};
|
|
Regexp.ptr.prototype.FindSubmatchIndex = function(b) {
|
|
var _r, _r$1, b, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; b = $f.b; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doExecute($ifaceNil, b, "", 0, re.prog.NumCap, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = re.pad(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindSubmatchIndex }; } $f._r = _r; $f._r$1 = _r$1; $f.b = b; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindSubmatchIndex = function(b) { return this.$val.FindSubmatchIndex(b); };
|
|
Regexp.ptr.prototype.FindStringSubmatch = function(s) {
|
|
var _i, _r, _ref, a, dstCap, i, re, ret, s, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; a = $f.a; dstCap = $f.dstCap; i = $f.i; re = $f.re; ret = $f.ret; s = $f.s; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
dstCap = arrayType$4.zero();
|
|
_r = re.doExecute($ifaceNil, sliceType$5.nil, s, 0, re.prog.NumCap, $subslice(new sliceType$3(dstCap), 0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
a = _r;
|
|
if (a === sliceType$3.nil) {
|
|
$s = -1; return sliceType$9.nil;
|
|
}
|
|
ret = $makeSlice(sliceType$9, (1 + re.numSubexp >> 0));
|
|
_ref = ret;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
if (($imul(2, i)) < a.$length && (x = $imul(2, i), ((x < 0 || x >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x])) >= 0) {
|
|
((i < 0 || i >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i] = $substring(s, (x$1 = $imul(2, i), ((x$1 < 0 || x$1 >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x$1])), (x$2 = ($imul(2, i)) + 1 >> 0, ((x$2 < 0 || x$2 >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + x$2]))));
|
|
}
|
|
_i++;
|
|
}
|
|
$s = -1; return ret;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindStringSubmatch }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.a = a; $f.dstCap = dstCap; $f.i = i; $f.re = re; $f.ret = ret; $f.s = s; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindStringSubmatch = function(s) { return this.$val.FindStringSubmatch(s); };
|
|
Regexp.ptr.prototype.FindStringSubmatchIndex = function(s) {
|
|
var _r, _r$1, re, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; re = $f.re; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doExecute($ifaceNil, sliceType$5.nil, s, 0, re.prog.NumCap, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = re.pad(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindStringSubmatchIndex }; } $f._r = _r; $f._r$1 = _r$1; $f.re = re; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindStringSubmatchIndex = function(s) { return this.$val.FindStringSubmatchIndex(s); };
|
|
Regexp.ptr.prototype.FindReaderSubmatchIndex = function(r) {
|
|
var _r, _r$1, r, re, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; r = $f.r; re = $f.re; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
_r = re.doExecute(r, sliceType$5.nil, "", 0, re.prog.NumCap, sliceType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = re.pad(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindReaderSubmatchIndex }; } $f._r = _r; $f._r$1 = _r$1; $f.r = r; $f.re = re; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindReaderSubmatchIndex = function(r) { return this.$val.FindReaderSubmatchIndex(r); };
|
|
Regexp.ptr.prototype.FindAll = function(b, n) {
|
|
var b, n, re, result, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; b = $f.b; n = $f.n; re = $f.re; result = $f.result; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = [b];
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = b[0].$length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$12.nil;
|
|
$r = re.allMatches("", b[0], n, (function(b, result) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$12.nil) {
|
|
result[0] = $makeSlice(sliceType$12, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], $subslice(b[0], (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]), (1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1])));
|
|
}; })(b, result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAll }; } $f.b = b; $f.n = n; $f.re = re; $f.result = result; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAll = function(b, n) { return this.$val.FindAll(b, n); };
|
|
Regexp.ptr.prototype.FindAllIndex = function(b, n) {
|
|
var b, n, re, result, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; b = $f.b; n = $f.n; re = $f.re; result = $f.result; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = b.$length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$13.nil;
|
|
$r = re.allMatches("", b, n, (function(result) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$13.nil) {
|
|
result[0] = $makeSlice(sliceType$13, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], $subslice(match, 0, 2));
|
|
}; })(result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllIndex }; } $f.b = b; $f.n = n; $f.re = re; $f.result = result; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllIndex = function(b, n) { return this.$val.FindAllIndex(b, n); };
|
|
Regexp.ptr.prototype.FindAllString = function(s, n) {
|
|
var n, re, result, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; n = $f.n; re = $f.re; result = $f.result; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
s = [s];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = s[0].length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$9.nil;
|
|
$r = re.allMatches(s[0], sliceType$5.nil, n, (function(result, s) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$9.nil) {
|
|
result[0] = $makeSlice(sliceType$9, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], $substring(s[0], (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]), (1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1])));
|
|
}; })(result, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllString }; } $f.n = n; $f.re = re; $f.result = result; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllString = function(s, n) { return this.$val.FindAllString(s, n); };
|
|
Regexp.ptr.prototype.FindAllStringIndex = function(s, n) {
|
|
var n, re, result, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; n = $f.n; re = $f.re; result = $f.result; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = s.length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$13.nil;
|
|
$r = re.allMatches(s, sliceType$5.nil, n, (function(result) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$13.nil) {
|
|
result[0] = $makeSlice(sliceType$13, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], $subslice(match, 0, 2));
|
|
}; })(result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllStringIndex }; } $f.n = n; $f.re = re; $f.result = result; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllStringIndex = function(s, n) { return this.$val.FindAllStringIndex(s, n); };
|
|
Regexp.ptr.prototype.FindAllSubmatch = function(b, n) {
|
|
var b, n, re, result, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; b = $f.b; n = $f.n; re = $f.re; result = $f.result; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = [b];
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = b[0].$length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$14.nil;
|
|
$r = re.allMatches("", b[0], n, (function(b, result) { return function(match) {
|
|
var _i, _q, _ref, j, match, slice, x, x$1, x$2;
|
|
if (result[0] === sliceType$14.nil) {
|
|
result[0] = $makeSlice(sliceType$14, 0, 10);
|
|
}
|
|
slice = $makeSlice(sliceType$12, (_q = match.$length / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")));
|
|
_ref = slice;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
j = _i;
|
|
if ((x = $imul(2, j), ((x < 0 || x >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x])) >= 0) {
|
|
((j < 0 || j >= slice.$length) ? ($throwRuntimeError("index out of range"), undefined) : slice.$array[slice.$offset + j] = $subslice(b[0], (x$1 = $imul(2, j), ((x$1 < 0 || x$1 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$1])), (x$2 = ($imul(2, j)) + 1 >> 0, ((x$2 < 0 || x$2 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$2]))));
|
|
}
|
|
_i++;
|
|
}
|
|
result[0] = $append(result[0], slice);
|
|
}; })(b, result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllSubmatch }; } $f.b = b; $f.n = n; $f.re = re; $f.result = result; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllSubmatch = function(b, n) { return this.$val.FindAllSubmatch(b, n); };
|
|
Regexp.ptr.prototype.FindAllSubmatchIndex = function(b, n) {
|
|
var b, n, re, result, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; b = $f.b; n = $f.n; re = $f.re; result = $f.result; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = b.$length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$13.nil;
|
|
$r = re.allMatches("", b, n, (function(result) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$13.nil) {
|
|
result[0] = $makeSlice(sliceType$13, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], match);
|
|
}; })(result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllSubmatchIndex }; } $f.b = b; $f.n = n; $f.re = re; $f.result = result; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllSubmatchIndex = function(b, n) { return this.$val.FindAllSubmatchIndex(b, n); };
|
|
Regexp.ptr.prototype.FindAllStringSubmatch = function(s, n) {
|
|
var n, re, result, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; n = $f.n; re = $f.re; result = $f.result; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
s = [s];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = s[0].length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$15.nil;
|
|
$r = re.allMatches(s[0], sliceType$5.nil, n, (function(result, s) { return function(match) {
|
|
var _i, _q, _ref, j, match, slice, x, x$1, x$2;
|
|
if (result[0] === sliceType$15.nil) {
|
|
result[0] = $makeSlice(sliceType$15, 0, 10);
|
|
}
|
|
slice = $makeSlice(sliceType$9, (_q = match.$length / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")));
|
|
_ref = slice;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
j = _i;
|
|
if ((x = $imul(2, j), ((x < 0 || x >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x])) >= 0) {
|
|
((j < 0 || j >= slice.$length) ? ($throwRuntimeError("index out of range"), undefined) : slice.$array[slice.$offset + j] = $substring(s[0], (x$1 = $imul(2, j), ((x$1 < 0 || x$1 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$1])), (x$2 = ($imul(2, j)) + 1 >> 0, ((x$2 < 0 || x$2 >= match.$length) ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + x$2]))));
|
|
}
|
|
_i++;
|
|
}
|
|
result[0] = $append(result[0], slice);
|
|
}; })(result, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllStringSubmatch }; } $f.n = n; $f.re = re; $f.result = result; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllStringSubmatch = function(s, n) { return this.$val.FindAllStringSubmatch(s, n); };
|
|
Regexp.ptr.prototype.FindAllStringSubmatchIndex = function(s, n) {
|
|
var n, re, result, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; n = $f.n; re = $f.re; result = $f.result; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
result = [result];
|
|
re = this;
|
|
if (n < 0) {
|
|
n = s.length + 1 >> 0;
|
|
}
|
|
result[0] = sliceType$13.nil;
|
|
$r = re.allMatches(s, sliceType$5.nil, n, (function(result) { return function(match) {
|
|
var match;
|
|
if (result[0] === sliceType$13.nil) {
|
|
result[0] = $makeSlice(sliceType$13, 0, 10);
|
|
}
|
|
result[0] = $append(result[0], match);
|
|
}; })(result)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return result[0];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.FindAllStringSubmatchIndex }; } $f.n = n; $f.re = re; $f.result = result; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.FindAllStringSubmatchIndex = function(s, n) { return this.$val.FindAllStringSubmatchIndex(s, n); };
|
|
Regexp.ptr.prototype.Split = function(s, n) {
|
|
var _i, _r, _ref, beg, end, match, matches, n, re, s, strings$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; beg = $f.beg; end = $f.end; match = $f.match; matches = $f.matches; n = $f.n; re = $f.re; s = $f.s; strings$1 = $f.strings$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
re = this;
|
|
if (n === 0) {
|
|
$s = -1; return sliceType$9.nil;
|
|
}
|
|
if (re.expr.length > 0 && (s.length === 0)) {
|
|
$s = -1; return new sliceType$9([""]);
|
|
}
|
|
_r = re.FindAllStringIndex(s, n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
matches = _r;
|
|
strings$1 = $makeSlice(sliceType$9, 0, matches.$length);
|
|
beg = 0;
|
|
end = 0;
|
|
_ref = matches;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
match = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (n > 0 && strings$1.$length >= (n - 1 >> 0)) {
|
|
break;
|
|
}
|
|
end = (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]);
|
|
if (!(((1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1]) === 0))) {
|
|
strings$1 = $append(strings$1, $substring(s, beg, end));
|
|
}
|
|
beg = (1 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 1]);
|
|
_i++;
|
|
}
|
|
if (!((end === s.length))) {
|
|
strings$1 = $append(strings$1, $substring(s, beg));
|
|
}
|
|
$s = -1; return strings$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Regexp.ptr.prototype.Split }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f.beg = beg; $f.end = end; $f.match = match; $f.matches = matches; $f.n = n; $f.re = re; $f.s = s; $f.strings$1 = strings$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Regexp.prototype.Split = function(s, n) { return this.$val.Split(s, n); };
|
|
ptrType.methods = [{prop: "reset", name: "reset", pkg: "regexp", typ: $funcType([ptrType$12, $Int, $Int], [], false)}, {prop: "shouldVisit", name: "shouldVisit", pkg: "regexp", typ: $funcType([$Uint32, $Int], [$Bool], false)}, {prop: "push", name: "push", pkg: "regexp", typ: $funcType([ptrType$11, $Uint32, $Int, $Bool], [], false)}];
|
|
ptrType$13.methods = [{prop: "init", name: "init", pkg: "regexp", typ: $funcType([$Int], [], false)}, {prop: "alloc", name: "alloc", pkg: "regexp", typ: $funcType([ptrType$2], [ptrType$1], false)}, {prop: "match", name: "match", pkg: "regexp", typ: $funcType([input, $Int], [$Bool], false)}, {prop: "clear", name: "clear", pkg: "regexp", typ: $funcType([ptrType$14], [], false)}, {prop: "step", name: "step", pkg: "regexp", typ: $funcType([ptrType$14, ptrType$14, $Int, $Int, $Int32, ptrType$3], [], false)}, {prop: "add", name: "add", pkg: "regexp", typ: $funcType([ptrType$14, $Uint32, $Int, sliceType$3, ptrType$3, ptrType$1], [ptrType$1], false)}];
|
|
ptrType$15.methods = [{prop: "newBytes", name: "newBytes", pkg: "regexp", typ: $funcType([sliceType$5], [input], false)}, {prop: "newString", name: "newString", pkg: "regexp", typ: $funcType([$String], [input], false)}, {prop: "newReader", name: "newReader", pkg: "regexp", typ: $funcType([io.RuneReader], [input], false)}, {prop: "clear", name: "clear", pkg: "regexp", typ: $funcType([], [], false)}, {prop: "init", name: "init", pkg: "regexp", typ: $funcType([io.RuneReader, sliceType$5, $String], [input, $Int], false)}];
|
|
lazyFlag.methods = [{prop: "match", name: "match", pkg: "regexp", typ: $funcType([syntax.EmptyOp], [$Bool], false)}];
|
|
ptrType$8.methods = [{prop: "empty", name: "empty", pkg: "regexp", typ: $funcType([], [$Bool], false)}, {prop: "next", name: "next", pkg: "regexp", typ: $funcType([], [$Uint32], false)}, {prop: "clear", name: "clear", pkg: "regexp", typ: $funcType([], [], false)}, {prop: "contains", name: "contains", pkg: "regexp", typ: $funcType([$Uint32], [$Bool], false)}, {prop: "insert", name: "insert", pkg: "regexp", typ: $funcType([$Uint32], [], false)}, {prop: "insertNew", name: "insertNew", pkg: "regexp", typ: $funcType([$Uint32], [], false)}];
|
|
runeSlice.methods = [{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}];
|
|
ptrType$11.methods = [{prop: "tryBacktrack", name: "tryBacktrack", pkg: "regexp", typ: $funcType([ptrType, input, $Uint32, $Int], [$Bool], false)}, {prop: "backtrack", name: "backtrack", pkg: "regexp", typ: $funcType([sliceType$5, $String, $Int, $Int, sliceType$3], [sliceType$3], false)}, {prop: "doOnePass", name: "doOnePass", pkg: "regexp", typ: $funcType([io.RuneReader, sliceType$5, $String, $Int, $Int, sliceType$3], [sliceType$3], false)}, {prop: "doMatch", name: "doMatch", pkg: "regexp", typ: $funcType([io.RuneReader, sliceType$5, $String], [$Bool], false)}, {prop: "doExecute", name: "doExecute", pkg: "regexp", typ: $funcType([io.RuneReader, sliceType$5, $String, $Int, $Int, sliceType$3], [sliceType$3], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Copy", name: "Copy", pkg: "", typ: $funcType([], [ptrType$11], false)}, {prop: "Longest", name: "Longest", pkg: "", typ: $funcType([], [], false)}, {prop: "get", name: "get", pkg: "regexp", typ: $funcType([], [ptrType$13], false)}, {prop: "put", name: "put", pkg: "regexp", typ: $funcType([ptrType$13], [], false)}, {prop: "NumSubexp", name: "NumSubexp", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "SubexpNames", name: "SubexpNames", pkg: "", typ: $funcType([], [sliceType$9], false)}, {prop: "LiteralPrefix", name: "LiteralPrefix", pkg: "", typ: $funcType([], [$String, $Bool], false)}, {prop: "MatchReader", name: "MatchReader", pkg: "", typ: $funcType([io.RuneReader], [$Bool], false)}, {prop: "MatchString", name: "MatchString", pkg: "", typ: $funcType([$String], [$Bool], false)}, {prop: "Match", name: "Match", pkg: "", typ: $funcType([sliceType$5], [$Bool], false)}, {prop: "ReplaceAllString", name: "ReplaceAllString", pkg: "", typ: $funcType([$String, $String], [$String], false)}, {prop: "ReplaceAllLiteralString", name: "ReplaceAllLiteralString", pkg: "", typ: $funcType([$String, $String], [$String], false)}, {prop: "ReplaceAllStringFunc", name: "ReplaceAllStringFunc", pkg: "", typ: $funcType([$String, funcType], [$String], false)}, {prop: "replaceAll", name: "replaceAll", pkg: "regexp", typ: $funcType([sliceType$5, $String, $Int, funcType$1], [sliceType$5], false)}, {prop: "ReplaceAll", name: "ReplaceAll", pkg: "", typ: $funcType([sliceType$5, sliceType$5], [sliceType$5], false)}, {prop: "ReplaceAllLiteral", name: "ReplaceAllLiteral", pkg: "", typ: $funcType([sliceType$5, sliceType$5], [sliceType$5], false)}, {prop: "ReplaceAllFunc", name: "ReplaceAllFunc", pkg: "", typ: $funcType([sliceType$5, funcType$2], [sliceType$5], false)}, {prop: "pad", name: "pad", pkg: "regexp", typ: $funcType([sliceType$3], [sliceType$3], false)}, {prop: "allMatches", name: "allMatches", pkg: "regexp", typ: $funcType([$String, sliceType$5, $Int, funcType$3], [], false)}, {prop: "Find", name: "Find", pkg: "", typ: $funcType([sliceType$5], [sliceType$5], false)}, {prop: "FindIndex", name: "FindIndex", pkg: "", typ: $funcType([sliceType$5], [sliceType$3], false)}, {prop: "FindString", name: "FindString", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "FindStringIndex", name: "FindStringIndex", pkg: "", typ: $funcType([$String], [sliceType$3], false)}, {prop: "FindReaderIndex", name: "FindReaderIndex", pkg: "", typ: $funcType([io.RuneReader], [sliceType$3], false)}, {prop: "FindSubmatch", name: "FindSubmatch", pkg: "", typ: $funcType([sliceType$5], [sliceType$12], false)}, {prop: "Expand", name: "Expand", pkg: "", typ: $funcType([sliceType$5, sliceType$5, sliceType$5, sliceType$3], [sliceType$5], false)}, {prop: "ExpandString", name: "ExpandString", pkg: "", typ: $funcType([sliceType$5, $String, $String, sliceType$3], [sliceType$5], false)}, {prop: "expand", name: "expand", pkg: "regexp", typ: $funcType([sliceType$5, $String, sliceType$5, $String, sliceType$3], [sliceType$5], false)}, {prop: "FindSubmatchIndex", name: "FindSubmatchIndex", pkg: "", typ: $funcType([sliceType$5], [sliceType$3], false)}, {prop: "FindStringSubmatch", name: "FindStringSubmatch", pkg: "", typ: $funcType([$String], [sliceType$9], false)}, {prop: "FindStringSubmatchIndex", name: "FindStringSubmatchIndex", pkg: "", typ: $funcType([$String], [sliceType$3], false)}, {prop: "FindReaderSubmatchIndex", name: "FindReaderSubmatchIndex", pkg: "", typ: $funcType([io.RuneReader], [sliceType$3], false)}, {prop: "FindAll", name: "FindAll", pkg: "", typ: $funcType([sliceType$5, $Int], [sliceType$12], false)}, {prop: "FindAllIndex", name: "FindAllIndex", pkg: "", typ: $funcType([sliceType$5, $Int], [sliceType$13], false)}, {prop: "FindAllString", name: "FindAllString", pkg: "", typ: $funcType([$String, $Int], [sliceType$9], false)}, {prop: "FindAllStringIndex", name: "FindAllStringIndex", pkg: "", typ: $funcType([$String, $Int], [sliceType$13], false)}, {prop: "FindAllSubmatch", name: "FindAllSubmatch", pkg: "", typ: $funcType([sliceType$5, $Int], [sliceType$14], false)}, {prop: "FindAllSubmatchIndex", name: "FindAllSubmatchIndex", pkg: "", typ: $funcType([sliceType$5, $Int], [sliceType$13], false)}, {prop: "FindAllStringSubmatch", name: "FindAllStringSubmatch", pkg: "", typ: $funcType([$String, $Int], [sliceType$15], false)}, {prop: "FindAllStringSubmatchIndex", name: "FindAllStringSubmatchIndex", pkg: "", typ: $funcType([$String, $Int], [sliceType$13], false)}, {prop: "Split", name: "Split", pkg: "", typ: $funcType([$String, $Int], [sliceType$9], false)}];
|
|
ptrType$16.methods = [{prop: "step", name: "step", pkg: "regexp", typ: $funcType([$Int], [$Int32, $Int], false)}, {prop: "canCheckPrefix", name: "canCheckPrefix", pkg: "regexp", typ: $funcType([], [$Bool], false)}, {prop: "hasPrefix", name: "hasPrefix", pkg: "regexp", typ: $funcType([ptrType$11], [$Bool], false)}, {prop: "index", name: "index", pkg: "regexp", typ: $funcType([ptrType$11, $Int], [$Int], false)}, {prop: "context", name: "context", pkg: "regexp", typ: $funcType([$Int], [lazyFlag], false)}];
|
|
ptrType$17.methods = [{prop: "step", name: "step", pkg: "regexp", typ: $funcType([$Int], [$Int32, $Int], false)}, {prop: "canCheckPrefix", name: "canCheckPrefix", pkg: "regexp", typ: $funcType([], [$Bool], false)}, {prop: "hasPrefix", name: "hasPrefix", pkg: "regexp", typ: $funcType([ptrType$11], [$Bool], false)}, {prop: "index", name: "index", pkg: "regexp", typ: $funcType([ptrType$11, $Int], [$Int], false)}, {prop: "context", name: "context", pkg: "regexp", typ: $funcType([$Int], [lazyFlag], false)}];
|
|
ptrType$18.methods = [{prop: "step", name: "step", pkg: "regexp", typ: $funcType([$Int], [$Int32, $Int], false)}, {prop: "canCheckPrefix", name: "canCheckPrefix", pkg: "regexp", typ: $funcType([], [$Bool], false)}, {prop: "hasPrefix", name: "hasPrefix", pkg: "regexp", typ: $funcType([ptrType$11], [$Bool], false)}, {prop: "index", name: "index", pkg: "regexp", typ: $funcType([ptrType$11, $Int], [$Int], false)}, {prop: "context", name: "context", pkg: "regexp", typ: $funcType([$Int], [lazyFlag], false)}];
|
|
job.init("regexp", [{prop: "pc", name: "pc", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "arg", name: "arg", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "pos", name: "pos", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
bitState.init("regexp", [{prop: "end", name: "end", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "cap", name: "cap", embedded: false, exported: false, typ: sliceType$3, tag: ""}, {prop: "matchcap", name: "matchcap", embedded: false, exported: false, typ: sliceType$3, tag: ""}, {prop: "jobs", name: "jobs", embedded: false, exported: false, typ: sliceType$4, tag: ""}, {prop: "visited", name: "visited", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "inputs", name: "inputs", embedded: false, exported: false, typ: inputs, tag: ""}]);
|
|
queue.init("regexp", [{prop: "sparse", name: "sparse", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "dense", name: "dense", embedded: false, exported: false, typ: sliceType$10, tag: ""}]);
|
|
entry.init("regexp", [{prop: "pc", name: "pc", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "t", name: "t", embedded: false, exported: false, typ: ptrType$1, tag: ""}]);
|
|
thread.init("regexp", [{prop: "inst", name: "inst", embedded: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "cap", name: "cap", embedded: false, exported: false, typ: sliceType$3, tag: ""}]);
|
|
machine.init("regexp", [{prop: "re", name: "re", embedded: false, exported: false, typ: ptrType$11, tag: ""}, {prop: "p", name: "p", embedded: false, exported: false, typ: ptrType$12, tag: ""}, {prop: "q0", name: "q0", embedded: false, exported: false, typ: queue, tag: ""}, {prop: "q1", name: "q1", embedded: false, exported: false, typ: queue, tag: ""}, {prop: "pool", name: "pool", embedded: false, exported: false, typ: sliceType$11, tag: ""}, {prop: "matched", name: "matched", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "matchcap", name: "matchcap", embedded: false, exported: false, typ: sliceType$3, tag: ""}, {prop: "inputs", name: "inputs", embedded: false, exported: false, typ: inputs, tag: ""}]);
|
|
inputs.init("regexp", [{prop: "bytes", name: "bytes", embedded: false, exported: false, typ: inputBytes, tag: ""}, {prop: "string", name: "string", embedded: false, exported: false, typ: inputString, tag: ""}, {prop: "reader", name: "reader", embedded: false, exported: false, typ: inputReader, tag: ""}]);
|
|
onePassMachine.init("regexp", [{prop: "inputs", name: "inputs", embedded: false, exported: false, typ: inputs, tag: ""}, {prop: "matchcap", name: "matchcap", embedded: false, exported: false, typ: sliceType$3, tag: ""}]);
|
|
onePassProg.init("", [{prop: "Inst", name: "Inst", embedded: false, exported: true, typ: sliceType$6, tag: ""}, {prop: "Start", name: "Start", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "NumCap", name: "NumCap", embedded: false, exported: true, typ: $Int, tag: ""}]);
|
|
onePassInst.init("", [{prop: "Inst", name: "Inst", embedded: true, exported: true, typ: syntax.Inst, tag: ""}, {prop: "Next", name: "Next", embedded: false, exported: true, typ: sliceType$2, tag: ""}]);
|
|
queueOnePass.init("regexp", [{prop: "sparse", name: "sparse", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "dense", name: "dense", embedded: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "size", name: "size", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "nextIndex", name: "nextIndex", embedded: false, exported: false, typ: $Uint32, tag: ""}]);
|
|
runeSlice.init($Int32);
|
|
Regexp.init("regexp", [{prop: "expr", name: "expr", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "prog", name: "prog", embedded: false, exported: false, typ: ptrType$12, tag: ""}, {prop: "onepass", name: "onepass", embedded: false, exported: false, typ: ptrType$6, tag: ""}, {prop: "numSubexp", name: "numSubexp", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "maxBitStateLen", name: "maxBitStateLen", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "subexpNames", name: "subexpNames", embedded: false, exported: false, typ: sliceType$9, tag: ""}, {prop: "prefix", name: "prefix", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "prefixBytes", name: "prefixBytes", embedded: false, exported: false, typ: sliceType$5, tag: ""}, {prop: "prefixRune", name: "prefixRune", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "prefixEnd", name: "prefixEnd", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "mpool", name: "mpool", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "matchcap", name: "matchcap", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "prefixComplete", name: "prefixComplete", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "cond", name: "cond", embedded: false, exported: false, typ: syntax.EmptyOp, tag: ""}, {prop: "longest", name: "longest", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
input.init([{prop: "canCheckPrefix", name: "canCheckPrefix", pkg: "regexp", typ: $funcType([], [$Bool], false)}, {prop: "context", name: "context", pkg: "regexp", typ: $funcType([$Int], [lazyFlag], false)}, {prop: "hasPrefix", name: "hasPrefix", pkg: "regexp", typ: $funcType([ptrType$11], [$Bool], false)}, {prop: "index", name: "index", pkg: "regexp", typ: $funcType([ptrType$11, $Int], [$Int], false)}, {prop: "step", name: "step", pkg: "regexp", typ: $funcType([$Int], [$Int32, $Int], false)}]);
|
|
inputString.init("regexp", [{prop: "str", name: "str", embedded: false, exported: false, typ: $String, tag: ""}]);
|
|
inputBytes.init("regexp", [{prop: "str", name: "str", embedded: false, exported: false, typ: sliceType$5, tag: ""}]);
|
|
inputReader.init("regexp", [{prop: "r", name: "r", embedded: false, exported: false, typ: io.RuneReader, tag: ""}, {prop: "atEOT", name: "atEOT", embedded: false, exported: false, typ: $Bool, tag: ""}, {prop: "pos", name: "pos", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = bytes.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = nosync.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syntax.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sort.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strings.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = unicode.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = utf8.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
bitStatePool = new nosync.Pool.ptr(sliceType.nil, $throwNilPointerError);
|
|
onePassPool = new nosync.Pool.ptr(sliceType.nil, $throwNilPointerError);
|
|
arrayNoInts = arrayType.zero();
|
|
matchPool = arrayType$1.zero();
|
|
specialBytes = arrayType$2.zero();
|
|
noRune = new sliceType$1([]);
|
|
noNext = new sliceType$2([4294967295]);
|
|
anyRuneNotNL = new sliceType$1([0, 9, 11, 1114111]);
|
|
anyRune = new sliceType$1([0, 1114111]);
|
|
matchSize = $toNativeArray($kindInt, [128, 512, 2048, 16384, 0]);
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc"] = (function() {
|
|
var $pkg = {}, $init, bytes, binary, errors, fmt, io, math, reflect, regexp, strconv, strings, sync, byteWriter, binaryFallback, Custom, customFallback, Field, Fields, strucTag, Options, Type, Size_t, Off_t, sliceType, sliceType$1, sliceType$2, sliceType$3, ptrType, ptrType$1, sliceType$4, arrayType$1, ptrType$2, ptrType$3, typeLenRe, fieldCache, fieldCacheLock, parseLock, emptyOptions, typeLookup, typeNames, reflectTypeMap, _r, parseStrucTag, parseField, parseFieldsLocked, fieldCacheLookup, parseFields, init, prep, Unpack, UnpackWithOptions, init$1;
|
|
bytes = $packages["bytes"];
|
|
binary = $packages["encoding/binary"];
|
|
errors = $packages["errors"];
|
|
fmt = $packages["fmt"];
|
|
io = $packages["io"];
|
|
math = $packages["math"];
|
|
reflect = $packages["reflect"];
|
|
regexp = $packages["regexp"];
|
|
strconv = $packages["strconv"];
|
|
strings = $packages["strings"];
|
|
sync = $packages["sync"];
|
|
byteWriter = $pkg.byteWriter = $newType(0, $kindStruct, "struc.byteWriter", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", false, function(buf_, pos_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.buf = sliceType.nil;
|
|
this.pos = 0;
|
|
return;
|
|
}
|
|
this.buf = buf_;
|
|
this.pos = pos_;
|
|
});
|
|
binaryFallback = $pkg.binaryFallback = $newType(0, $kindStruct, "struc.binaryFallback", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", false, function(typ_, ptr_, flag_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.typ = ptrType.nil;
|
|
this.ptr = 0;
|
|
this.flag = 0;
|
|
return;
|
|
}
|
|
this.typ = typ_;
|
|
this.ptr = ptr_;
|
|
this.flag = flag_;
|
|
});
|
|
Custom = $pkg.Custom = $newType(8, $kindInterface, "struc.Custom", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, null);
|
|
customFallback = $pkg.customFallback = $newType(0, $kindStruct, "struc.customFallback", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", false, function(custom_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.custom = $ifaceNil;
|
|
return;
|
|
}
|
|
this.custom = custom_;
|
|
});
|
|
Field = $pkg.Field = $newType(0, $kindStruct, "struc.Field", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, function(Name_, Ptr_, Index_, Type_, defType_, Array_, Slice_, Len_, Order_, Sizeof_, Sizefrom_, Fields_, kind_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Name = "";
|
|
this.Ptr = false;
|
|
this.Index = 0;
|
|
this.Type = 0;
|
|
this.defType = 0;
|
|
this.Array = false;
|
|
this.Slice = false;
|
|
this.Len = 0;
|
|
this.Order = $ifaceNil;
|
|
this.Sizeof = sliceType$2.nil;
|
|
this.Sizefrom = sliceType$2.nil;
|
|
this.Fields = Fields.nil;
|
|
this.kind = 0;
|
|
return;
|
|
}
|
|
this.Name = Name_;
|
|
this.Ptr = Ptr_;
|
|
this.Index = Index_;
|
|
this.Type = Type_;
|
|
this.defType = defType_;
|
|
this.Array = Array_;
|
|
this.Slice = Slice_;
|
|
this.Len = Len_;
|
|
this.Order = Order_;
|
|
this.Sizeof = Sizeof_;
|
|
this.Sizefrom = Sizefrom_;
|
|
this.Fields = Fields_;
|
|
this.kind = kind_;
|
|
});
|
|
Fields = $pkg.Fields = $newType(12, $kindSlice, "struc.Fields", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, null);
|
|
strucTag = $pkg.strucTag = $newType(0, $kindStruct, "struc.strucTag", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", false, function(Type_, Order_, Sizeof_, Skip_, Sizefrom_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Type = "";
|
|
this.Order = $ifaceNil;
|
|
this.Sizeof = "";
|
|
this.Skip = false;
|
|
this.Sizefrom = "";
|
|
return;
|
|
}
|
|
this.Type = Type_;
|
|
this.Order = Order_;
|
|
this.Sizeof = Sizeof_;
|
|
this.Skip = Skip_;
|
|
this.Sizefrom = Sizefrom_;
|
|
});
|
|
Options = $pkg.Options = $newType(0, $kindStruct, "struc.Options", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, function(ByteAlign_, PtrSize_, Order_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.ByteAlign = 0;
|
|
this.PtrSize = 0;
|
|
this.Order = $ifaceNil;
|
|
return;
|
|
}
|
|
this.ByteAlign = ByteAlign_;
|
|
this.PtrSize = PtrSize_;
|
|
this.Order = Order_;
|
|
});
|
|
Type = $pkg.Type = $newType(4, $kindInt, "struc.Type", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, null);
|
|
Size_t = $pkg.Size_t = $newType(8, $kindUint64, "struc.Size_t", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, null);
|
|
Off_t = $pkg.Off_t = $newType(8, $kindInt64, "struc.Off_t", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", true, null);
|
|
sliceType = $sliceType($Uint8);
|
|
sliceType$1 = $sliceType($emptyInterface);
|
|
sliceType$2 = $sliceType($Int);
|
|
sliceType$3 = $sliceType(reflect.Value);
|
|
ptrType = $ptrType(reflect.rtype);
|
|
ptrType$1 = $ptrType(Field);
|
|
sliceType$4 = $sliceType($String);
|
|
arrayType$1 = $arrayType($Uint8, 8);
|
|
ptrType$2 = $ptrType(strucTag);
|
|
ptrType$3 = $ptrType(Options);
|
|
byteWriter.ptr.prototype.Write = function(p) {
|
|
var b, capacity, p;
|
|
b = this;
|
|
capacity = b.buf.$length - b.pos >> 0;
|
|
if (capacity < p.$length) {
|
|
p = $subslice(p, 0, capacity);
|
|
}
|
|
if (p.$length > 0) {
|
|
$copySlice($subslice(b.buf, b.pos), p);
|
|
b.pos = b.pos + (p.$length) >> 0;
|
|
}
|
|
return [p.$length, $ifaceNil];
|
|
};
|
|
byteWriter.prototype.Write = function(p) { return this.$val.Write(p); };
|
|
binaryFallback.ptr.prototype.String = function() {
|
|
var b;
|
|
b = this;
|
|
return $clone(b, binaryFallback).String();
|
|
};
|
|
binaryFallback.prototype.String = function() { return this.$val.String(); };
|
|
binaryFallback.ptr.prototype.Sizeof = function(val, options) {
|
|
var _r$1, _r$2, b, options, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; b = $f.b; options = $f.options; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = this;
|
|
_r$1 = $clone(val, reflect.Value).Interface(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = binary.Size(_r$1); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: binaryFallback.ptr.prototype.Sizeof }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f.b = b; $f.options = options; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
binaryFallback.prototype.Sizeof = function(val, options) { return this.$val.Sizeof(val, options); };
|
|
binaryFallback.ptr.prototype.Pack = function(buf, val, options) {
|
|
var _arg, _arg$1, _arg$2, _r$1, _r$2, b, buf, err, options, order, tmp, val, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r$1 = $f._r$1; _r$2 = $f._r$2; b = $f.b; buf = $f.buf; err = $f.err; options = $f.options; order = $f.order; tmp = $f.tmp; val = $f.val; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = this;
|
|
tmp = new byteWriter.ptr(buf, 0);
|
|
order = (x = binary.BigEndian, new x.constructor.elem(x));
|
|
if (!($interfaceIsEqual(options.Order, $ifaceNil))) {
|
|
order = options.Order;
|
|
}
|
|
_arg = new tmp.constructor.elem(tmp);
|
|
_arg$1 = order;
|
|
_r$1 = $clone(val, reflect.Value).Interface(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$1;
|
|
_r$2 = binary.Write(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
err = _r$2;
|
|
$s = -1; return [tmp.pos, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: binaryFallback.ptr.prototype.Pack }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.b = b; $f.buf = buf; $f.err = err; $f.options = options; $f.order = order; $f.tmp = tmp; $f.val = val; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
binaryFallback.prototype.Pack = function(buf, val, options) { return this.$val.Pack(buf, val, options); };
|
|
binaryFallback.ptr.prototype.Unpack = function(r, val, options) {
|
|
var _arg, _arg$1, _arg$2, _r$1, _r$2, b, options, order, r, val, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r$1 = $f._r$1; _r$2 = $f._r$2; b = $f.b; options = $f.options; order = $f.order; r = $f.r; val = $f.val; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
b = this;
|
|
order = (x = binary.BigEndian, new x.constructor.elem(x));
|
|
if (!($interfaceIsEqual(options.Order, $ifaceNil))) {
|
|
order = options.Order;
|
|
}
|
|
_arg = r;
|
|
_arg$1 = order;
|
|
_r$1 = $clone(val, reflect.Value).Interface(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_arg$2 = _r$1;
|
|
_r$2 = binary.Read(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: binaryFallback.ptr.prototype.Unpack }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.b = b; $f.options = options; $f.order = order; $f.r = r; $f.val = val; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
binaryFallback.prototype.Unpack = function(r, val, options) { return this.$val.Unpack(r, val, options); };
|
|
customFallback.ptr.prototype.Pack = function(p, val, opt) {
|
|
var _r$1, c, opt, p, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; c = $f.c; opt = $f.opt; p = $f.p; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
_r$1 = c.custom.Pack(p, opt); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: customFallback.ptr.prototype.Pack }; } $f._r$1 = _r$1; $f.c = c; $f.opt = opt; $f.p = p; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
customFallback.prototype.Pack = function(p, val, opt) { return this.$val.Pack(p, val, opt); };
|
|
customFallback.ptr.prototype.Unpack = function(r, val, opt) {
|
|
var _r$1, c, opt, r, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; c = $f.c; opt = $f.opt; r = $f.r; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
_r$1 = c.custom.Unpack(r, 1, opt); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: customFallback.ptr.prototype.Unpack }; } $f._r$1 = _r$1; $f.c = c; $f.opt = opt; $f.r = r; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
customFallback.prototype.Unpack = function(r, val, opt) { return this.$val.Unpack(r, val, opt); };
|
|
customFallback.ptr.prototype.Sizeof = function(val, opt) {
|
|
var _r$1, c, opt, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; c = $f.c; opt = $f.opt; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
_r$1 = c.custom.Size(opt); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: customFallback.ptr.prototype.Sizeof }; } $f._r$1 = _r$1; $f.c = c; $f.opt = opt; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
customFallback.prototype.Sizeof = function(val, opt) { return this.$val.Sizeof(val, opt); };
|
|
customFallback.ptr.prototype.String = function() {
|
|
var _r$1, c, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; c = $f.c; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
_r$1 = c.custom.String(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: customFallback.ptr.prototype.String }; } $f._r$1 = _r$1; $f.c = c; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
customFallback.prototype.String = function() { return this.$val.String(); };
|
|
Field.ptr.prototype.String = function() {
|
|
var _r$1, _r$2, _r$3, _r$4, _r$5, f, out, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; f = $f.f; out = $f.out; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
out = "";
|
|
/* */ if (f.Type === 1) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (f.Type === 1) { */ case 1:
|
|
_r$1 = fmt.Sprintf("{type: Pad, len: %d}", new sliceType$1([new $Int(f.Len)])); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } else { */ case 2:
|
|
_r$2 = fmt.Sprintf("type: %s, order: %v", new sliceType$1([new $String(new Type(f.Type).String()), f.Order])); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
out = _r$2;
|
|
/* } */ case 3:
|
|
/* */ if (!(f.Sizefrom === sliceType$2.nil)) { $s = 6; continue; }
|
|
/* */ if (f.Len > 0) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!(f.Sizefrom === sliceType$2.nil)) { */ case 6:
|
|
_r$3 = fmt.Sprintf(", sizefrom: %v", new sliceType$1([f.Sizefrom])); /* */ $s = 9; case 9: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
out = out + (_r$3);
|
|
$s = 8; continue;
|
|
/* } else if (f.Len > 0) { */ case 7:
|
|
_r$4 = fmt.Sprintf(", len: %d", new sliceType$1([new $Int(f.Len)])); /* */ $s = 10; case 10: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
out = out + (_r$4);
|
|
/* } */ case 8:
|
|
/* */ if (!(f.Sizeof === sliceType$2.nil)) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (!(f.Sizeof === sliceType$2.nil)) { */ case 11:
|
|
_r$5 = fmt.Sprintf(", sizeof: %v", new sliceType$1([f.Sizeof])); /* */ $s = 13; case 13: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
out = out + (_r$5);
|
|
/* } */ case 12:
|
|
$s = -1; return "{" + out + "}";
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.String }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f.f = f; $f.out = out; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.String = function() { return this.$val.String(); };
|
|
Field.ptr.prototype.Size = function(val, options) {
|
|
var _i, _r$1, _r$2, _r$3, _r$4, _r$5, _ref, align, f, i, length, options, size, typ, val, val$1, vals, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _ref = $f._ref; align = $f.align; f = $f.f; i = $f.i; length = $f.length; options = $f.options; size = $f.size; typ = $f.typ; val = $f.val; val$1 = $f.val$1; vals = $f.vals; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r$1 = new Type(f.Type).Resolve(options); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
typ = _r$1;
|
|
size = 0;
|
|
/* */ if (typ === 15) { $s = 2; continue; }
|
|
/* */ if (typ === 1) { $s = 3; continue; }
|
|
/* */ if (f.Slice || (f.kind === 24)) { $s = 4; continue; }
|
|
/* */ if (typ === 19) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (typ === 15) { */ case 2:
|
|
vals = new sliceType$3([$clone(val, reflect.Value)]);
|
|
/* */ if (f.Slice) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (f.Slice) { */ case 8:
|
|
vals = $makeSlice(sliceType$3, $clone(val, reflect.Value).Len());
|
|
i = 0;
|
|
/* while (true) { */ case 10:
|
|
/* if (!(i < $clone(val, reflect.Value).Len())) { break; } */ if(!(i < $clone(val, reflect.Value).Len())) { $s = 11; continue; }
|
|
_r$2 = $clone(val, reflect.Value).Index(i); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
((i < 0 || i >= vals.$length) ? ($throwRuntimeError("index out of range"), undefined) : vals.$array[vals.$offset + i] = _r$2);
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 10; continue; case 11:
|
|
/* } */ case 9:
|
|
_ref = vals;
|
|
_i = 0;
|
|
/* while (true) { */ case 13:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 14; continue; }
|
|
val$1 = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
_r$3 = f.Fields.Sizeof($clone(val$1, reflect.Value), options); /* */ $s = 15; case 15: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
size = size + (_r$3) >> 0;
|
|
_i++;
|
|
/* } */ $s = 13; continue; case 14:
|
|
$s = 7; continue;
|
|
/* } else if (typ === 1) { */ case 3:
|
|
size = f.Len;
|
|
$s = 7; continue;
|
|
/* } else if (f.Slice || (f.kind === 24)) { */ case 4:
|
|
length = $clone(val, reflect.Value).Len();
|
|
if (f.Len > 1) {
|
|
length = f.Len;
|
|
}
|
|
size = $imul(length, new Type(typ).Size());
|
|
$s = 7; continue;
|
|
/* } else if (typ === 19) { */ case 5:
|
|
_r$4 = $clone($clone(val, reflect.Value).Addr(), reflect.Value).Interface(); /* */ $s = 16; case 16: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = $assertType(_r$4, Custom).Size(options); /* */ $s = 17; case 17: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$5;
|
|
/* } else { */ case 6:
|
|
size = new Type(typ).Size();
|
|
/* } */ case 7:
|
|
align = options.ByteAlign;
|
|
if (align > 0 && size < align) {
|
|
size = align;
|
|
}
|
|
$s = -1; return size;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.Size }; } $f._i = _i; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._ref = _ref; $f.align = align; $f.f = f; $f.i = i; $f.length = length; $f.options = options; $f.size = size; $f.typ = typ; $f.val = val; $f.val$1 = val$1; $f.vals = vals; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.Size = function(val, options) { return this.$val.Size(val, options); };
|
|
Field.ptr.prototype.packVal = function(buf, val, length, options) {
|
|
var _1, _2, _3, _4, _5, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _tuple, _tuple$1, buf, err, f, length, n, n$1, options, order, size, typ, val, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _5 = $f._5; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; buf = $f.buf; err = $f.err; f = $f.f; length = $f.length; n = $f.n; n$1 = $f.n$1; options = $f.options; order = $f.order; size = $f.size; typ = $f.typ; val = $f.val; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
size = 0;
|
|
err = $ifaceNil;
|
|
f = this;
|
|
order = f.Order;
|
|
if (!($interfaceIsEqual(options.Order, $ifaceNil))) {
|
|
order = options.Order;
|
|
}
|
|
/* */ if (f.Ptr) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (f.Ptr) { */ case 1:
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ case 2:
|
|
_r$2 = new Type(f.Type).Resolve(options); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
typ = _r$2;
|
|
_1 = typ;
|
|
/* */ if (_1 === (15)) { $s = 6; continue; }
|
|
/* */ if ((_1 === (2)) || (_1 === (4)) || (_1 === (6)) || (_1 === (8)) || (_1 === (10)) || (_1 === (5)) || (_1 === (7)) || (_1 === (9)) || (_1 === (11))) { $s = 7; continue; }
|
|
/* */ if ((_1 === (12)) || (_1 === (13))) { $s = 8; continue; }
|
|
/* */ if (_1 === (14)) { $s = 9; continue; }
|
|
/* */ if (_1 === (19)) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_1 === (15)) { */ case 6:
|
|
_r$3 = f.Fields.Pack(buf, $clone(val, reflect.Value), options); /* */ $s = 13; case 13: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_tuple = _r$3;
|
|
size = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [size, err];
|
|
/* } else if ((_1 === (2)) || (_1 === (4)) || (_1 === (6)) || (_1 === (8)) || (_1 === (10)) || (_1 === (5)) || (_1 === (7)) || (_1 === (9)) || (_1 === (11))) { */ case 7:
|
|
size = new Type(typ).Size();
|
|
n = new $Uint64(0, 0);
|
|
_2 = f.kind;
|
|
if (_2 === (1)) {
|
|
if ($clone(val, reflect.Value).Bool()) {
|
|
n = new $Uint64(0, 1);
|
|
} else {
|
|
n = new $Uint64(0, 0);
|
|
}
|
|
} else if ((_2 === (2)) || (_2 === (3)) || (_2 === (4)) || (_2 === (5)) || (_2 === (6))) {
|
|
n = ((x = $clone(val, reflect.Value).Int(), new $Uint64(x.$high, x.$low)));
|
|
} else {
|
|
n = $clone(val, reflect.Value).Uint();
|
|
}
|
|
_3 = typ;
|
|
/* */ if (_3 === (2)) { $s = 15; continue; }
|
|
/* */ if ((_3 === (4)) || (_3 === (5))) { $s = 16; continue; }
|
|
/* */ if ((_3 === (6)) || (_3 === (7))) { $s = 17; continue; }
|
|
/* */ if ((_3 === (8)) || (_3 === (9))) { $s = 18; continue; }
|
|
/* */ if ((_3 === (10)) || (_3 === (11))) { $s = 19; continue; }
|
|
/* */ $s = 20; continue;
|
|
/* if (_3 === (2)) { */ case 15:
|
|
if (!((n.$high === 0 && n.$low === 0))) {
|
|
(0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0] = 1);
|
|
} else {
|
|
(0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0] = 0);
|
|
}
|
|
$s = 20; continue;
|
|
/* } else if ((_3 === (4)) || (_3 === (5))) { */ case 16:
|
|
(0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0] = ((n.$low << 24 >>> 24)));
|
|
$s = 20; continue;
|
|
/* } else if ((_3 === (6)) || (_3 === (7))) { */ case 17:
|
|
$r = order.PutUint16(buf, ((n.$low << 16 >>> 16))); /* */ $s = 21; case 21: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 20; continue;
|
|
/* } else if ((_3 === (8)) || (_3 === (9))) { */ case 18:
|
|
$r = order.PutUint32(buf, ((n.$low >>> 0))); /* */ $s = 22; case 22: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 20; continue;
|
|
/* } else if ((_3 === (10)) || (_3 === (11))) { */ case 19:
|
|
$r = order.PutUint64(buf, (n)); /* */ $s = 23; case 23: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 20:
|
|
case 14:
|
|
$s = 12; continue;
|
|
/* } else if ((_1 === (12)) || (_1 === (13))) { */ case 8:
|
|
size = new Type(typ).Size();
|
|
n$1 = $clone(val, reflect.Value).Float();
|
|
_4 = typ;
|
|
/* */ if (_4 === (12)) { $s = 25; continue; }
|
|
/* */ if (_4 === (13)) { $s = 26; continue; }
|
|
/* */ $s = 27; continue;
|
|
/* if (_4 === (12)) { */ case 25:
|
|
$r = order.PutUint32(buf, math.Float32bits(($fround(n$1)))); /* */ $s = 28; case 28: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 27; continue;
|
|
/* } else if (_4 === (13)) { */ case 26:
|
|
$r = order.PutUint64(buf, math.Float64bits(n$1)); /* */ $s = 29; case 29: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 27:
|
|
case 24:
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (14)) { */ case 9:
|
|
_5 = f.kind;
|
|
/* */ if (_5 === (24)) { $s = 31; continue; }
|
|
/* */ $s = 32; continue;
|
|
/* if (_5 === (24)) { */ case 31:
|
|
size = $clone(val, reflect.Value).Len();
|
|
_r$4 = $clone(val, reflect.Value).String(); /* */ $s = 34; case 34: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$copySlice(buf, (new sliceType($stringToBytes(_r$4))));
|
|
$s = 33; continue;
|
|
/* } else { */ case 32:
|
|
size = $clone(val, reflect.Value).Len();
|
|
_r$5 = $clone(val, reflect.Value).Bytes(); /* */ $s = 35; case 35: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
$copySlice(buf, _r$5);
|
|
/* } */ case 33:
|
|
case 30:
|
|
$s = 12; continue;
|
|
/* } else if (_1 === (19)) { */ case 10:
|
|
_r$6 = $clone($clone(val, reflect.Value).Addr(), reflect.Value).Interface(); /* */ $s = 36; case 36: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$7 = $assertType(_r$6, Custom).Pack(buf, options); /* */ $s = 37; case 37: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$7;
|
|
size = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
$s = -1; return [size, err];
|
|
/* } else { */ case 11:
|
|
_r$8 = fmt.Sprintf("no pack handler for type: %s", new sliceType$1([new Type(typ)])); /* */ $s = 38; case 38: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$8));
|
|
/* } */ case 12:
|
|
case 5:
|
|
$s = -1; return [size, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.packVal }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._5 = _5; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.buf = buf; $f.err = err; $f.f = f; $f.length = length; $f.n = n; $f.n$1 = n$1; $f.options = options; $f.order = order; $f.size = size; $f.typ = typ; $f.val = val; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.packVal = function(buf, val, length, options) { return this.$val.packVal(buf, val, length, options); };
|
|
Field.ptr.prototype.Pack = function(buf, val, length, options) {
|
|
var _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _tuple, buf, cur, end, err, f, i, i$1, length, n, options, pos, rep, tmp, typ, val, zero, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _tuple = $f._tuple; buf = $f.buf; cur = $f.cur; end = $f.end; err = $f.err; f = $f.f; i = $f.i; i$1 = $f.i$1; length = $f.length; n = $f.n; options = $f.options; pos = $f.pos; rep = $f.rep; tmp = $f.tmp; typ = $f.typ; val = $f.val; zero = $f.zero; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r$1 = new Type(f.Type).Resolve(options); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
typ = _r$1;
|
|
if (typ === 1) {
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < length)) { break; }
|
|
((i < 0 || i >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + i] = 0);
|
|
i = i + (1) >> 0;
|
|
}
|
|
$s = -1; return [length, $ifaceNil];
|
|
}
|
|
/* */ if (f.Slice) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (f.Slice) { */ case 2:
|
|
end = $clone(val, reflect.Value).Len();
|
|
/* */ if (!f.Array && (typ === 5) && ((f.defType === 5) || (f.kind === 24))) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (!f.Array && (typ === 5) && ((f.defType === 5) || (f.kind === 24))) { */ case 5:
|
|
tmp = sliceType.nil;
|
|
/* */ if (f.kind === 24) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (f.kind === 24) { */ case 7:
|
|
_r$2 = $clone(val, reflect.Value).String(); /* */ $s = 10; case 10: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
tmp = (new sliceType($stringToBytes(_r$2)));
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
_r$3 = $clone(val, reflect.Value).Bytes(); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
tmp = _r$3;
|
|
/* } */ case 9:
|
|
$copySlice(buf, tmp);
|
|
if (end < length) {
|
|
rep = bytes.Repeat(new sliceType([0]), length - end >> 0);
|
|
$copySlice($subslice(buf, end), rep);
|
|
$s = -1; return [length, $ifaceNil];
|
|
}
|
|
$s = -1; return [$clone(val, reflect.Value).Len(), $ifaceNil];
|
|
/* } */ case 6:
|
|
pos = 0;
|
|
zero = new reflect.Value.ptr(ptrType.nil, 0, 0);
|
|
/* */ if (end < length) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (end < length) { */ case 12:
|
|
_r$4 = $clone(val, reflect.Value).Type().Elem(); /* */ $s = 14; case 14: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = reflect.Zero(_r$4); /* */ $s = 15; case 15: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
zero = _r$5;
|
|
/* } */ case 13:
|
|
i$1 = 0;
|
|
/* while (true) { */ case 16:
|
|
/* if (!(i$1 < length)) { break; } */ if(!(i$1 < length)) { $s = 17; continue; }
|
|
cur = zero;
|
|
/* */ if (i$1 < end) { $s = 18; continue; }
|
|
/* */ $s = 19; continue;
|
|
/* if (i$1 < end) { */ case 18:
|
|
_r$6 = $clone(val, reflect.Value).Index(i$1); /* */ $s = 20; case 20: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
cur = _r$6;
|
|
/* } */ case 19:
|
|
_r$7 = f.packVal($subslice(buf, pos), $clone(cur, reflect.Value), 1, options); /* */ $s = 21; case 21: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple = _r$7;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [pos, err];
|
|
} else {
|
|
pos = pos + (n) >> 0;
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 16; continue; case 17:
|
|
$s = -1; return [pos, $ifaceNil];
|
|
/* } else { */ case 3:
|
|
_r$8 = f.packVal(buf, $clone(val, reflect.Value), length, options); /* */ $s = 22; case 22: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$8;
|
|
/* } */ case 4:
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.Pack }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._tuple = _tuple; $f.buf = buf; $f.cur = cur; $f.end = end; $f.err = err; $f.f = f; $f.i = i; $f.i$1 = i$1; $f.length = length; $f.n = n; $f.options = options; $f.pos = pos; $f.rep = rep; $f.tmp = tmp; $f.typ = typ; $f.val = val; $f.zero = zero; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.Pack = function(buf, val, length, options) { return this.$val.Pack(buf, val, length, options); };
|
|
Field.ptr.prototype.unpackVal = function(buf, val, length, options) {
|
|
var _1, _2, _3, _4, _5, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, buf, f, length, n, n$1, options, order, typ, val, x, x$1, x$2, x$3, x$4, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _5 = $f._5; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; buf = $f.buf; f = $f.f; length = $f.length; n = $f.n; n$1 = $f.n$1; options = $f.options; order = $f.order; typ = $f.typ; val = $f.val; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
order = f.Order;
|
|
if (!($interfaceIsEqual(options.Order, $ifaceNil))) {
|
|
order = options.Order;
|
|
}
|
|
/* */ if (f.Ptr) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (f.Ptr) { */ case 1:
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ case 2:
|
|
_r$2 = new Type(f.Type).Resolve(options); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
typ = _r$2;
|
|
_1 = typ;
|
|
/* */ if ((_1 === (12)) || (_1 === (13))) { $s = 6; continue; }
|
|
/* */ if ((_1 === (2)) || (_1 === (4)) || (_1 === (6)) || (_1 === (8)) || (_1 === (10)) || (_1 === (5)) || (_1 === (7)) || (_1 === (9)) || (_1 === (11))) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if ((_1 === (12)) || (_1 === (13))) { */ case 6:
|
|
n = 0;
|
|
_2 = typ;
|
|
/* */ if (_2 === (12)) { $s = 11; continue; }
|
|
/* */ if (_2 === (13)) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (_2 === (12)) { */ case 11:
|
|
_r$3 = order.Uint32(buf); /* */ $s = 14; case 14: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_r$4 = math.Float32frombits(_r$3); /* */ $s = 15; case 15: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
n = (_r$4);
|
|
$s = 13; continue;
|
|
/* } else if (_2 === (13)) { */ case 12:
|
|
_r$5 = order.Uint64(buf); /* */ $s = 16; case 16: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$6 = math.Float64frombits(_r$5); /* */ $s = 17; case 17: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
n = _r$6;
|
|
/* } */ case 13:
|
|
case 10:
|
|
_3 = f.kind;
|
|
/* */ if ((_3 === (13)) || (_3 === (14))) { $s = 19; continue; }
|
|
/* */ $s = 20; continue;
|
|
/* if ((_3 === (13)) || (_3 === (14))) { */ case 19:
|
|
$clone(val, reflect.Value).SetFloat(n);
|
|
$s = 21; continue;
|
|
/* } else { */ case 20:
|
|
_r$7 = fmt.Errorf("struc: refusing to unpack float into field %s of type %s", new sliceType$1([new $String(f.Name), new $String(new reflect.Kind(f.kind).String())])); /* */ $s = 22; case 22: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$7;
|
|
/* } */ case 21:
|
|
case 18:
|
|
$s = 9; continue;
|
|
/* } else if ((_1 === (2)) || (_1 === (4)) || (_1 === (6)) || (_1 === (8)) || (_1 === (10)) || (_1 === (5)) || (_1 === (7)) || (_1 === (9)) || (_1 === (11))) { */ case 7:
|
|
n$1 = new $Uint64(0, 0);
|
|
_4 = typ;
|
|
/* */ if (_4 === (4)) { $s = 24; continue; }
|
|
/* */ if (_4 === (6)) { $s = 25; continue; }
|
|
/* */ if (_4 === (8)) { $s = 26; continue; }
|
|
/* */ if (_4 === (10)) { $s = 27; continue; }
|
|
/* */ if ((_4 === (2)) || (_4 === (5))) { $s = 28; continue; }
|
|
/* */ if (_4 === (7)) { $s = 29; continue; }
|
|
/* */ if (_4 === (9)) { $s = 30; continue; }
|
|
/* */ if (_4 === (11)) { $s = 31; continue; }
|
|
/* */ $s = 32; continue;
|
|
/* if (_4 === (4)) { */ case 24:
|
|
n$1 = ((x = (new $Int64(0, (((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) << 24 >> 24)))), new $Uint64(x.$high, x.$low)));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (6)) { */ case 25:
|
|
_r$8 = order.Uint16(buf); /* */ $s = 33; case 33: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
n$1 = ((x$1 = (new $Int64(0, ((_r$8 << 16 >> 16)))), new $Uint64(x$1.$high, x$1.$low)));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (8)) { */ case 26:
|
|
_r$9 = order.Uint32(buf); /* */ $s = 34; case 34: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
n$1 = ((x$2 = (new $Int64(0, ((_r$9 >> 0)))), new $Uint64(x$2.$high, x$2.$low)));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (10)) { */ case 27:
|
|
_r$10 = order.Uint64(buf); /* */ $s = 35; case 35: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
n$1 = ((x$3 = ((x$4 = _r$10, new $Int64(x$4.$high, x$4.$low))), new $Uint64(x$3.$high, x$3.$low)));
|
|
$s = 32; continue;
|
|
/* } else if ((_4 === (2)) || (_4 === (5))) { */ case 28:
|
|
n$1 = (new $Uint64(0, (0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0])));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (7)) { */ case 29:
|
|
_r$11 = order.Uint16(buf); /* */ $s = 36; case 36: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
n$1 = (new $Uint64(0, _r$11));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (9)) { */ case 30:
|
|
_r$12 = order.Uint32(buf); /* */ $s = 37; case 37: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
n$1 = (new $Uint64(0, _r$12));
|
|
$s = 32; continue;
|
|
/* } else if (_4 === (11)) { */ case 31:
|
|
_r$13 = order.Uint64(buf); /* */ $s = 38; case 38: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
n$1 = (_r$13);
|
|
/* } */ case 32:
|
|
case 23:
|
|
_5 = f.kind;
|
|
if (_5 === (1)) {
|
|
$clone(val, reflect.Value).SetBool(!((n$1.$high === 0 && n$1.$low === 0)));
|
|
} else if ((_5 === (2)) || (_5 === (3)) || (_5 === (4)) || (_5 === (5)) || (_5 === (6))) {
|
|
$clone(val, reflect.Value).SetInt((new $Int64(n$1.$high, n$1.$low)));
|
|
} else {
|
|
$clone(val, reflect.Value).SetUint(n$1);
|
|
}
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
_r$14 = fmt.Sprintf("no unpack handler for type: %s", new sliceType$1([new Type(typ)])); /* */ $s = 39; case 39: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$14));
|
|
/* } */ case 9:
|
|
case 5:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.unpackVal }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._5 = _5; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f.buf = buf; $f.f = f; $f.length = length; $f.n = n; $f.n$1 = n$1; $f.options = options; $f.order = order; $f.typ = typ; $f.val = val; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.unpackVal = function(buf, val, length, options) { return this.$val.unpackVal(buf, val, length, options); };
|
|
Field.ptr.prototype.Unpack = function(buf, val, length, options) {
|
|
var _arg, _arg$1, _arg$2, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, buf, err, f, i, length, options, pos, size, typ, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; buf = $f.buf; err = $f.err; f = $f.f; i = $f.i; length = $f.length; options = $f.options; pos = $f.pos; size = $f.size; typ = $f.typ; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r$1 = new Type(f.Type).Resolve(options); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
typ = _r$1;
|
|
/* */ if ((typ === 1) || (f.kind === 24)) { $s = 2; continue; }
|
|
/* */ if (f.Slice) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if ((typ === 1) || (f.kind === 24)) { */ case 2:
|
|
if (typ === 1) {
|
|
$s = -1; return $ifaceNil;
|
|
} else {
|
|
$clone(val, reflect.Value).SetString(($bytesToString(buf)));
|
|
$s = -1; return $ifaceNil;
|
|
}
|
|
$s = 5; continue;
|
|
/* } else if (f.Slice) { */ case 3:
|
|
/* */ if ($clone(val, reflect.Value).Cap() < length) { $s = 6; continue; }
|
|
/* */ if ($clone(val, reflect.Value).Len() < length) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if ($clone(val, reflect.Value).Cap() < length) { */ case 6:
|
|
_r$2 = reflect.MakeSlice($clone(val, reflect.Value).Type(), length, length); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$r = $clone(val, reflect.Value).Set($clone(_r$2, reflect.Value)); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 8; continue;
|
|
/* } else if ($clone(val, reflect.Value).Len() < length) { */ case 7:
|
|
_r$3 = $clone(val, reflect.Value).Slice(0, length); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$r = $clone(val, reflect.Value).Set($clone(_r$3, reflect.Value)); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 8:
|
|
/* */ if (!f.Array && (typ === 5) && (f.defType === 5)) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (!f.Array && (typ === 5) && (f.defType === 5)) { */ case 13:
|
|
_r$4 = $clone(val, reflect.Value).Bytes(); /* */ $s = 15; case 15: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$copySlice(_r$4, $subslice(buf, 0, length));
|
|
$s = -1; return $ifaceNil;
|
|
/* } */ case 14:
|
|
pos = 0;
|
|
size = new Type(typ).Size();
|
|
i = 0;
|
|
/* while (true) { */ case 16:
|
|
/* if (!(i < length)) { break; } */ if(!(i < length)) { $s = 17; continue; }
|
|
_arg = $subslice(buf, pos, (pos + size >> 0));
|
|
_r$5 = $clone(val, reflect.Value).Index(i); /* */ $s = 18; case 18: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_arg$1 = $clone(_r$5, reflect.Value);
|
|
_arg$2 = options;
|
|
_r$6 = f.unpackVal(_arg, _arg$1, 1, _arg$2); /* */ $s = 19; case 19: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
err = _r$6;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
pos = pos + (size) >> 0;
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 16; continue; case 17:
|
|
$s = -1; return $ifaceNil;
|
|
/* } else { */ case 4:
|
|
_r$7 = f.unpackVal(buf, $clone(val, reflect.Value), length, options); /* */ $s = 20; case 20: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$7;
|
|
/* } */ case 5:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Field.ptr.prototype.Unpack }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f.buf = buf; $f.err = err; $f.f = f; $f.i = i; $f.length = length; $f.options = options; $f.pos = pos; $f.size = size; $f.typ = typ; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Field.prototype.Unpack = function(buf, val, length, options) { return this.$val.Unpack(buf, val, length, options); };
|
|
Fields.prototype.SetByteOrder = function(order) {
|
|
var _i, _ref, f, field, order;
|
|
f = this;
|
|
_ref = f;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
field = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!(field === ptrType$1.nil)) {
|
|
field.Order = order;
|
|
}
|
|
_i++;
|
|
}
|
|
};
|
|
$ptrType(Fields).prototype.SetByteOrder = function(order) { return this.$get().SetByteOrder(order); };
|
|
Fields.prototype.String = function() {
|
|
var _i, _r$1, _ref, f, field, fields, i, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r$1 = $f._r$1; _ref = $f._ref; f = $f.f; field = $f.field; fields = $f.fields; i = $f.i; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
fields = $makeSlice(sliceType$4, f.$length);
|
|
_ref = f;
|
|
_i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
|
|
i = _i;
|
|
field = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (!(field === ptrType$1.nil)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!(field === ptrType$1.nil)) { */ case 3:
|
|
_r$1 = field.String(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
((i < 0 || i >= fields.$length) ? ($throwRuntimeError("index out of range"), undefined) : fields.$array[fields.$offset + i] = _r$1);
|
|
/* } */ case 4:
|
|
_i++;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return "{" + strings.Join(fields, ", ") + "}";
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fields.prototype.String }; } $f._i = _i; $f._r$1 = _r$1; $f._ref = _ref; $f.f = f; $f.field = field; $f.fields = fields; $f.i = i; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Fields).prototype.String = function() { return this.$get().String(); };
|
|
Fields.prototype.Sizeof = function(val, options) {
|
|
var _i, _r$1, _r$2, _r$3, _ref, f, field, i, options, size, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _ref = $f._ref; f = $f.f; field = $f.field; i = $f.i; options = $f.options; size = $f.size; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
/* while (true) { */ case 1:
|
|
/* if (!($clone(val, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(val, reflect.Value).Kind() === 22)) { $s = 2; continue; }
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ $s = 1; continue; case 2:
|
|
size = 0;
|
|
_ref = f;
|
|
_i = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
|
|
i = _i;
|
|
field = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (!(field === ptrType$1.nil)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (!(field === ptrType$1.nil)) { */ case 6:
|
|
_r$2 = $clone(val, reflect.Value).Field(i); /* */ $s = 8; case 8: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$3 = field.Size($clone(_r$2, reflect.Value), options); /* */ $s = 9; case 9: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
size = size + (_r$3) >> 0;
|
|
/* } */ case 7:
|
|
_i++;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return size;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fields.prototype.Sizeof }; } $f._i = _i; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._ref = _ref; $f.f = f; $f.field = field; $f.i = i; $f.options = options; $f.size = size; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Fields).prototype.Sizeof = function(val, options) { return this.$get().Sizeof(val, options); };
|
|
Fields.prototype.sizefrom = function(val, index) {
|
|
var _1, _arg, _arg$1, _r$1, _r$2, _r$3, _r$4, f, field, index, n, name, val, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; f = $f.f; field = $f.field; index = $f.index; n = $f.n; name = $f.name; val = $f.val; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r$1 = $clone(val, reflect.Value).FieldByIndex(index); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
field = _r$1;
|
|
_1 = $clone(field, reflect.Value).Kind();
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 3; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 3:
|
|
$s = -1; return (((x = $clone(field, reflect.Value).Int(), x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) { */ case 4:
|
|
n = (($clone(field, reflect.Value).Uint().$low >> 0));
|
|
if (n < 0) {
|
|
$s = -1; return 0;
|
|
}
|
|
$s = -1; return n;
|
|
/* } else { */ case 5:
|
|
_r$2 = $clone(val, reflect.Value).Type().FieldByIndex(index); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
name = _r$2.Name;
|
|
_r$3 = $clone(val, reflect.Value).Interface(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_arg = _r$3;
|
|
_arg$1 = new $String(name);
|
|
_r$4 = fmt.Sprintf("sizeof field %T.%s not an integer type", new sliceType$1([_arg, _arg$1])); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$4));
|
|
/* } */ case 6:
|
|
case 2:
|
|
$s = -1; return 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fields.prototype.sizefrom }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.f = f; $f.field = field; $f.index = index; $f.n = n; $f.name = name; $f.val = val; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Fields).prototype.sizefrom = function(val, index) { return this.$get().sizefrom(val, index); };
|
|
Fields.prototype.Pack = function(buf, val, options) {
|
|
var _1, _i, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _tuple, buf, err, f, field, i, length, length$1, n, options, pos, v, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _tuple = $f._tuple; buf = $f.buf; err = $f.err; f = $f.f; field = $f.field; i = $f.i; length = $f.length; length$1 = $f.length$1; n = $f.n; options = $f.options; pos = $f.pos; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
/* while (true) { */ case 1:
|
|
/* if (!($clone(val, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(val, reflect.Value).Kind() === 22)) { $s = 2; continue; }
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ $s = 1; continue; case 2:
|
|
pos = 0;
|
|
_ref = f;
|
|
_i = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
|
|
i = _i;
|
|
field = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (field === ptrType$1.nil) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (field === ptrType$1.nil) { */ case 6:
|
|
_i++;
|
|
/* continue; */ $s = 4; continue;
|
|
/* } */ case 7:
|
|
_r$2 = $clone(val, reflect.Value).Field(i); /* */ $s = 8; case 8: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
length = field.Len;
|
|
/* */ if (!(field.Sizefrom === sliceType$2.nil)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!(field.Sizefrom === sliceType$2.nil)) { */ case 9:
|
|
_r$3 = f.sizefrom($clone(val, reflect.Value), field.Sizefrom); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
length = _r$3;
|
|
/* } */ case 10:
|
|
if (length <= 0 && field.Slice) {
|
|
length = $clone(v, reflect.Value).Len();
|
|
}
|
|
/* */ if (!(field.Sizeof === sliceType$2.nil)) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (!(field.Sizeof === sliceType$2.nil)) { */ case 12:
|
|
_r$4 = $clone(val, reflect.Value).FieldByIndex(field.Sizeof); /* */ $s = 14; case 14: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = $clone(_r$4, reflect.Value).Len(); /* */ $s = 15; case 15: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
length$1 = _r$5;
|
|
_1 = field.kind;
|
|
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 17; continue; }
|
|
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) { $s = 18; continue; }
|
|
/* */ $s = 19; continue;
|
|
/* if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 17:
|
|
_r$6 = $clone(reflect.New($clone(v, reflect.Value).Type()), reflect.Value).Elem(); /* */ $s = 21; case 21: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
v = _r$6;
|
|
$clone(v, reflect.Value).SetInt((new $Int64(0, length$1)));
|
|
$s = 20; continue;
|
|
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) { */ case 18:
|
|
_r$7 = $clone(reflect.New($clone(v, reflect.Value).Type()), reflect.Value).Elem(); /* */ $s = 22; case 22: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
v = _r$7;
|
|
$clone(v, reflect.Value).SetUint((new $Uint64(0, length$1)));
|
|
$s = 20; continue;
|
|
/* } else { */ case 19:
|
|
_r$8 = fmt.Sprintf("sizeof field is not int or uint type: %s, %s", new sliceType$1([new $String(field.Name), $clone(v, reflect.Value).Type()])); /* */ $s = 23; case 23: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$8));
|
|
/* } */ case 20:
|
|
case 16:
|
|
/* } */ case 13:
|
|
_r$9 = field.Pack($subslice(buf, pos), $clone(v, reflect.Value), length, options); /* */ $s = 24; case 24: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [n, err];
|
|
} else {
|
|
pos = pos + (n) >> 0;
|
|
}
|
|
_i++;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return [pos, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fields.prototype.Pack }; } $f._1 = _1; $f._i = _i; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.f = f; $f.field = field; $f.i = i; $f.length = length; $f.length$1 = length$1; $f.n = n; $f.options = options; $f.pos = pos; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Fields).prototype.Pack = function(buf, val, options) { return this.$get().Pack(buf, val, options); };
|
|
Fields.prototype.Unpack = function(r, val, options) {
|
|
var _i, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$16, _r$17, _r$18, _r$19, _r$2, _r$20, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _tuple, _tuple$1, _tuple$2, _v, buf, err, err$1, err$2, err$3, err$4, err$5, err$6, f, field, fields, fields$1, i, i$1, length, options, r, size, tmp, typ, v, v$1, val, vals, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$16 = $f._r$16; _r$17 = $f._r$17; _r$18 = $f._r$18; _r$19 = $f._r$19; _r$2 = $f._r$2; _r$20 = $f._r$20; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _v = $f._v; buf = $f.buf; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; err$3 = $f.err$3; err$4 = $f.err$4; err$5 = $f.err$5; err$6 = $f.err$6; f = $f.f; field = $f.field; fields = $f.fields; fields$1 = $f.fields$1; i = $f.i; i$1 = $f.i$1; length = $f.length; options = $f.options; r = $f.r; size = $f.size; tmp = $f.tmp; typ = $f.typ; v = $f.v; v$1 = $f.v$1; val = $f.val; vals = $f.vals; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
/* while (true) { */ case 1:
|
|
/* if (!($clone(val, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(val, reflect.Value).Kind() === 22)) { $s = 2; continue; }
|
|
_r$1 = $clone(val, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
val = _r$1;
|
|
/* } */ $s = 1; continue; case 2:
|
|
tmp = arrayType$1.zero();
|
|
buf = sliceType.nil;
|
|
_ref = f;
|
|
_i = 0;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
|
|
i = _i;
|
|
field = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
/* */ if (field === ptrType$1.nil) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (field === ptrType$1.nil) { */ case 6:
|
|
_i++;
|
|
/* continue; */ $s = 4; continue;
|
|
/* } */ case 7:
|
|
_r$2 = $clone(val, reflect.Value).Field(i); /* */ $s = 8; case 8: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
length = field.Len;
|
|
/* */ if (!(field.Sizefrom === sliceType$2.nil)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!(field.Sizefrom === sliceType$2.nil)) { */ case 9:
|
|
_r$3 = f.sizefrom($clone(val, reflect.Value), field.Sizefrom); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
length = _r$3;
|
|
/* } */ case 10:
|
|
if (!($clone(v, reflect.Value).Kind() === 22)) { _v = false; $s = 14; continue s; }
|
|
_r$4 = $clone(v, reflect.Value).Elem(); /* */ $s = 15; case 15: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = $clone(_r$4, reflect.Value).IsValid(); /* */ $s = 16; case 16: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_v = !_r$5; case 14:
|
|
/* */ if (_v) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (_v) { */ case 12:
|
|
_r$6 = $clone(v, reflect.Value).Type().Elem(); /* */ $s = 17; case 17: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$7 = reflect.New(_r$6); /* */ $s = 18; case 18: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
$r = $clone(v, reflect.Value).Set($clone(_r$7, reflect.Value)); /* */ $s = 19; case 19: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 13:
|
|
/* */ if (field.Type === 15) { $s = 20; continue; }
|
|
/* */ $s = 21; continue;
|
|
/* if (field.Type === 15) { */ case 20:
|
|
/* */ if (field.Slice) { $s = 23; continue; }
|
|
/* */ $s = 24; continue;
|
|
/* if (field.Slice) { */ case 23:
|
|
_r$8 = reflect.MakeSlice($clone(v, reflect.Value).Type(), length, length); /* */ $s = 26; case 26: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
vals = _r$8;
|
|
i$1 = 0;
|
|
/* while (true) { */ case 27:
|
|
/* if (!(i$1 < length)) { break; } */ if(!(i$1 < length)) { $s = 28; continue; }
|
|
_r$9 = $clone(vals, reflect.Value).Index(i$1); /* */ $s = 29; case 29: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
v$1 = _r$9;
|
|
_r$10 = parseFields($clone(v$1, reflect.Value)); /* */ $s = 30; case 30: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_tuple = _r$10;
|
|
fields = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r$11 = fields.Unpack(r, $clone(v$1, reflect.Value), options); /* */ $s = 31; case 31: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
err$1 = _r$11;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return err$1;
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
/* } */ $s = 27; continue; case 28:
|
|
$r = $clone(v, reflect.Value).Set($clone(vals, reflect.Value)); /* */ $s = 32; case 32: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 25; continue;
|
|
/* } else { */ case 24:
|
|
_r$12 = parseFields($clone(v, reflect.Value)); /* */ $s = 33; case 33: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$12;
|
|
fields$1 = _tuple$1[0];
|
|
err$2 = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
|
|
$s = -1; return err$2;
|
|
}
|
|
_r$13 = fields$1.Unpack(r, $clone(v, reflect.Value), options); /* */ $s = 34; case 34: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
err$3 = _r$13;
|
|
if (!($interfaceIsEqual(err$3, $ifaceNil))) {
|
|
$s = -1; return err$3;
|
|
}
|
|
/* } */ case 25:
|
|
_i++;
|
|
/* continue; */ $s = 4; continue;
|
|
$s = 22; continue;
|
|
/* } else { */ case 21:
|
|
_r$14 = new Type(field.Type).Resolve(options); /* */ $s = 35; case 35: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
typ = _r$14;
|
|
/* */ if (typ === 19) { $s = 36; continue; }
|
|
/* */ $s = 37; continue;
|
|
/* if (typ === 19) { */ case 36:
|
|
_r$15 = $clone($clone(v, reflect.Value).Addr(), reflect.Value).Interface(); /* */ $s = 39; case 39: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
|
|
_r$16 = $assertType(_r$15, Custom).Unpack(r, length, options); /* */ $s = 40; case 40: if($c) { $c = false; _r$16 = _r$16.$blk(); } if (_r$16 && _r$16.$blk !== undefined) { break s; }
|
|
err$4 = _r$16;
|
|
if (!($interfaceIsEqual(err$4, $ifaceNil))) {
|
|
$s = -1; return err$4;
|
|
}
|
|
$s = 38; continue;
|
|
/* } else { */ case 37:
|
|
_r$17 = new Type(field.Type).Resolve(options); /* */ $s = 41; case 41: if($c) { $c = false; _r$17 = _r$17.$blk(); } if (_r$17 && _r$17.$blk !== undefined) { break s; }
|
|
_r$18 = new Type(_r$17).Size(); /* */ $s = 42; case 42: if($c) { $c = false; _r$18 = _r$18.$blk(); } if (_r$18 && _r$18.$blk !== undefined) { break s; }
|
|
size = $imul(length, _r$18);
|
|
if (size < 8) {
|
|
buf = $subslice(new sliceType(tmp), 0, size);
|
|
} else {
|
|
buf = $makeSlice(sliceType, size);
|
|
}
|
|
_r$19 = io.ReadFull(r, buf); /* */ $s = 43; case 43: if($c) { $c = false; _r$19 = _r$19.$blk(); } if (_r$19 && _r$19.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$19;
|
|
err$5 = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err$5, $ifaceNil))) {
|
|
$s = -1; return err$5;
|
|
}
|
|
_r$20 = field.Unpack($subslice(buf, 0, size), $clone(v, reflect.Value), length, options); /* */ $s = 44; case 44: if($c) { $c = false; _r$20 = _r$20.$blk(); } if (_r$20 && _r$20.$blk !== undefined) { break s; }
|
|
err$6 = _r$20;
|
|
if (!($interfaceIsEqual(err$6, $ifaceNil))) {
|
|
$s = -1; return err$6;
|
|
}
|
|
/* } */ case 38:
|
|
/* } */ case 22:
|
|
_i++;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Fields.prototype.Unpack }; } $f._i = _i; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$16 = _r$16; $f._r$17 = _r$17; $f._r$18 = _r$18; $f._r$19 = _r$19; $f._r$2 = _r$2; $f._r$20 = _r$20; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._v = _v; $f.buf = buf; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.err$3 = err$3; $f.err$4 = err$4; $f.err$5 = err$5; $f.err$6 = err$6; $f.f = f; $f.field = field; $f.fields = fields; $f.fields$1 = fields$1; $f.i = i; $f.i$1 = i$1; $f.length = length; $f.options = options; $f.r = r; $f.size = size; $f.tmp = tmp; $f.typ = typ; $f.v = v; $f.v$1 = v$1; $f.val = val; $f.vals = vals; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Fields).prototype.Unpack = function(r, val, options) { return this.$get().Unpack(r, val, options); };
|
|
parseStrucTag = function(tag) {
|
|
var _i, _ref, s, t, tag, tagStr, tmp, tmp$1, x, x$1, x$2;
|
|
t = new strucTag.ptr("", (x = binary.BigEndian, new x.constructor.elem(x)), "", false, "");
|
|
tagStr = new reflect.StructTag(tag).Get("struc");
|
|
if (tagStr === "") {
|
|
tagStr = new reflect.StructTag(tag).Get("struct");
|
|
}
|
|
_ref = strings.Split(tagStr, ",");
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
s = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (strings.HasPrefix(s, "sizeof=")) {
|
|
tmp = strings.SplitN(s, "=", 2);
|
|
t.Sizeof = (1 >= tmp.$length ? ($throwRuntimeError("index out of range"), undefined) : tmp.$array[tmp.$offset + 1]);
|
|
} else if (strings.HasPrefix(s, "sizefrom=")) {
|
|
tmp$1 = strings.SplitN(s, "=", 2);
|
|
t.Sizefrom = (1 >= tmp$1.$length ? ($throwRuntimeError("index out of range"), undefined) : tmp$1.$array[tmp$1.$offset + 1]);
|
|
} else if (s === "big") {
|
|
t.Order = (x$1 = binary.BigEndian, new x$1.constructor.elem(x$1));
|
|
} else if (s === "little") {
|
|
t.Order = (x$2 = binary.LittleEndian, new x$2.constructor.elem(x$2));
|
|
} else if (s === "skip") {
|
|
t.Skip = true;
|
|
} else {
|
|
t.Type = s;
|
|
}
|
|
_i++;
|
|
}
|
|
return t;
|
|
};
|
|
parseField = function(f) {
|
|
var _1, _2, _entry, _entry$1, _r$1, _r$10, _r$11, _r$12, _r$13, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _tuple, _tuple$1, _tuple$2, _tuple$3, defTypeOk, err, f, fd, first, match, ok, ok$1, pureType, tag, tmp, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _entry = $f._entry; _entry$1 = $f._entry$1; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; defTypeOk = $f.defTypeOk; err = $f.err; f = $f.f; fd = $f.fd; first = $f.first; match = $f.match; ok = $f.ok; ok$1 = $f.ok$1; pureType = $f.pureType; tag = $f.tag; tmp = $f.tmp; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
fd = ptrType$1.nil;
|
|
tag = ptrType$2.nil;
|
|
err = $ifaceNil;
|
|
tag = parseStrucTag(f.Tag);
|
|
ok = false;
|
|
_r$1 = f.Type.Kind(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
fd = new Field.ptr(f.Name, false, 0, 0, 0, false, false, 1, tag.Order, sliceType$2.nil, sliceType$2.nil, Fields.nil, _r$1);
|
|
_1 = fd.kind;
|
|
/* */ if (_1 === (17)) { $s = 3; continue; }
|
|
/* */ if (_1 === (23)) { $s = 4; continue; }
|
|
/* */ if (_1 === (22)) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_1 === (17)) { */ case 3:
|
|
fd.Slice = true;
|
|
fd.Array = true;
|
|
_r$2 = f.Type.Len(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
fd.Len = _r$2;
|
|
_r$3 = f.Type.Elem(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_r$4 = _r$3.Kind(); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
fd.kind = _r$4;
|
|
$s = 6; continue;
|
|
/* } else if (_1 === (23)) { */ case 4:
|
|
fd.Slice = true;
|
|
fd.Len = -1;
|
|
_r$5 = f.Type.Elem(); /* */ $s = 10; case 10: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$6 = _r$5.Kind(); /* */ $s = 11; case 11: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
fd.kind = _r$6;
|
|
$s = 6; continue;
|
|
/* } else if (_1 === (22)) { */ case 5:
|
|
fd.Ptr = true;
|
|
_r$7 = f.Type.Elem(); /* */ $s = 12; case 12: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_r$8 = _r$7.Kind(); /* */ $s = 13; case 13: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
fd.kind = _r$8;
|
|
/* } */ case 6:
|
|
case 2:
|
|
tmp = reflect.New(f.Type);
|
|
_r$9 = $clone(tmp, reflect.Value).Interface(); /* */ $s = 14; case 14: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = $assertType(_r$9, Custom, true);
|
|
ok$1 = _tuple[1];
|
|
if (ok$1) {
|
|
fd.Type = 19;
|
|
$s = -1; return [fd, tag, err];
|
|
}
|
|
defTypeOk = false;
|
|
_tuple$1 = (_entry = reflectTypeMap[reflect.Kind.keyFor(fd.kind)], _entry !== undefined ? [_entry.v, true] : [0, false]);
|
|
fd.defType = _tuple$1[0];
|
|
defTypeOk = _tuple$1[1];
|
|
_r$10 = typeLenRe.ReplaceAllLiteralString(tag.Type, ""); /* */ $s = 15; case 15: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
pureType = _r$10;
|
|
_tuple$2 = (_entry$1 = typeLookup[$String.keyFor(pureType)], _entry$1 !== undefined ? [_entry$1.v, true] : [0, false]);
|
|
fd.Type = _tuple$2[0];
|
|
ok = _tuple$2[1];
|
|
/* */ if (ok) { $s = 16; continue; }
|
|
/* */ $s = 17; continue;
|
|
/* if (ok) { */ case 16:
|
|
fd.Len = 1;
|
|
_r$11 = typeLenRe.FindAllStringSubmatch(tag.Type, -1); /* */ $s = 18; case 18: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
match = _r$11;
|
|
if (match.$length > 0 && (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]).$length > 1) {
|
|
fd.Slice = true;
|
|
first = (x = (0 >= match.$length ? ($throwRuntimeError("index out of range"), undefined) : match.$array[match.$offset + 0]), (1 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 1]));
|
|
if (first === "") {
|
|
fd.Len = -1;
|
|
} else {
|
|
_tuple$3 = strconv.Atoi(first);
|
|
fd.Len = _tuple$3[0];
|
|
err = _tuple$3[1];
|
|
}
|
|
}
|
|
$s = -1; return [fd, tag, err];
|
|
/* } */ case 17:
|
|
_2 = f.Type;
|
|
/* */ if ($interfaceIsEqual(_2, (reflect.TypeOf(new Size_t(0, 0))))) { $s = 20; continue; }
|
|
/* */ if ($interfaceIsEqual(_2, (reflect.TypeOf(new Off_t(0, 0))))) { $s = 21; continue; }
|
|
/* */ if (defTypeOk) { $s = 22; continue; }
|
|
/* */ $s = 23; continue;
|
|
/* if ($interfaceIsEqual(_2, (reflect.TypeOf(new Size_t(0, 0))))) { */ case 20:
|
|
fd.Type = 17;
|
|
$s = 24; continue;
|
|
/* } else if ($interfaceIsEqual(_2, (reflect.TypeOf(new Off_t(0, 0))))) { */ case 21:
|
|
fd.Type = 18;
|
|
$s = 24; continue;
|
|
/* } else if (defTypeOk) { */ case 22:
|
|
fd.Type = fd.defType;
|
|
$s = 24; continue;
|
|
/* } else { */ case 23:
|
|
_r$12 = fmt.Sprintf("struc: Could not resolve field '%v' type '%v'.", new sliceType$1([new $String(f.Name), f.Type])); /* */ $s = 25; case 25: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_r$13 = errors.New(_r$12); /* */ $s = 26; case 26: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
err = _r$13;
|
|
/* } */ case 24:
|
|
case 19:
|
|
$s = -1; return [fd, tag, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parseField }; } $f._1 = _1; $f._2 = _2; $f._entry = _entry; $f._entry$1 = _entry$1; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.defTypeOk = defTypeOk; $f.err = err; $f.f = f; $f.fd = fd; $f.first = first; $f.match = match; $f.ok = ok; $f.ok$1 = ok$1; $f.pureType = pureType; $f.tag = tag; $f.tmp = tmp; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseFieldsLocked = function(v) {
|
|
var _entry, _key, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, err, f, field, fields, i, ok, ok$1, ok$2, sizefrom, sizeofMap, source, t, tag, target, typ, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _key = $f._key; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; err = $f.err; f = $f.f; field = $f.field; fields = $f.fields; i = $f.i; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; sizefrom = $f.sizefrom; sizeofMap = $f.sizeofMap; source = $f.source; t = $f.t; tag = $f.tag; target = $f.target; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* while (true) { */ case 1:
|
|
/* if (!($clone(v, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(v, reflect.Value).Kind() === 22)) { $s = 2; continue; }
|
|
_r$1 = $clone(v, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v = _r$1;
|
|
/* } */ $s = 1; continue; case 2:
|
|
t = $clone(v, reflect.Value).Type();
|
|
if ($clone(v, reflect.Value).NumField() < 1) {
|
|
$s = -1; return [Fields.nil, errors.New("struc: Struct has no fields.")];
|
|
}
|
|
sizeofMap = {};
|
|
fields = $makeSlice(Fields, $clone(v, reflect.Value).NumField());
|
|
i = 0;
|
|
/* while (true) { */ case 4:
|
|
_r$2 = t.NumField(); /* */ $s = 6; case 6: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
/* if (!(i < _r$2)) { break; } */ if(!(i < _r$2)) { $s = 5; continue; }
|
|
_r$3 = t.Field(i); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
field = $clone(_r$3, reflect.StructField);
|
|
_r$4 = parseField($clone(field, reflect.StructField)); /* */ $s = 8; case 8: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple = _r$4;
|
|
f = _tuple[0];
|
|
tag = _tuple[1];
|
|
err = _tuple[2];
|
|
/* */ if (tag.Skip) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (tag.Skip) { */ case 9:
|
|
i = i + (1) >> 0;
|
|
/* continue; */ $s = 4; continue;
|
|
/* } */ case 10:
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [Fields.nil, err];
|
|
}
|
|
_r$5 = $clone(v, reflect.Value).Field(i); /* */ $s = 13; case 13: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$6 = $clone(_r$5, reflect.Value).CanSet(); /* */ $s = 14; case 14: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$6) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (!_r$6) { */ case 11:
|
|
i = i + (1) >> 0;
|
|
/* continue; */ $s = 4; continue;
|
|
/* } */ case 12:
|
|
f.Index = i;
|
|
/* */ if (!(tag.Sizeof === "")) { $s = 15; continue; }
|
|
/* */ $s = 16; continue;
|
|
/* if (!(tag.Sizeof === "")) { */ case 15:
|
|
_r$7 = t.FieldByName(tag.Sizeof); /* */ $s = 17; case 17: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$7;
|
|
target = $clone(_tuple$1[0], reflect.StructField);
|
|
ok = _tuple$1[1];
|
|
/* */ if (!ok) { $s = 18; continue; }
|
|
/* */ $s = 19; continue;
|
|
/* if (!ok) { */ case 18:
|
|
_r$8 = fmt.Errorf("struc: `sizeof=%s` field does not exist", new sliceType$1([new $String(tag.Sizeof)])); /* */ $s = 20; case 20: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
$s = -1; return [Fields.nil, _r$8];
|
|
/* } */ case 19:
|
|
f.Sizeof = target.Index;
|
|
_key = tag.Sizeof; (sizeofMap || $throwRuntimeError("assignment to entry in nil map"))[$String.keyFor(_key)] = { k: _key, v: field.Index };
|
|
/* } */ case 16:
|
|
_tuple$2 = (_entry = sizeofMap[$String.keyFor(field.Name)], _entry !== undefined ? [_entry.v, true] : [sliceType$2.nil, false]);
|
|
sizefrom = _tuple$2[0];
|
|
ok$1 = _tuple$2[1];
|
|
if (ok$1) {
|
|
f.Sizefrom = sizefrom;
|
|
}
|
|
/* */ if (!(tag.Sizefrom === "")) { $s = 21; continue; }
|
|
/* */ $s = 22; continue;
|
|
/* if (!(tag.Sizefrom === "")) { */ case 21:
|
|
_r$9 = t.FieldByName(tag.Sizefrom); /* */ $s = 23; case 23: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$9;
|
|
source = $clone(_tuple$3[0], reflect.StructField);
|
|
ok$2 = _tuple$3[1];
|
|
/* */ if (!ok$2) { $s = 24; continue; }
|
|
/* */ $s = 25; continue;
|
|
/* if (!ok$2) { */ case 24:
|
|
_r$10 = fmt.Errorf("struc: `sizefrom=%s` field does not exist", new sliceType$1([new $String(tag.Sizefrom)])); /* */ $s = 26; case 26: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
$s = -1; return [Fields.nil, _r$10];
|
|
/* } */ case 25:
|
|
f.Sizefrom = source.Index;
|
|
/* } */ case 22:
|
|
/* */ if ((f.Len === -1) && f.Sizefrom === sliceType$2.nil) { $s = 27; continue; }
|
|
/* */ $s = 28; continue;
|
|
/* if ((f.Len === -1) && f.Sizefrom === sliceType$2.nil) { */ case 27:
|
|
_r$11 = fmt.Errorf("struc: field `%s` is a slice with no length or sizeof field", new sliceType$1([new $String(field.Name)])); /* */ $s = 29; case 29: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
$s = -1; return [Fields.nil, _r$11];
|
|
/* } */ case 28:
|
|
/* */ if (f.Type === 15) { $s = 30; continue; }
|
|
/* */ $s = 31; continue;
|
|
/* if (f.Type === 15) { */ case 30:
|
|
typ = field.Type;
|
|
/* */ if (f.Ptr) { $s = 32; continue; }
|
|
/* */ $s = 33; continue;
|
|
/* if (f.Ptr) { */ case 32:
|
|
_r$12 = typ.Elem(); /* */ $s = 34; case 34: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
typ = _r$12;
|
|
/* } */ case 33:
|
|
/* */ if (f.Slice) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if (f.Slice) { */ case 35:
|
|
_r$13 = typ.Elem(); /* */ $s = 37; case 37: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
typ = _r$13;
|
|
/* } */ case 36:
|
|
_r$14 = parseFieldsLocked($clone(reflect.New(typ), reflect.Value)); /* */ $s = 38; case 38: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$14;
|
|
f.Fields = _tuple$4[0];
|
|
err = _tuple$4[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [Fields.nil, err];
|
|
}
|
|
/* } */ case 31:
|
|
((i < 0 || i >= fields.$length) ? ($throwRuntimeError("index out of range"), undefined) : fields.$array[fields.$offset + i] = f);
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return [fields, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parseFieldsLocked }; } $f._entry = _entry; $f._key = _key; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.err = err; $f.f = f; $f.field = field; $f.fields = fields; $f.i = i; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.sizefrom = sizefrom; $f.sizeofMap = sizeofMap; $f.source = source; $f.t = t; $f.tag = tag; $f.target = target; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
fieldCacheLookup = function(t) {
|
|
var _entry, _tuple, cached, ok, t, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _tuple = $f._tuple; cached = $f.cached; ok = $f.ok; t = $f.t; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
$r = fieldCacheLock.RLock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(fieldCacheLock, "RUnlock"), []]);
|
|
_tuple = (_entry = fieldCache[reflect.Type.keyFor(t)], _entry !== undefined ? [_entry.v, true] : [Fields.nil, false]);
|
|
cached = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
$s = -1; return cached;
|
|
}
|
|
$s = -1; return Fields.nil;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return Fields.nil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: fieldCacheLookup }; } $f._entry = _entry; $f._tuple = _tuple; $f.cached = cached; $f.ok = ok; $f.t = t; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
parseFields = function(v) {
|
|
var _key, _r$1, _r$2, _r$3, _r$4, _tuple, cached, cached$1, err, fields, t, v, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _key = $f._key; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; cached = $f.cached; cached$1 = $f.cached$1; err = $f.err; fields = $f.fields; t = $f.t; v = $f.v; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
/* while (true) { */ case 1:
|
|
/* if (!($clone(v, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(v, reflect.Value).Kind() === 22)) { $s = 2; continue; }
|
|
_r$1 = $clone(v, reflect.Value).Elem(); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v = _r$1;
|
|
/* } */ $s = 1; continue; case 2:
|
|
t = $clone(v, reflect.Value).Type();
|
|
_r$2 = fieldCacheLookup(t); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
cached = _r$2;
|
|
if (!(cached === Fields.nil)) {
|
|
$s = -1; return [cached, $ifaceNil];
|
|
}
|
|
$r = parseLock.Lock(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(parseLock, "Unlock"), []]);
|
|
_r$3 = fieldCacheLookup(t); /* */ $s = 6; case 6: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
cached$1 = _r$3;
|
|
if (!(cached$1 === Fields.nil)) {
|
|
$s = -1; return [cached$1, $ifaceNil];
|
|
}
|
|
_r$4 = parseFieldsLocked($clone(v, reflect.Value)); /* */ $s = 7; case 7: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple = _r$4;
|
|
fields = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [Fields.nil, err];
|
|
}
|
|
$r = fieldCacheLock.Lock(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_key = t; (fieldCache || $throwRuntimeError("assignment to entry in nil map"))[reflect.Type.keyFor(_key)] = { k: _key, v: fields };
|
|
$r = fieldCacheLock.Unlock(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return [fields, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [Fields.nil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: parseFields }; } $f._key = _key; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f.cached = cached; $f.cached$1 = cached$1; $f.err = err; $f.fields = fields; $f.t = t; $f.v = v; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Options.ptr.prototype.Validate = function() {
|
|
var _1, _r$1, o, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r$1 = $f._r$1; o = $f.o; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
o = this;
|
|
/* */ if (o.PtrSize === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (o.PtrSize === 0) { */ case 1:
|
|
o.PtrSize = 32;
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
_1 = o.PtrSize;
|
|
/* */ if ((_1 === (8)) || (_1 === (16)) || (_1 === (32)) || (_1 === (64))) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if ((_1 === (8)) || (_1 === (16)) || (_1 === (32)) || (_1 === (64))) { */ case 5:
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
_r$1 = fmt.Errorf("Invalid Options.PtrSize: %d. Must be in (8, 16, 32, 64)", new sliceType$1([new $Int(o.PtrSize)])); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* } */ case 7:
|
|
case 4:
|
|
/* } */ case 3:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Options.ptr.prototype.Validate }; } $f._1 = _1; $f._r$1 = _r$1; $f.o = o; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Options.prototype.Validate = function() { return this.$val.Validate(); };
|
|
init = function() {
|
|
var _r$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$1 = emptyOptions.Validate(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: init }; } $f._r$1 = _r$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
prep = function(data) {
|
|
var _1, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _tuple, _tuple$1, c, data, err, fields, next, ok, value, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; c = $f.c; data = $f.data; err = $f.err; fields = $f.fields; next = $f.next; ok = $f.ok; value = $f.value; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$1 = reflect.ValueOf(data); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
value = _r$1;
|
|
/* while (true) { */ case 2:
|
|
/* if (!($clone(value, reflect.Value).Kind() === 22)) { break; } */ if(!($clone(value, reflect.Value).Kind() === 22)) { $s = 3; continue; }
|
|
_r$2 = $clone(value, reflect.Value).Elem(); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$3 = $clone(_r$2, reflect.Value).Kind(); /* */ $s = 5; case 5: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
next = _r$3;
|
|
/* */ if ((next === 25) || (next === 22)) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if ((next === 25) || (next === 22)) { */ case 6:
|
|
_r$4 = $clone(value, reflect.Value).Elem(); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
value = _r$4;
|
|
$s = 8; continue;
|
|
/* } else { */ case 7:
|
|
/* break; */ $s = 3; continue;
|
|
/* } */ case 8:
|
|
/* } */ $s = 2; continue; case 3:
|
|
_1 = $clone(value, reflect.Value).Kind();
|
|
/* */ if (_1 === (25)) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (_1 === (25)) { */ case 11:
|
|
_r$5 = parseFields($clone(value, reflect.Value)); /* */ $s = 14; case 14: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_tuple = _r$5;
|
|
fields = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [value, fields, err];
|
|
/* } else { */ case 12:
|
|
/* */ if (!$clone(value, reflect.Value).IsValid()) { $s = 15; continue; }
|
|
/* */ $s = 16; continue;
|
|
/* if (!$clone(value, reflect.Value).IsValid()) { */ case 15:
|
|
_r$6 = fmt.Errorf("Invalid reflect.Value for %+v", new sliceType$1([data])); /* */ $s = 17; case 17: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
$s = -1; return [new reflect.Value.ptr(ptrType.nil, 0, 0), $ifaceNil, _r$6];
|
|
/* } */ case 16:
|
|
_tuple$1 = $assertType(data, Custom, true);
|
|
c = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
if (ok) {
|
|
$s = -1; return [value, (x = new customFallback.ptr(c), new x.constructor.elem(x)), $ifaceNil];
|
|
}
|
|
$s = -1; return [value, (x$1 = ($clone(value, binaryFallback)), new x$1.constructor.elem(x$1)), $ifaceNil];
|
|
/* } */ case 13:
|
|
case 10:
|
|
$s = -1; return [new reflect.Value.ptr(ptrType.nil, 0, 0), $ifaceNil, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: prep }; } $f._1 = _1; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.c = c; $f.data = data; $f.err = err; $f.fields = fields; $f.next = next; $f.ok = ok; $f.value = value; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Unpack = function(r, data) {
|
|
var _r$1, data, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; data = $f.data; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$1 = UnpackWithOptions(r, data, ptrType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Unpack }; } $f._r$1 = _r$1; $f.data = data; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Unpack = Unpack;
|
|
UnpackWithOptions = function(r, data, options) {
|
|
var _r$1, _r$2, _r$3, _tuple, data, err, err$1, options, packer, r, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tuple = $f._tuple; data = $f.data; err = $f.err; err$1 = $f.err$1; options = $f.options; packer = $f.packer; r = $f.r; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (options === ptrType$3.nil) {
|
|
options = emptyOptions;
|
|
}
|
|
_r$1 = options.Validate(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err = _r$1;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
_r$2 = prep(data); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple = _r$2;
|
|
val = _tuple[0];
|
|
packer = _tuple[1];
|
|
err$1 = _tuple[2];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return err$1;
|
|
}
|
|
_r$3 = packer.Unpack(r, $clone(val, reflect.Value), options); /* */ $s = 3; case 3: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$3;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: UnpackWithOptions }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tuple = _tuple; $f.data = data; $f.err = err; $f.err$1 = err$1; $f.options = options; $f.packer = packer; $f.r = r; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.UnpackWithOptions = UnpackWithOptions;
|
|
Type.prototype.Resolve = function(options) {
|
|
var _1, _2, _3, _r$1, _r$2, options, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _r$1 = $f._r$1; _r$2 = $f._r$2; options = $f.options; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
t = this.$val;
|
|
_1 = t;
|
|
/* */ if (_1 === (18)) { $s = 2; continue; }
|
|
/* */ if (_1 === (17)) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (_1 === (18)) { */ case 2:
|
|
_2 = options.PtrSize;
|
|
/* */ if (_2 === (8)) { $s = 6; continue; }
|
|
/* */ if (_2 === (16)) { $s = 7; continue; }
|
|
/* */ if (_2 === (32)) { $s = 8; continue; }
|
|
/* */ if (_2 === (64)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (_2 === (8)) { */ case 6:
|
|
$s = -1; return 4;
|
|
/* } else if (_2 === (16)) { */ case 7:
|
|
$s = -1; return 6;
|
|
/* } else if (_2 === (32)) { */ case 8:
|
|
$s = -1; return 8;
|
|
/* } else if (_2 === (64)) { */ case 9:
|
|
$s = -1; return 10;
|
|
/* } else { */ case 10:
|
|
_r$1 = fmt.Sprintf("unsupported ptr bits: %d", new sliceType$1([new $Int(options.PtrSize)])); /* */ $s = 12; case 12: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$1));
|
|
/* } */ case 11:
|
|
case 5:
|
|
$s = 4; continue;
|
|
/* } else if (_1 === (17)) { */ case 3:
|
|
_3 = options.PtrSize;
|
|
/* */ if (_3 === (8)) { $s = 14; continue; }
|
|
/* */ if (_3 === (16)) { $s = 15; continue; }
|
|
/* */ if (_3 === (32)) { $s = 16; continue; }
|
|
/* */ if (_3 === (64)) { $s = 17; continue; }
|
|
/* */ $s = 18; continue;
|
|
/* if (_3 === (8)) { */ case 14:
|
|
$s = -1; return 5;
|
|
/* } else if (_3 === (16)) { */ case 15:
|
|
$s = -1; return 7;
|
|
/* } else if (_3 === (32)) { */ case 16:
|
|
$s = -1; return 9;
|
|
/* } else if (_3 === (64)) { */ case 17:
|
|
$s = -1; return 11;
|
|
/* } else { */ case 18:
|
|
_r$2 = fmt.Sprintf("unsupported ptr bits: %d", new sliceType$1([new $Int(options.PtrSize)])); /* */ $s = 20; case 20: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$2));
|
|
/* } */ case 19:
|
|
case 13:
|
|
/* } */ case 4:
|
|
case 1:
|
|
$s = -1; return t;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Type.prototype.Resolve }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.options = options; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Type).prototype.Resolve = function(options) { return new Type(this.$get()).Resolve(options); };
|
|
Type.prototype.String = function() {
|
|
var _entry, t;
|
|
t = this.$val;
|
|
return (_entry = typeNames[Type.keyFor(t)], _entry !== undefined ? _entry.v : "");
|
|
};
|
|
$ptrType(Type).prototype.String = function() { return new Type(this.$get()).String(); };
|
|
Type.prototype.Size = function() {
|
|
var _1, t;
|
|
t = this.$val;
|
|
_1 = t;
|
|
if ((_1 === (17)) || (_1 === (18))) {
|
|
$panic(new $String("Size_t/Off_t types must be converted to another type using options.PtrSize"));
|
|
} else if ((_1 === (1)) || (_1 === (14)) || (_1 === (4)) || (_1 === (5)) || (_1 === (2))) {
|
|
return 1;
|
|
} else if ((_1 === (6)) || (_1 === (7))) {
|
|
return 2;
|
|
} else if ((_1 === (8)) || (_1 === (9)) || (_1 === (12))) {
|
|
return 4;
|
|
} else if ((_1 === (10)) || (_1 === (11)) || (_1 === (13))) {
|
|
return 8;
|
|
} else {
|
|
$panic(new $String("Cannot resolve size of type:" + new Type(t).String()));
|
|
}
|
|
};
|
|
$ptrType(Type).prototype.Size = function() { return new Type(this.$get()).Size(); };
|
|
init$1 = function() {
|
|
var _entry, _i, _key, _keys, _ref, enum$1, name;
|
|
_ref = typeLookup;
|
|
_i = 0;
|
|
_keys = $keys(_ref);
|
|
while (true) {
|
|
if (!(_i < _keys.length)) { break; }
|
|
_entry = _ref[_keys[_i]];
|
|
if (_entry === undefined) {
|
|
_i++;
|
|
continue;
|
|
}
|
|
name = _entry.k;
|
|
enum$1 = _entry.v;
|
|
_key = enum$1; (typeNames || $throwRuntimeError("assignment to entry in nil map"))[Type.keyFor(_key)] = { k: _key, v: name };
|
|
_i++;
|
|
}
|
|
};
|
|
byteWriter.methods = [{prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType], [$Int, $error], false)}];
|
|
binaryFallback.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Sizeof", name: "Sizeof", pkg: "", typ: $funcType([reflect.Value, ptrType$3], [$Int], false)}, {prop: "Pack", name: "Pack", pkg: "", typ: $funcType([sliceType, reflect.Value, ptrType$3], [$Int, $error], false)}, {prop: "Unpack", name: "Unpack", pkg: "", typ: $funcType([io.Reader, reflect.Value, ptrType$3], [$error], false)}];
|
|
customFallback.methods = [{prop: "Pack", name: "Pack", pkg: "", typ: $funcType([sliceType, reflect.Value, ptrType$3], [$Int, $error], false)}, {prop: "Unpack", name: "Unpack", pkg: "", typ: $funcType([io.Reader, reflect.Value, ptrType$3], [$error], false)}, {prop: "Sizeof", name: "Sizeof", pkg: "", typ: $funcType([reflect.Value, ptrType$3], [$Int], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$1.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([reflect.Value, ptrType$3], [$Int], false)}, {prop: "packVal", name: "packVal", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", typ: $funcType([sliceType, reflect.Value, $Int, ptrType$3], [$Int, $error], false)}, {prop: "Pack", name: "Pack", pkg: "", typ: $funcType([sliceType, reflect.Value, $Int, ptrType$3], [$Int, $error], false)}, {prop: "unpackVal", name: "unpackVal", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", typ: $funcType([sliceType, reflect.Value, $Int, ptrType$3], [$error], false)}, {prop: "Unpack", name: "Unpack", pkg: "", typ: $funcType([sliceType, reflect.Value, $Int, ptrType$3], [$error], false)}];
|
|
Fields.methods = [{prop: "SetByteOrder", name: "SetByteOrder", pkg: "", typ: $funcType([binary.ByteOrder], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Sizeof", name: "Sizeof", pkg: "", typ: $funcType([reflect.Value, ptrType$3], [$Int], false)}, {prop: "sizefrom", name: "sizefrom", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", typ: $funcType([reflect.Value, sliceType$2], [$Int], false)}, {prop: "Pack", name: "Pack", pkg: "", typ: $funcType([sliceType, reflect.Value, ptrType$3], [$Int, $error], false)}, {prop: "Unpack", name: "Unpack", pkg: "", typ: $funcType([io.Reader, reflect.Value, ptrType$3], [$error], false)}];
|
|
ptrType$3.methods = [{prop: "Validate", name: "Validate", pkg: "", typ: $funcType([], [$error], false)}];
|
|
Type.methods = [{prop: "Resolve", name: "Resolve", pkg: "", typ: $funcType([ptrType$3], [Type], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int], false)}];
|
|
byteWriter.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", [{prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType, tag: ""}, {prop: "pos", name: "pos", embedded: false, exported: false, typ: $Int, tag: ""}]);
|
|
binaryFallback.init("reflect", [{prop: "typ", name: "typ", embedded: false, exported: false, typ: ptrType, tag: ""}, {prop: "ptr", name: "ptr", embedded: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "flag", name: "flag", embedded: true, exported: false, typ: reflect.flag, tag: ""}]);
|
|
Custom.init([{prop: "Pack", name: "Pack", pkg: "", typ: $funcType([sliceType, ptrType$3], [$Int, $error], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([ptrType$3], [$Int], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Unpack", name: "Unpack", pkg: "", typ: $funcType([io.Reader, $Int, ptrType$3], [$error], false)}]);
|
|
customFallback.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", [{prop: "custom", name: "custom", embedded: false, exported: false, typ: Custom, tag: ""}]);
|
|
Field.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc", [{prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Ptr", name: "Ptr", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "Index", name: "Index", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Type", name: "Type", embedded: false, exported: true, typ: Type, tag: ""}, {prop: "defType", name: "defType", embedded: false, exported: false, typ: Type, tag: ""}, {prop: "Array", name: "Array", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "Slice", name: "Slice", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "Len", name: "Len", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Order", name: "Order", embedded: false, exported: true, typ: binary.ByteOrder, tag: ""}, {prop: "Sizeof", name: "Sizeof", embedded: false, exported: true, typ: sliceType$2, tag: ""}, {prop: "Sizefrom", name: "Sizefrom", embedded: false, exported: true, typ: sliceType$2, tag: ""}, {prop: "Fields", name: "Fields", embedded: false, exported: true, typ: Fields, tag: ""}, {prop: "kind", name: "kind", embedded: false, exported: false, typ: reflect.Kind, tag: ""}]);
|
|
Fields.init(ptrType$1);
|
|
strucTag.init("", [{prop: "Type", name: "Type", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Order", name: "Order", embedded: false, exported: true, typ: binary.ByteOrder, tag: ""}, {prop: "Sizeof", name: "Sizeof", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Skip", name: "Skip", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "Sizefrom", name: "Sizefrom", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
Options.init("", [{prop: "ByteAlign", name: "ByteAlign", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "PtrSize", name: "PtrSize", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Order", name: "Order", embedded: false, exported: true, typ: binary.ByteOrder, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = bytes.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = binary.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = errors.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmt.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = reflect.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = regexp.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strings.$init(); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
fieldCacheLock = new sync.RWMutex.ptr(new sync.Mutex.ptr(0, 0), 0, 0, 0, 0);
|
|
parseLock = new sync.Mutex.ptr(0, 0);
|
|
_r = regexp.MustCompile("^\\[(\\d*)\\]"); /* */ $s = 12; case 12: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
typeLenRe = _r;
|
|
fieldCache = {};
|
|
emptyOptions = new Options.ptr(0, 0, $ifaceNil);
|
|
typeLookup = $makeMap($String.keyFor, [{ k: "pad", v: 1 }, { k: "bool", v: 2 }, { k: "byte", v: 5 }, { k: "int8", v: 4 }, { k: "uint8", v: 5 }, { k: "int16", v: 6 }, { k: "uint16", v: 7 }, { k: "int32", v: 8 }, { k: "uint32", v: 9 }, { k: "int64", v: 10 }, { k: "uint64", v: 11 }, { k: "float32", v: 12 }, { k: "float64", v: 13 }, { k: "size_t", v: 17 }, { k: "off_t", v: 18 }]);
|
|
typeNames = $makeMap(Type.keyFor, [{ k: 19, v: "Custom" }]);
|
|
reflectTypeMap = $makeMap(reflect.Kind.keyFor, [{ k: 1, v: 2 }, { k: 3, v: 4 }, { k: 4, v: 6 }, { k: 2, v: 8 }, { k: 5, v: 8 }, { k: 6, v: 10 }, { k: 8, v: 5 }, { k: 9, v: 7 }, { k: 7, v: 9 }, { k: 10, v: 9 }, { k: 11, v: 11 }, { k: 13, v: 12 }, { k: 14, v: 13 }, { k: 24, v: 14 }, { k: 25, v: 15 }, { k: 22, v: 16 }]);
|
|
$r = init(); /* */ $s = 13; case 13: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
init$1();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/proto"] = (function() {
|
|
var $pkg = {}, $init, bytes, struc, io, WebsocketLength, WebsocketConnectionRequest, sliceType, ptrType, ReadRequest;
|
|
bytes = $packages["bytes"];
|
|
struc = $packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/lunixbochs/struc"];
|
|
io = $packages["io"];
|
|
WebsocketLength = $pkg.WebsocketLength = $newType(0, $kindStruct, "proto.WebsocketLength", true, "github.com/xiaokangwang/BrowserBridge/proto", true, function(Length_, Data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Length = 0;
|
|
this.Data = sliceType.nil;
|
|
return;
|
|
}
|
|
this.Length = Length_;
|
|
this.Data = Data_;
|
|
});
|
|
WebsocketConnectionRequest = $pkg.WebsocketConnectionRequest = $newType(0, $kindStruct, "proto.WebsocketConnectionRequest", true, "github.com/xiaokangwang/BrowserBridge/proto", true, function(DestinationSize_, Destination_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.DestinationSize = 0;
|
|
this.Destination = "";
|
|
return;
|
|
}
|
|
this.DestinationSize = DestinationSize_;
|
|
this.Destination = Destination_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
ptrType = $ptrType(WebsocketConnectionRequest);
|
|
ReadRequest = function(reader) {
|
|
var Request, _r, _r$1, data, err, reader, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; Request = $f.Request; _r = $f._r; _r$1 = $f._r$1; data = $f.data; err = $f.err; reader = $f.reader; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
Request = [Request];
|
|
data = [data];
|
|
err = $ifaceNil;
|
|
data[0] = new WebsocketLength.ptr(0, sliceType.nil);
|
|
_r = struc.Unpack(reader, data[0]); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [err, ptrType.nil];
|
|
}
|
|
Request[0] = new WebsocketConnectionRequest.ptr(0, "");
|
|
_r$1 = struc.Unpack(bytes.NewReader(data[0].Data), Request[0]); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err = _r$1;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [err, ptrType.nil];
|
|
}
|
|
$s = -1; return [$ifaceNil, Request[0]];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: ReadRequest }; } $f.Request = Request; $f._r = _r; $f._r$1 = _r$1; $f.data = data; $f.err = err; $f.reader = reader; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.ReadRequest = ReadRequest;
|
|
WebsocketLength.init("", [{prop: "Length", name: "Length", embedded: false, exported: true, typ: $Uint32, tag: "struc:\"uint32,big,sizeof=Data\""}, {prop: "Data", name: "Data", embedded: false, exported: true, typ: sliceType, tag: ""}]);
|
|
WebsocketConnectionRequest.init("", [{prop: "DestinationSize", name: "DestinationSize", embedded: false, exported: true, typ: $Uint32, tag: "struc:\"uint32,big,sizeof=Destination\""}, {prop: "Destination", name: "Destination", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = bytes.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = struc.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket/websocketjs"] = (function() {
|
|
var $pkg = {}, $init, js, ReadyState, WebSocket, ptrType, ptrType$1, ptrType$2, funcType, New;
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
ReadyState = $pkg.ReadyState = $newType(2, $kindUint16, "websocketjs.ReadyState", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket/websocketjs", true, null);
|
|
WebSocket = $pkg.WebSocket = $newType(0, $kindStruct, "websocketjs.WebSocket", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket/websocketjs", true, function(Object_, URL_, ReadyState_, BufferedAmount_, Extensions_, Protocol_, BinaryType_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Object = null;
|
|
this.URL = "";
|
|
this.ReadyState = 0;
|
|
this.BufferedAmount = 0;
|
|
this.Extensions = "";
|
|
this.Protocol = "";
|
|
this.BinaryType = "";
|
|
return;
|
|
}
|
|
this.Object = Object_;
|
|
this.URL = URL_;
|
|
this.ReadyState = ReadyState_;
|
|
this.BufferedAmount = BufferedAmount_;
|
|
this.Extensions = Extensions_;
|
|
this.Protocol = Protocol_;
|
|
this.BinaryType = BinaryType_;
|
|
});
|
|
ptrType = $ptrType(WebSocket);
|
|
ptrType$1 = $ptrType(js.Error);
|
|
ptrType$2 = $ptrType(js.Object);
|
|
funcType = $funcType([ptrType$2], [], false);
|
|
ReadyState.prototype.String = function() {
|
|
var _1, rs;
|
|
rs = this.$val;
|
|
_1 = rs;
|
|
if (_1 === (0)) {
|
|
return "Connecting";
|
|
} else if (_1 === (1)) {
|
|
return "Open";
|
|
} else if (_1 === (2)) {
|
|
return "Closing";
|
|
} else if (_1 === (3)) {
|
|
return "Closed";
|
|
} else {
|
|
return "Unknown";
|
|
}
|
|
};
|
|
$ptrType(ReadyState).prototype.String = function() { return new ReadyState(this.$get()).String(); };
|
|
New = function(url) {
|
|
var err, object, url, ws, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
ws = ptrType.nil;
|
|
err = $ifaceNil;
|
|
$deferred.push([(function() {
|
|
var _tuple, e, jsErr, ok;
|
|
e = $recover();
|
|
if ($interfaceIsEqual(e, $ifaceNil)) {
|
|
return;
|
|
}
|
|
_tuple = $assertType(e, ptrType$1, true);
|
|
jsErr = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok && !(jsErr === ptrType$1.nil)) {
|
|
ws = ptrType.nil;
|
|
err = jsErr;
|
|
} else {
|
|
$panic(e);
|
|
}
|
|
}), []]);
|
|
object = new ($global.WebSocket)($externalize(url, $String));
|
|
ws = new WebSocket.ptr(object, "", 0, 0, "", "", "");
|
|
return [ws, err];
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [ws, err]; } }
|
|
};
|
|
$pkg.New = New;
|
|
WebSocket.ptr.prototype.AddEventListener = function(typ, useCapture, listener) {
|
|
var listener, typ, useCapture, ws;
|
|
ws = this;
|
|
ws.Object.addEventListener($externalize(typ, $String), $externalize(listener, funcType), $externalize(useCapture, $Bool));
|
|
};
|
|
WebSocket.prototype.AddEventListener = function(typ, useCapture, listener) { return this.$val.AddEventListener(typ, useCapture, listener); };
|
|
WebSocket.ptr.prototype.RemoveEventListener = function(typ, useCapture, listener) {
|
|
var listener, typ, useCapture, ws;
|
|
ws = this;
|
|
ws.Object.removeEventListener($externalize(typ, $String), $externalize(listener, funcType), $externalize(useCapture, $Bool));
|
|
};
|
|
WebSocket.prototype.RemoveEventListener = function(typ, useCapture, listener) { return this.$val.RemoveEventListener(typ, useCapture, listener); };
|
|
WebSocket.ptr.prototype.Send = function(data) {
|
|
var data, err, ws, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
err = $ifaceNil;
|
|
ws = this;
|
|
$deferred.push([(function() {
|
|
var _tuple, e, jsErr, ok;
|
|
e = $recover();
|
|
if ($interfaceIsEqual(e, $ifaceNil)) {
|
|
return;
|
|
}
|
|
_tuple = $assertType(e, ptrType$1, true);
|
|
jsErr = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok && !(jsErr === ptrType$1.nil)) {
|
|
err = jsErr;
|
|
} else {
|
|
$panic(e);
|
|
}
|
|
}), []]);
|
|
ws.Object.send($externalize(data, $emptyInterface));
|
|
return err;
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return err; } }
|
|
};
|
|
WebSocket.prototype.Send = function(data) { return this.$val.Send(data); };
|
|
WebSocket.ptr.prototype.Close = function() {
|
|
var err, ws, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
err = $ifaceNil;
|
|
ws = this;
|
|
$deferred.push([(function() {
|
|
var _tuple, e, jsErr, ok;
|
|
e = $recover();
|
|
if ($interfaceIsEqual(e, $ifaceNil)) {
|
|
return;
|
|
}
|
|
_tuple = $assertType(e, ptrType$1, true);
|
|
jsErr = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok && !(jsErr === ptrType$1.nil)) {
|
|
err = jsErr;
|
|
} else {
|
|
$panic(e);
|
|
}
|
|
}), []]);
|
|
ws.Object.close(1000);
|
|
return err;
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return err; } }
|
|
};
|
|
WebSocket.prototype.Close = function() { return this.$val.Close(); };
|
|
ReadyState.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType.methods = [{prop: "AddEventListener", name: "AddEventListener", pkg: "", typ: $funcType([$String, $Bool, funcType], [], false)}, {prop: "RemoveEventListener", name: "RemoveEventListener", pkg: "", typ: $funcType([$String, $Bool, funcType], [], false)}, {prop: "Send", name: "Send", pkg: "", typ: $funcType([$emptyInterface], [$error], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}];
|
|
WebSocket.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType$2, tag: ""}, {prop: "URL", name: "URL", embedded: false, exported: true, typ: $String, tag: "js:\"url\""}, {prop: "ReadyState", name: "ReadyState", embedded: false, exported: true, typ: ReadyState, tag: "js:\"readyState\""}, {prop: "BufferedAmount", name: "BufferedAmount", embedded: false, exported: true, typ: $Uint32, tag: "js:\"bufferedAmount\""}, {prop: "Extensions", name: "Extensions", embedded: false, exported: true, typ: $String, tag: "js:\"extensions\""}, {prop: "Protocol", name: "Protocol", embedded: false, exported: true, typ: $String, tag: "js:\"protocol\""}, {prop: "BinaryType", name: "BinaryType", embedded: false, exported: true, typ: $String, tag: "js:\"binaryType\""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["context"] = (function() {
|
|
var $pkg = {}, $init, errors, fmt, reflect, sync, time, emptyCtx, ptrType, structType, ptrType$1, chanType, background, todo, closedchan, init;
|
|
errors = $packages["errors"];
|
|
fmt = $packages["fmt"];
|
|
reflect = $packages["reflect"];
|
|
sync = $packages["sync"];
|
|
time = $packages["time"];
|
|
emptyCtx = $pkg.emptyCtx = $newType(4, $kindInt, "context.emptyCtx", true, "context", false, null);
|
|
ptrType = $ptrType(emptyCtx);
|
|
structType = $structType("", []);
|
|
ptrType$1 = $ptrType(time.Location);
|
|
chanType = $chanType(structType, false, true);
|
|
$ptrType(emptyCtx).prototype.Deadline = function() {
|
|
var deadline, ok;
|
|
deadline = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$1.nil);
|
|
ok = false;
|
|
return [deadline, ok];
|
|
};
|
|
$ptrType(emptyCtx).prototype.Done = function() {
|
|
return $chanNil;
|
|
};
|
|
$ptrType(emptyCtx).prototype.Err = function() {
|
|
return $ifaceNil;
|
|
};
|
|
$ptrType(emptyCtx).prototype.Value = function(key) {
|
|
var key;
|
|
return $ifaceNil;
|
|
};
|
|
$ptrType(emptyCtx).prototype.String = function() {
|
|
var _1, e;
|
|
e = this;
|
|
_1 = e;
|
|
if (_1 === (background)) {
|
|
return "context.Background";
|
|
} else if (_1 === (todo)) {
|
|
return "context.TODO";
|
|
}
|
|
return "unknown empty Context";
|
|
};
|
|
init = function() {
|
|
$close(closedchan);
|
|
};
|
|
ptrType.methods = [{prop: "Deadline", name: "Deadline", pkg: "", typ: $funcType([], [time.Time, $Bool], false)}, {prop: "Done", name: "Done", pkg: "", typ: $funcType([], [chanType], false)}, {prop: "Err", name: "Err", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Value", name: "Value", pkg: "", typ: $funcType([$emptyInterface], [$emptyInterface], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmt.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = reflect.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.Canceled = errors.New("context canceled");
|
|
background = $newDataPointer(0, ptrType);
|
|
todo = $newDataPointer(0, ptrType);
|
|
closedchan = new $Chan(structType, 0);
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/nettrace"] = (function() {
|
|
var $pkg = {}, $init;
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/singleflight"] = (function() {
|
|
var $pkg = {}, $init, sync;
|
|
sync = $packages["sync"];
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = sync.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["internal/x/net/dns/dnsmessage"] = (function() {
|
|
var $pkg = {}, $init, errors, errBaseLen, errCalcLen, errReserved, errTooManyPtr, errInvalidPtr, errNilResouceBody, errResourceLen, errSegTooLong, errZeroSegLen, errResTooLong, errTooManyQuestions, errTooManyAnswers, errTooManyAuthorities, errTooManyAdditionals, errNonCanonicalName, errStringTooLong, errCompressedSRV;
|
|
errors = $packages["errors"];
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$pkg.ErrNotStarted = errors.New("parsing/packing of this type isn't available yet");
|
|
$pkg.ErrSectionDone = errors.New("parsing/packing of this section has completed");
|
|
errBaseLen = errors.New("insufficient data for base length type");
|
|
errCalcLen = errors.New("insufficient data for calculated length type");
|
|
errReserved = errors.New("segment prefix is reserved");
|
|
errTooManyPtr = errors.New("too many pointers (>10)");
|
|
errInvalidPtr = errors.New("invalid pointer");
|
|
errNilResouceBody = errors.New("nil resource body");
|
|
errResourceLen = errors.New("insufficient data for resource body length");
|
|
errSegTooLong = errors.New("segment length too long");
|
|
errZeroSegLen = errors.New("zero length segment");
|
|
errResTooLong = errors.New("resource length too long");
|
|
errTooManyQuestions = errors.New("too many Questions to pack (>65535)");
|
|
errTooManyAnswers = errors.New("too many Answers to pack (>65535)");
|
|
errTooManyAuthorities = errors.New("too many Authorities to pack (>65535)");
|
|
errTooManyAdditionals = errors.New("too many Additionals to pack (>65535)");
|
|
errNonCanonicalName = errors.New("name is not in canonical format (it must end with a .)");
|
|
errStringTooLong = errors.New("character string exceeds maximum length (255)");
|
|
errCompressedSRV = errors.New("compressed name in SRV resource data");
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["math/rand"] = (function() {
|
|
var $pkg = {}, $init, nosync, math, Source, Source64, Rand, lockedSource, rngSource, arrayType, ptrType, ptrType$1, sliceType, ptrType$2, ptrType$3, funcType, sliceType$1, ptrType$5, ke, we, fe, kn, wn, fn, globalRand, rngCooked, absInt32, NewSource, New, read, seedrand;
|
|
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
|
|
math = $packages["math"];
|
|
Source = $pkg.Source = $newType(8, $kindInterface, "rand.Source", true, "math/rand", true, null);
|
|
Source64 = $pkg.Source64 = $newType(8, $kindInterface, "rand.Source64", true, "math/rand", true, null);
|
|
Rand = $pkg.Rand = $newType(0, $kindStruct, "rand.Rand", true, "math/rand", true, function(src_, s64_, readVal_, readPos_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.src = $ifaceNil;
|
|
this.s64 = $ifaceNil;
|
|
this.readVal = new $Int64(0, 0);
|
|
this.readPos = 0;
|
|
return;
|
|
}
|
|
this.src = src_;
|
|
this.s64 = s64_;
|
|
this.readVal = readVal_;
|
|
this.readPos = readPos_;
|
|
});
|
|
lockedSource = $pkg.lockedSource = $newType(0, $kindStruct, "rand.lockedSource", true, "math/rand", false, function(lk_, src_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.lk = new nosync.Mutex.ptr(false);
|
|
this.src = $ifaceNil;
|
|
return;
|
|
}
|
|
this.lk = lk_;
|
|
this.src = src_;
|
|
});
|
|
rngSource = $pkg.rngSource = $newType(0, $kindStruct, "rand.rngSource", true, "math/rand", false, function(tap_, feed_, vec_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.tap = 0;
|
|
this.feed = 0;
|
|
this.vec = arrayType.zero();
|
|
return;
|
|
}
|
|
this.tap = tap_;
|
|
this.feed = feed_;
|
|
this.vec = vec_;
|
|
});
|
|
arrayType = $arrayType($Int64, 607);
|
|
ptrType = $ptrType(lockedSource);
|
|
ptrType$1 = $ptrType($Int8);
|
|
sliceType = $sliceType($Int);
|
|
ptrType$2 = $ptrType($Int64);
|
|
ptrType$3 = $ptrType(Rand);
|
|
funcType = $funcType([$Int, $Int], [], false);
|
|
sliceType$1 = $sliceType($Uint8);
|
|
ptrType$5 = $ptrType(rngSource);
|
|
Rand.ptr.prototype.ExpFloat64 = function() {
|
|
var _r, _r$1, _r$2, _r$3, i, j, r, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; i = $f.i; j = $f.j; r = $f.r; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
/* while (true) { */ case 1:
|
|
_r = r.Uint32(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
j = _r;
|
|
i = (j & 255) >>> 0;
|
|
x = (j) * (((i < 0 || i >= we.length) ? ($throwRuntimeError("index out of range"), undefined) : we[i]));
|
|
if (j < ((i < 0 || i >= ke.length) ? ($throwRuntimeError("index out of range"), undefined) : ke[i])) {
|
|
$s = -1; return x;
|
|
}
|
|
/* */ if (i === 0) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (i === 0) { */ case 4:
|
|
_r$1 = r.Float64(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = math.Log(_r$1); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return 7.69711747013105 - _r$2;
|
|
/* } */ case 5:
|
|
_r$3 = r.Float64(); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
/* */ if ($fround(((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]) + $fround(($fround(_r$3)) * ($fround((x$1 = i - 1 >>> 0, ((x$1 < 0 || x$1 >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[x$1])) - ((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]))))) < ($fround(math.Exp(-x)))) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if ($fround(((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]) + $fround(($fround(_r$3)) * ($fround((x$1 = i - 1 >>> 0, ((x$1 < 0 || x$1 >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[x$1])) - ((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]))))) < ($fround(math.Exp(-x)))) { */ case 8:
|
|
$s = -1; return x;
|
|
/* } */ case 9:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.ExpFloat64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f.i = i; $f.j = j; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.ExpFloat64 = function() { return this.$val.ExpFloat64(); };
|
|
absInt32 = function(i) {
|
|
var i;
|
|
if (i < 0) {
|
|
return ((-i >>> 0));
|
|
}
|
|
return ((i >>> 0));
|
|
};
|
|
Rand.ptr.prototype.NormFloat64 = function() {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, _r$5, i, j, r, x, x$1, y, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; i = $f.i; j = $f.j; r = $f.r; x = $f.x; x$1 = $f.x$1; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
/* while (true) { */ case 1:
|
|
_r = r.Uint32(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
j = ((_r >> 0));
|
|
i = j & 127;
|
|
x = (j) * (((i < 0 || i >= wn.length) ? ($throwRuntimeError("index out of range"), undefined) : wn[i]));
|
|
if (absInt32(j) < ((i < 0 || i >= kn.length) ? ($throwRuntimeError("index out of range"), undefined) : kn[i])) {
|
|
$s = -1; return x;
|
|
}
|
|
/* */ if (i === 0) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (i === 0) { */ case 4:
|
|
/* while (true) { */ case 6:
|
|
_r$1 = r.Float64(); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = math.Log(_r$1); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
x = -_r$2 * 0.29047645161474317;
|
|
_r$3 = r.Float64(); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_r$4 = math.Log(_r$3); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
y = -_r$4;
|
|
if (y + y >= x * x) {
|
|
/* break; */ $s = 7; continue;
|
|
}
|
|
/* } */ $s = 6; continue; case 7:
|
|
if (j > 0) {
|
|
$s = -1; return 3.442619855899 + x;
|
|
}
|
|
$s = -1; return -3.442619855899 - x;
|
|
/* } */ case 5:
|
|
_r$5 = r.Float64(); /* */ $s = 14; case 14: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
/* */ if ($fround(((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]) + $fround(($fround(_r$5)) * ($fround((x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[x$1])) - ((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]))))) < ($fround(math.Exp(-0.5 * x * x)))) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if ($fround(((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]) + $fround(($fround(_r$5)) * ($fround((x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[x$1])) - ((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]))))) < ($fround(math.Exp(-0.5 * x * x)))) { */ case 12:
|
|
$s = -1; return x;
|
|
/* } */ case 13:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return 0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.NormFloat64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f.i = i; $f.j = j; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.NormFloat64 = function() { return this.$val.NormFloat64(); };
|
|
NewSource = function(seed) {
|
|
var rng, seed;
|
|
rng = new rngSource.ptr(0, 0, arrayType.zero());
|
|
rng.Seed(seed);
|
|
return rng;
|
|
};
|
|
$pkg.NewSource = NewSource;
|
|
New = function(src) {
|
|
var _tuple, s64, src;
|
|
_tuple = $assertType(src, Source64, true);
|
|
s64 = _tuple[0];
|
|
return new Rand.ptr(src, s64, new $Int64(0, 0), 0);
|
|
};
|
|
$pkg.New = New;
|
|
Rand.ptr.prototype.Seed = function(seed) {
|
|
var _tuple, lk, ok, r, seed, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; lk = $f.lk; ok = $f.ok; r = $f.r; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_tuple = $assertType(r.src, ptrType, true);
|
|
lk = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
$r = lk.seedPos(seed, (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 2:
|
|
$r = r.src.Seed(seed); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
r.readPos = 0;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Seed }; } $f._tuple = _tuple; $f.lk = lk; $f.ok = ok; $f.r = r; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
|
|
Rand.ptr.prototype.Int63 = function() {
|
|
var _r, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.src.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int63 }; } $f._r = _r; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Int63 = function() { return this.$val.Int63(); };
|
|
Rand.ptr.prototype.Uint32 = function() {
|
|
var _r, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (($shiftRightInt64(_r, 31).$low >>> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Uint32 }; } $f._r = _r; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Uint32 = function() { return this.$val.Uint32(); };
|
|
Rand.ptr.prototype.Uint64 = function() {
|
|
var _r, _r$1, _r$2, r, x, x$1, x$2, x$3, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; r = $f.r; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
/* */ if (!($interfaceIsEqual(r.s64, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(r.s64, $ifaceNil))) { */ case 1:
|
|
_r = r.s64.Uint64(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
_r$1 = r.Int63(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = r.Int63(); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return (x = $shiftRightUint64(((x$1 = _r$1, new $Uint64(x$1.$high, x$1.$low))), 31), x$2 = $shiftLeft64(((x$3 = _r$2, new $Uint64(x$3.$high, x$3.$low))), 32), new $Uint64(x.$high | x$2.$high, (x.$low | x$2.$low) >>> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Uint64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Uint64 = function() { return this.$val.Uint64(); };
|
|
Rand.ptr.prototype.Int31 = function() {
|
|
var _r, r, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (((x = $shiftRightInt64(_r, 32), x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int31 }; } $f._r = _r; $f.r = r; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Int31 = function() { return this.$val.Int31(); };
|
|
Rand.ptr.prototype.Int = function() {
|
|
var _r, r, u, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; u = $f.u; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
u = ((_r.$low >>> 0));
|
|
$s = -1; return ((((u << 1 >>> 0) >>> 1 >>> 0) >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int }; } $f._r = _r; $f.r = r; $f.u = u; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Int = function() { return this.$val.Int(); };
|
|
Rand.ptr.prototype.Int63n = function(n) {
|
|
var _r, _r$1, _r$2, max, n, r, v, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; max = $f.max; n = $f.n; r = $f.r; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
if ((n.$high < 0 || (n.$high === 0 && n.$low <= 0))) {
|
|
$panic(new $String("invalid argument to Int63n"));
|
|
}
|
|
/* */ if ((x = (x$1 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(n.$high & x$1.$high, (n.$low & x$1.$low) >>> 0)), (x.$high === 0 && x.$low === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((x = (x$1 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(n.$high & x$1.$high, (n.$low & x$1.$low) >>> 0)), (x.$high === 0 && x.$low === 0))) { */ case 1:
|
|
_r = r.Int63(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return (x$2 = _r, x$3 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0));
|
|
/* } */ case 2:
|
|
max = ((x$4 = (x$5 = $div64(new $Uint64(2147483648, 0), (new $Uint64(n.$high, n.$low)), true), new $Uint64(2147483647 - x$5.$high, 4294967295 - x$5.$low)), new $Int64(x$4.$high, x$4.$low)));
|
|
_r$1 = r.Int63(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
v = _r$1;
|
|
/* while (true) { */ case 5:
|
|
/* if (!((v.$high > max.$high || (v.$high === max.$high && v.$low > max.$low)))) { break; } */ if(!((v.$high > max.$high || (v.$high === max.$high && v.$low > max.$low)))) { $s = 6; continue; }
|
|
_r$2 = r.Int63(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
/* } */ $s = 5; continue; case 6:
|
|
$s = -1; return $div64(v, n, true);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int63n }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.max = max; $f.n = n; $f.r = r; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Int63n = function(n) { return this.$val.Int63n(n); };
|
|
Rand.ptr.prototype.Int31n = function(n) {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, max, n, r, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; max = $f.max; n = $f.n; r = $f.r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
if (n <= 0) {
|
|
$panic(new $String("invalid argument to Int31n"));
|
|
}
|
|
/* */ if ((n & ((n - 1 >> 0))) === 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((n & ((n - 1 >> 0))) === 0) { */ case 1:
|
|
_r = r.Int31(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r & ((n - 1 >> 0));
|
|
/* } */ case 2:
|
|
max = (((2147483647 - (_r$1 = 2147483648 % ((n >>> 0)), _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) >>> 0) >> 0));
|
|
_r$2 = r.Int31(); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
/* while (true) { */ case 5:
|
|
/* if (!(v > max)) { break; } */ if(!(v > max)) { $s = 6; continue; }
|
|
_r$3 = r.Int31(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
v = _r$3;
|
|
/* } */ $s = 5; continue; case 6:
|
|
$s = -1; return (_r$4 = v % n, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero"));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int31n }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.max = max; $f.n = n; $f.r = r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Int31n = function(n) { return this.$val.Int31n(n); };
|
|
Rand.ptr.prototype.int31n = function(n) {
|
|
var _r, _r$1, _r$2, low, n, prod, r, thresh, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; low = $f.low; n = $f.n; prod = $f.prod; r = $f.r; thresh = $f.thresh; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
_r = r.Uint32(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
v = _r;
|
|
prod = $mul64((new $Uint64(0, v)), (new $Uint64(0, n)));
|
|
low = ((prod.$low >>> 0));
|
|
/* */ if (low < ((n >>> 0))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (low < ((n >>> 0))) { */ case 2:
|
|
thresh = (_r$1 = ((-n >>> 0)) % ((n >>> 0)), _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero"));
|
|
/* while (true) { */ case 4:
|
|
/* if (!(low < thresh)) { break; } */ if(!(low < thresh)) { $s = 5; continue; }
|
|
_r$2 = r.Uint32(); /* */ $s = 6; case 6: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
v = _r$2;
|
|
prod = $mul64((new $Uint64(0, v)), (new $Uint64(0, n)));
|
|
low = ((prod.$low >>> 0));
|
|
/* } */ $s = 4; continue; case 5:
|
|
/* } */ case 3:
|
|
$s = -1; return (($shiftRightUint64(prod, 32).$low >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.int31n }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.low = low; $f.n = n; $f.prod = prod; $f.r = r; $f.thresh = thresh; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.int31n = function(n) { return this.$val.int31n(n); };
|
|
Rand.ptr.prototype.Intn = function(n) {
|
|
var _r, _r$1, n, r, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; n = $f.n; r = $f.r; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
if (n <= 0) {
|
|
$panic(new $String("invalid argument to Intn"));
|
|
}
|
|
/* */ if (n <= 2147483647) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (n <= 2147483647) { */ case 1:
|
|
_r = r.Int31n(((n >> 0))); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ((_r >> 0));
|
|
/* } */ case 2:
|
|
_r$1 = r.Int63n((new $Int64(0, n))); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return (((x = _r$1, x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Intn }; } $f._r = _r; $f._r$1 = _r$1; $f.n = n; $f.r = r; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Intn = function(n) { return this.$val.Intn(n); };
|
|
Rand.ptr.prototype.Float64 = function() {
|
|
var _r, f, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
/* again: */ case 1:
|
|
_r = r.Int63(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
f = ($flatten64(_r)) / 9.223372036854776e+18;
|
|
/* */ if (f === 1) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (f === 1) { */ case 3:
|
|
/* goto again */ $s = 1; continue;
|
|
/* } */ case 4:
|
|
$s = -1; return f;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Float64 }; } $f._r = _r; $f.f = f; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Float64 = function() { return this.$val.Float64(); };
|
|
Rand.ptr.prototype.Float32 = function() {
|
|
var _r, f, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
/* again: */ case 1:
|
|
_r = r.Float64(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
f = ($fround(_r));
|
|
/* */ if (f === 1) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (f === 1) { */ case 3:
|
|
/* goto again */ $s = 1; continue;
|
|
/* } */ case 4:
|
|
$s = -1; return f;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Float32 }; } $f._r = _r; $f.f = f; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Float32 = function() { return this.$val.Float32(); };
|
|
Rand.ptr.prototype.Perm = function(n) {
|
|
var _r, i, j, m, n, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; j = $f.j; m = $f.m; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
m = $makeSlice(sliceType, n);
|
|
i = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 2; continue; }
|
|
_r = r.Intn(i + 1 >> 0); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
j = _r;
|
|
((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i] = ((j < 0 || j >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + j]));
|
|
((j < 0 || j >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + j] = i);
|
|
i = i + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return m;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Perm }; } $f._r = _r; $f.i = i; $f.j = j; $f.m = m; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Perm = function(n) { return this.$val.Perm(n); };
|
|
Rand.ptr.prototype.Shuffle = function(n, swap) {
|
|
var _r, _r$1, i, j, j$1, n, r, swap, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; i = $f.i; j = $f.j; j$1 = $f.j$1; n = $f.n; r = $f.r; swap = $f.swap; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
if (n < 0) {
|
|
$panic(new $String("invalid argument to Shuffle"));
|
|
}
|
|
i = n - 1 >> 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(i > 2147483646)) { break; } */ if(!(i > 2147483646)) { $s = 2; continue; }
|
|
_r = r.Int63n((new $Int64(0, (i + 1 >> 0)))); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
j = (((x = _r, x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
|
|
$r = swap(i, j); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i - (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
/* while (true) { */ case 5:
|
|
/* if (!(i > 0)) { break; } */ if(!(i > 0)) { $s = 6; continue; }
|
|
_r$1 = r.int31n((((i + 1 >> 0) >> 0))); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
j$1 = ((_r$1 >> 0));
|
|
$r = swap(i, j$1); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = i - (1) >> 0;
|
|
/* } */ $s = 5; continue; case 6:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Shuffle }; } $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.j = j; $f.j$1 = j$1; $f.n = n; $f.r = r; $f.swap = swap; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Shuffle = function(n, swap) { return this.$val.Shuffle(n, swap); };
|
|
Rand.ptr.prototype.Read = function(p) {
|
|
var _r, _r$1, _tuple, _tuple$1, _tuple$2, err, lk, n, ok, p, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; err = $f.err; lk = $f.lk; n = $f.n; ok = $f.ok; p = $f.p; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
r = this;
|
|
_tuple = $assertType(r.src, ptrType, true);
|
|
lk = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = lk.read(p, (r.$ptr_readVal || (r.$ptr_readVal = new ptrType$2(function() { return this.$target.readVal; }, function($v) { this.$target.readVal = $v; }, r))), (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
n = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
$s = -1; return [n, err];
|
|
/* } */ case 2:
|
|
_r$1 = read(p, $methodVal(r, "Int63"), (r.$ptr_readVal || (r.$ptr_readVal = new ptrType$2(function() { return this.$target.readVal; }, function($v) { this.$target.readVal = $v; }, r))), (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$1;
|
|
n = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Read }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.err = err; $f.lk = lk; $f.n = n; $f.ok = ok; $f.p = p; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Rand.prototype.Read = function(p) { return this.$val.Read(p); };
|
|
read = function(p, int63, readVal, readPos) {
|
|
var _r, err, int63, n, p, pos, readPos, readVal, val, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; int63 = $f.int63; n = $f.n; p = $f.p; pos = $f.pos; readPos = $f.readPos; readVal = $f.readVal; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
pos = readPos.$get();
|
|
val = readVal.$get();
|
|
n = 0;
|
|
/* while (true) { */ case 1:
|
|
/* if (!(n < p.$length)) { break; } */ if(!(n < p.$length)) { $s = 2; continue; }
|
|
/* */ if (pos === 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (pos === 0) { */ case 3:
|
|
_r = int63(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
val = _r;
|
|
pos = 7;
|
|
/* } */ case 4:
|
|
((n < 0 || n >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + n] = ((val.$low << 24 >>> 24)));
|
|
val = $shiftRightInt64(val, (8));
|
|
pos = pos - (1) << 24 >> 24;
|
|
n = n + (1) >> 0;
|
|
/* } */ $s = 1; continue; case 2:
|
|
readPos.$set(pos);
|
|
readVal.$set(val);
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: read }; } $f._r = _r; $f.err = err; $f.int63 = int63; $f.n = n; $f.p = p; $f.pos = pos; $f.readPos = readPos; $f.readVal = readVal; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.ptr.prototype.Int63 = function() {
|
|
var _r, n, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = new $Int64(0, 0);
|
|
r = this;
|
|
r.lk.Lock();
|
|
_r = r.src.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r;
|
|
r.lk.Unlock();
|
|
$s = -1; return n;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Int63 }; } $f._r = _r; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.prototype.Int63 = function() { return this.$val.Int63(); };
|
|
lockedSource.ptr.prototype.Uint64 = function() {
|
|
var _r, n, r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = new $Uint64(0, 0);
|
|
r = this;
|
|
r.lk.Lock();
|
|
_r = r.src.Uint64(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r;
|
|
r.lk.Unlock();
|
|
$s = -1; return n;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Uint64 }; } $f._r = _r; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.prototype.Uint64 = function() { return this.$val.Uint64(); };
|
|
lockedSource.ptr.prototype.Seed = function(seed) {
|
|
var r, seed, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
r.lk.Lock();
|
|
$r = r.src.Seed(seed); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
r.lk.Unlock();
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Seed }; } $f.r = r; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
|
|
lockedSource.ptr.prototype.seedPos = function(seed, readPos) {
|
|
var r, readPos, seed, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; readPos = $f.readPos; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
r = this;
|
|
r.lk.Lock();
|
|
$r = r.src.Seed(seed); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
readPos.$set(0);
|
|
r.lk.Unlock();
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.seedPos }; } $f.r = r; $f.readPos = readPos; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.prototype.seedPos = function(seed, readPos) { return this.$val.seedPos(seed, readPos); };
|
|
lockedSource.ptr.prototype.read = function(p, readVal, readPos) {
|
|
var _r, _tuple, err, n, p, r, readPos, readVal, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; n = $f.n; p = $f.p; r = $f.r; readPos = $f.readPos; readVal = $f.readVal; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
r = this;
|
|
r.lk.Lock();
|
|
_r = read(p, $methodVal(r.src, "Int63"), readVal, readPos); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
r.lk.Unlock();
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.read }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.n = n; $f.p = p; $f.r = r; $f.readPos = readPos; $f.readVal = readVal; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
lockedSource.prototype.read = function(p, readVal, readPos) { return this.$val.read(p, readVal, readPos); };
|
|
seedrand = function(x) {
|
|
var _q, _r, hi, lo, x;
|
|
hi = (_q = x / 44488, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
lo = (_r = x % 44488, _r === _r ? _r : $throwRuntimeError("integer divide by zero"));
|
|
x = ($imul(48271, lo)) - ($imul(3399, hi)) >> 0;
|
|
if (x < 0) {
|
|
x = x + (2147483647) >> 0;
|
|
}
|
|
return x;
|
|
};
|
|
rngSource.ptr.prototype.Seed = function(seed) {
|
|
var i, rng, seed, u, x, x$1, x$2, x$3, x$4, x$5;
|
|
rng = this;
|
|
rng.tap = 0;
|
|
rng.feed = 334;
|
|
seed = $div64(seed, new $Int64(0, 2147483647), true);
|
|
if ((seed.$high < 0 || (seed.$high === 0 && seed.$low < 0))) {
|
|
seed = (x = new $Int64(0, 2147483647), new $Int64(seed.$high + x.$high, seed.$low + x.$low));
|
|
}
|
|
if ((seed.$high === 0 && seed.$low === 0)) {
|
|
seed = new $Int64(0, 89482311);
|
|
}
|
|
x$1 = (((seed.$low + ((seed.$high >> 31) * 4294967296)) >> 0));
|
|
i = -20;
|
|
while (true) {
|
|
if (!(i < 607)) { break; }
|
|
x$1 = seedrand(x$1);
|
|
if (i >= 0) {
|
|
u = new $Int64(0, 0);
|
|
u = $shiftLeft64((new $Int64(0, x$1)), 40);
|
|
x$1 = seedrand(x$1);
|
|
u = (x$2 = $shiftLeft64((new $Int64(0, x$1)), 20), new $Int64(u.$high ^ x$2.$high, (u.$low ^ x$2.$low) >>> 0));
|
|
x$1 = seedrand(x$1);
|
|
u = (x$3 = (new $Int64(0, x$1)), new $Int64(u.$high ^ x$3.$high, (u.$low ^ x$3.$low) >>> 0));
|
|
u = (x$4 = ((i < 0 || i >= rngCooked.length) ? ($throwRuntimeError("index out of range"), undefined) : rngCooked[i]), new $Int64(u.$high ^ x$4.$high, (u.$low ^ x$4.$low) >>> 0));
|
|
(x$5 = rng.vec, ((i < 0 || i >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i] = u));
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
};
|
|
rngSource.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
|
|
rngSource.ptr.prototype.Int63 = function() {
|
|
var rng, x, x$1;
|
|
rng = this;
|
|
return ((x = (x$1 = rng.Uint64(), new $Uint64(x$1.$high & 2147483647, (x$1.$low & 4294967295) >>> 0)), new $Int64(x.$high, x.$low)));
|
|
};
|
|
rngSource.prototype.Int63 = function() { return this.$val.Int63(); };
|
|
rngSource.ptr.prototype.Uint64 = function() {
|
|
var rng, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
|
|
rng = this;
|
|
rng.tap = rng.tap - (1) >> 0;
|
|
if (rng.tap < 0) {
|
|
rng.tap = rng.tap + (607) >> 0;
|
|
}
|
|
rng.feed = rng.feed - (1) >> 0;
|
|
if (rng.feed < 0) {
|
|
rng.feed = rng.feed + (607) >> 0;
|
|
}
|
|
x$6 = (x = (x$1 = rng.vec, x$2 = rng.feed, ((x$2 < 0 || x$2 >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[x$2])), x$3 = (x$4 = rng.vec, x$5 = rng.tap, ((x$5 < 0 || x$5 >= x$4.length) ? ($throwRuntimeError("index out of range"), undefined) : x$4[x$5])), new $Int64(x.$high + x$3.$high, x.$low + x$3.$low));
|
|
(x$7 = rng.vec, x$8 = rng.feed, ((x$8 < 0 || x$8 >= x$7.length) ? ($throwRuntimeError("index out of range"), undefined) : x$7[x$8] = x$6));
|
|
return (new $Uint64(x$6.$high, x$6.$low));
|
|
};
|
|
rngSource.prototype.Uint64 = function() { return this.$val.Uint64(); };
|
|
ptrType$3.methods = [{prop: "ExpFloat64", name: "ExpFloat64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "NormFloat64", name: "NormFloat64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint32", name: "Uint32", pkg: "", typ: $funcType([], [$Uint32], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Int31", name: "Int31", pkg: "", typ: $funcType([], [$Int32], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Int63n", name: "Int63n", pkg: "", typ: $funcType([$Int64], [$Int64], false)}, {prop: "Int31n", name: "Int31n", pkg: "", typ: $funcType([$Int32], [$Int32], false)}, {prop: "int31n", name: "int31n", pkg: "math/rand", typ: $funcType([$Int32], [$Int32], false)}, {prop: "Intn", name: "Intn", pkg: "", typ: $funcType([$Int], [$Int], false)}, {prop: "Float64", name: "Float64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Float32", name: "Float32", pkg: "", typ: $funcType([], [$Float32], false)}, {prop: "Perm", name: "Perm", pkg: "", typ: $funcType([$Int], [sliceType], false)}, {prop: "Shuffle", name: "Shuffle", pkg: "", typ: $funcType([$Int, funcType], [], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}];
|
|
ptrType.methods = [{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "seedPos", name: "seedPos", pkg: "math/rand", typ: $funcType([$Int64, ptrType$1], [], false)}, {prop: "read", name: "read", pkg: "math/rand", typ: $funcType([sliceType$1, ptrType$2, ptrType$1], [$Int, $error], false)}];
|
|
ptrType$5.methods = [{prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}];
|
|
Source.init([{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}]);
|
|
Source64.init([{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}]);
|
|
Rand.init("math/rand", [{prop: "src", name: "src", embedded: false, exported: false, typ: Source, tag: ""}, {prop: "s64", name: "s64", embedded: false, exported: false, typ: Source64, tag: ""}, {prop: "readVal", name: "readVal", embedded: false, exported: false, typ: $Int64, tag: ""}, {prop: "readPos", name: "readPos", embedded: false, exported: false, typ: $Int8, tag: ""}]);
|
|
lockedSource.init("math/rand", [{prop: "lk", name: "lk", embedded: false, exported: false, typ: nosync.Mutex, tag: ""}, {prop: "src", name: "src", embedded: false, exported: false, typ: Source64, tag: ""}]);
|
|
rngSource.init("math/rand", [{prop: "tap", name: "tap", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "feed", name: "feed", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "vec", name: "vec", embedded: false, exported: false, typ: arrayType, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = nosync.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
ke = $toNativeArray($kindUint32, [3801129273, 0, 2615860924, 3279400049, 3571300752, 3733536696, 3836274812, 3906990442, 3958562475, 3997804264, 4028649213, 4053523342, 4074002619, 4091154507, 4105727352, 4118261130, 4129155133, 4138710916, 4147160435, 4154685009, 4161428406, 4167506077, 4173011791, 4178022498, 4182601930, 4186803325, 4190671498, 4194244443, 4197554582, 4200629752, 4203493986, 4206168142, 4208670408, 4211016720, 4213221098, 4215295924, 4217252177, 4219099625, 4220846988, 4222502074, 4224071896, 4225562770, 4226980400, 4228329951, 4229616109, 4230843138, 4232014925, 4233135020, 4234206673, 4235232866, 4236216336, 4237159604, 4238064994, 4238934652, 4239770563, 4240574564, 4241348362, 4242093539, 4242811568, 4243503822, 4244171579, 4244816032, 4245438297, 4246039419, 4246620374, 4247182079, 4247725394, 4248251127, 4248760037, 4249252839, 4249730206, 4250192773, 4250641138, 4251075867, 4251497493, 4251906522, 4252303431, 4252688672, 4253062674, 4253425844, 4253778565, 4254121205, 4254454110, 4254777611, 4255092022, 4255397640, 4255694750, 4255983622, 4256264513, 4256537670, 4256803325, 4257061702, 4257313014, 4257557464, 4257795244, 4258026541, 4258251531, 4258470383, 4258683258, 4258890309, 4259091685, 4259287526, 4259477966, 4259663135, 4259843154, 4260018142, 4260188212, 4260353470, 4260514019, 4260669958, 4260821380, 4260968374, 4261111028, 4261249421, 4261383632, 4261513736, 4261639802, 4261761900, 4261880092, 4261994441, 4262105003, 4262211835, 4262314988, 4262414513, 4262510454, 4262602857, 4262691764, 4262777212, 4262859239, 4262937878, 4263013162, 4263085118, 4263153776, 4263219158, 4263281289, 4263340187, 4263395872, 4263448358, 4263497660, 4263543789, 4263586755, 4263626565, 4263663224, 4263696735, 4263727099, 4263754314, 4263778377, 4263799282, 4263817020, 4263831582, 4263842955, 4263851124, 4263856071, 4263857776, 4263856218, 4263851370, 4263843206, 4263831695, 4263816804, 4263798497, 4263776735, 4263751476, 4263722676, 4263690284, 4263654251, 4263614520, 4263571032, 4263523724, 4263472530, 4263417377, 4263358192, 4263294892, 4263227394, 4263155608, 4263079437, 4262998781, 4262913534, 4262823581, 4262728804, 4262629075, 4262524261, 4262414220, 4262298801, 4262177846, 4262051187, 4261918645, 4261780032, 4261635148, 4261483780, 4261325704, 4261160681, 4260988457, 4260808763, 4260621313, 4260425802, 4260221905, 4260009277, 4259787550, 4259556329, 4259315195, 4259063697, 4258801357, 4258527656, 4258242044, 4257943926, 4257632664, 4257307571, 4256967906, 4256612870, 4256241598, 4255853155, 4255446525, 4255020608, 4254574202, 4254106002, 4253614578, 4253098370, 4252555662, 4251984571, 4251383021, 4250748722, 4250079132, 4249371435, 4248622490, 4247828790, 4246986404, 4246090910, 4245137315, 4244119963, 4243032411, 4241867296, 4240616155, 4239269214, 4237815118, 4236240596, 4234530035, 4232664930, 4230623176, 4228378137, 4225897409, 4223141146, 4220059768, 4216590757, 4212654085, 4208145538, 4202926710, 4196809522, 4189531420, 4180713890, 4169789475, 4155865042, 4137444620, 4111806704, 4073393724, 4008685917, 3873074895]);
|
|
we = $toNativeArray($kindFloat32, [2.0249555365836613e-09, 1.4866739783681027e-11, 2.4409616689036184e-11, 3.1968806074589295e-11, 3.844677007314168e-11, 4.42282044321729e-11, 4.951644302919611e-11, 5.443358958023836e-11, 5.905943789574764e-11, 6.34494193296753e-11, 6.764381416113352e-11, 7.167294535648239e-11, 7.556032188826833e-11, 7.932458162551725e-11, 8.298078890689453e-11, 8.654132271912474e-11, 9.001651507523079e-11, 9.341507428706208e-11, 9.674443190998971e-11, 1.0001099254308699e-10, 1.0322031424037093e-10, 1.0637725422757427e-10, 1.0948611461891744e-10, 1.1255067711157807e-10, 1.1557434870246297e-10, 1.1856014781042035e-10, 1.2151082917633005e-10, 1.2442885610752796e-10, 1.2731647680563896e-10, 1.3017574518325858e-10, 1.330085347417409e-10, 1.3581656632677408e-10, 1.386014220061682e-10, 1.413645728254309e-10, 1.4410737880776736e-10, 1.4683107507629245e-10, 1.4953686899854546e-10, 1.522258291641876e-10, 1.5489899640730442e-10, 1.575573282952547e-10, 1.6020171300645814e-10, 1.628330109637588e-10, 1.6545202707884954e-10, 1.68059510752272e-10, 1.7065616975120435e-10, 1.73242697965037e-10, 1.758197337720091e-10, 1.783878739169964e-10, 1.8094774290045024e-10, 1.834998542005195e-10, 1.8604476292871652e-10, 1.8858298256319017e-10, 1.9111498494872592e-10, 1.9364125580789704e-10, 1.9616222535212557e-10, 1.9867835154840918e-10, 2.011900368525943e-10, 2.0369768372052732e-10, 2.062016807302669e-10, 2.0870240258208383e-10, 2.1120022397624894e-10, 2.136955057352452e-10, 2.1618855317040442e-10, 2.1867974098199738e-10, 2.2116936060356807e-10, 2.2365774510202385e-10, 2.2614519978869652e-10, 2.2863201609713002e-10, 2.3111849933865614e-10, 2.3360494094681883e-10, 2.3609159072179864e-10, 2.3857874009713953e-10, 2.4106666662859766e-10, 2.4355562011635357e-10, 2.460458781161634e-10, 2.485376904282077e-10, 2.5103127909709144e-10, 2.5352694943414633e-10, 2.560248957284017e-10, 2.585253955356137e-10, 2.610286709003873e-10, 2.6353494386732734e-10, 2.6604446423661443e-10, 2.6855745405285347e-10, 2.71074163116225e-10, 2.7359478571575835e-10, 2.7611959940720965e-10, 2.786487707240326e-10, 2.8118254946640775e-10, 2.8372118543451563e-10, 2.8626484516180994e-10, 2.8881380620404684e-10, 2.9136826285025563e-10, 2.9392840938946563e-10, 2.96494523377433e-10, 2.990667713476114e-10, 3.016454031001814e-10, 3.042306406797479e-10, 3.068226783753403e-10, 3.09421765987139e-10, 3.12028125559749e-10, 3.1464195138219964e-10, 3.17263521010247e-10, 3.1989300097734485e-10, 3.225306410836737e-10, 3.2517669112941405e-10, 3.2783134540359526e-10, 3.3049485370639786e-10, 3.3316743808242677e-10, 3.3584937608743815e-10, 3.385408342548857e-10, 3.4124211789610115e-10, 3.4395342130011386e-10, 3.4667499426710435e-10, 3.494071143528288e-10, 3.521500313574677e-10, 3.54903967325626e-10, 3.576691720574843e-10, 3.6044595086437425e-10, 3.632345535464765e-10, 3.660352021483959e-10, 3.688482297370399e-10, 3.716738583570134e-10, 3.7451239331964814e-10, 3.773641121807003e-10, 3.802292924959261e-10, 3.831082673322328e-10, 3.8600128648980103e-10, 3.8890865527996255e-10, 3.9183070676962473e-10, 3.9476774627011935e-10, 3.977200790927782e-10, 4.006880383045086e-10, 4.0367195697221803e-10, 4.066721681628138e-10, 4.0968900494320337e-10, 4.127228558914453e-10, 4.15774054074447e-10, 4.188429603146915e-10, 4.2192993543466173e-10, 4.25035395767992e-10, 4.2815970213716525e-10, 4.313032986313914e-10, 4.3446651831757777e-10, 4.376498607960855e-10, 4.408536868893975e-10, 4.4407846844229937e-10, 4.4732464954400086e-10, 4.5059267428371186e-10, 4.538830145062178e-10, 4.5719619756745544e-10, 4.605326675566346e-10, 4.638929240741163e-10, 4.672775499869886e-10, 4.706869893844612e-10, 4.74121908400349e-10, 4.775827511238617e-10, 4.810701836888143e-10, 4.845848167178701e-10, 4.881271498113904e-10, 4.916979601254923e-10, 4.952977472605369e-10, 4.989272883726414e-10, 5.025872495956207e-10, 5.062783525744408e-10, 5.100013189540675e-10, 5.13756870379467e-10, 5.175458395179078e-10, 5.21369003525507e-10, 5.252272505806843e-10, 5.29121357839557e-10, 5.330522134805449e-10, 5.3702081670437e-10, 5.41028055689452e-10, 5.450749851476644e-10, 5.491624932574268e-10, 5.532918012640664e-10, 5.574638528571541e-10, 5.616799247931681e-10, 5.659410717839819e-10, 5.702485705860738e-10, 5.746036979559221e-10, 5.790077306500052e-10, 5.83462111958255e-10, 5.879682296594524e-10, 5.925275825546805e-10, 5.971417249561739e-10, 6.01812211176167e-10, 6.065408175714992e-10, 6.113292094767075e-10, 6.16179329782085e-10, 6.21092954844471e-10, 6.260721940876124e-10, 6.311191569352559e-10, 6.362359528111483e-10, 6.414249686947926e-10, 6.466885360545405e-10, 6.520292639144998e-10, 6.574497612987784e-10, 6.629528592760892e-10, 6.685415554485985e-10, 6.742187919073217e-10, 6.799880103436351e-10, 6.858525969377638e-10, 6.918161599145378e-10, 6.978825850545434e-10, 7.040559801829716e-10, 7.103406751696184e-10, 7.167412219288849e-10, 7.232625609532306e-10, 7.2990985477972e-10, 7.366885990123251e-10, 7.436047333442275e-10, 7.506645305355164e-10, 7.57874762946642e-10, 7.652426470272644e-10, 7.727759543385559e-10, 7.804830115532013e-10, 7.883728114777e-10, 7.964550685635174e-10, 8.047402189070851e-10, 8.132396422944055e-10, 8.219657177122031e-10, 8.309318788590758e-10, 8.401527806789488e-10, 8.496445214056791e-10, 8.594246980742071e-10, 8.695127395874636e-10, 8.799300732498239e-10, 8.90700457834015e-10, 9.01850316648023e-10, 9.134091816243028e-10, 9.254100818978372e-10, 9.37890431984556e-10, 9.508922538259412e-10, 9.64463842123564e-10, 9.78660263939446e-10, 9.935448019859905e-10, 1.0091912860943353e-09, 1.0256859805934937e-09, 1.0431305819125214e-09, 1.0616465484503124e-09, 1.0813799855569073e-09, 1.1025096391392708e-09, 1.1252564435793033e-09, 1.149898620766976e-09, 1.176793218427008e-09, 1.2064089727203964e-09, 1.2393785997488749e-09, 1.2765849488616254e-09, 1.319313880365769e-09, 1.36954347862428e-09, 1.4305497897382224e-09, 1.5083649884672923e-09, 1.6160853766322703e-09, 1.7921247819074893e-09]);
|
|
fe = $toNativeArray($kindFloat32, [1, 0.9381436705589294, 0.900469958782196, 0.8717043399810791, 0.847785472869873, 0.8269932866096497, 0.8084216713905334, 0.7915276288986206, 0.7759568691253662, 0.7614634037017822, 0.7478685975074768, 0.7350381016731262, 0.7228676676750183, 0.7112747430801392, 0.7001926302909851, 0.6895664930343628, 0.6793505549430847, 0.669506311416626, 0.6600008606910706, 0.6508058309555054, 0.6418967247009277, 0.633251965045929, 0.62485271692276, 0.6166821718215942, 0.608725368976593, 0.6009689569473267, 0.5934008955955505, 0.5860103368759155, 0.5787873864173889, 0.5717230439186096, 0.5648092031478882, 0.5580382943153381, 0.5514034032821655, 0.5448982119560242, 0.5385168790817261, 0.5322538614273071, 0.526104211807251, 0.5200631618499756, 0.5141264200210571, 0.5082897543907166, 0.5025495290756226, 0.4969019889831543, 0.4913438558578491, 0.4858720004558563, 0.48048335313796997, 0.4751752018928528, 0.4699448347091675, 0.4647897481918335, 0.4597076177597046, 0.4546961486339569, 0.4497532546520233, 0.44487687945365906, 0.4400651156902313, 0.4353161156177521, 0.4306281507015228, 0.42599955201148987, 0.42142874002456665, 0.4169141948223114, 0.4124544560909271, 0.40804818272590637, 0.4036940038204193, 0.39939069747924805, 0.3951369822025299, 0.39093172550201416, 0.38677382469177246, 0.38266217708587646, 0.378595769405365, 0.37457355856895447, 0.37059465050697327, 0.366658091545105, 0.362762987613678, 0.358908474445343, 0.35509374737739563, 0.35131800174713135, 0.3475804924964905, 0.34388044476509094, 0.34021714329719543, 0.33658990263938904, 0.3329980671405792, 0.3294409513473511, 0.32591795921325684, 0.32242849469184875, 0.3189719021320343, 0.3155476748943329, 0.31215524673461914, 0.3087940812110901, 0.30546361207962036, 0.30216339230537415, 0.29889291524887085, 0.29565170407295227, 0.2924392819404602, 0.2892552316188812, 0.28609907627105713, 0.2829704284667969, 0.27986884117126465, 0.2767939269542694, 0.2737452983856201, 0.2707225978374481, 0.26772540807724, 0.26475343108177185, 0.2618062496185303, 0.258883535861969, 0.2559850215911865, 0.25311028957366943, 0.25025907158851624, 0.24743106961250305, 0.2446259707212448, 0.24184346199035645, 0.23908329010009766, 0.23634515702724457, 0.2336287796497345, 0.23093391954898834, 0.22826029360294342, 0.22560766339302063, 0.22297576069831848, 0.22036437690258026, 0.21777324378490448, 0.21520215272903442, 0.212650865316391, 0.21011915802955627, 0.20760682225227356, 0.20511364936828613, 0.20263944566249847, 0.20018397271633148, 0.19774706661701202, 0.1953285187482834, 0.19292815029621124, 0.19054576754570007, 0.18818120658397675, 0.18583425879478455, 0.18350479006767273, 0.18119260668754578, 0.17889754474163055, 0.17661945521831512, 0.17435817420482635, 0.1721135377883911, 0.16988539695739746, 0.16767361760139465, 0.16547803580760956, 0.16329853236675262, 0.16113494336605072, 0.1589871346950531, 0.15685498714447021, 0.15473836660385132, 0.15263713896274567, 0.1505511850118637, 0.1484803706407547, 0.14642459154129028, 0.1443837285041809, 0.14235764741897583, 0.1403462439775467, 0.13834942877292633, 0.136367067694664, 0.13439907133579254, 0.1324453204870224, 0.1305057406425476, 0.12858019769191742, 0.12666863203048706, 0.12477091699838638, 0.12288697808980942, 0.1210167184472084, 0.11916005611419678, 0.11731690168380737, 0.11548716574907303, 0.11367076635360718, 0.11186762899160385, 0.11007767915725708, 0.1083008274435997, 0.10653700679540634, 0.10478614270687103, 0.1030481606721878, 0.10132300108671188, 0.0996105819940567, 0.09791085124015808, 0.09622374176979065, 0.09454918652772903, 0.09288713335990906, 0.09123751521110535, 0.08960027992725372, 0.08797537535429001, 0.08636274188756943, 0.0847623273730278, 0.08317409455776215, 0.08159798383712769, 0.08003395050764084, 0.07848194986581802, 0.07694194465875626, 0.07541389018297195, 0.07389774918556213, 0.07239348441362381, 0.070901058614254, 0.06942043453454971, 0.06795158982276917, 0.06649449467658997, 0.06504911929368973, 0.06361543387174606, 0.06219341605901718, 0.06078304722905159, 0.0593843050301075, 0.05799717456102371, 0.05662164092063904, 0.05525768920779228, 0.05390531197190285, 0.05256449431180954, 0.05123523622751236, 0.04991753399372101, 0.04861138388514519, 0.047316793352365494, 0.04603376239538193, 0.044762298464775085, 0.04350241273641586, 0.04225412383675575, 0.04101744294166565, 0.039792392402887344, 0.03857899457216263, 0.03737728297710419, 0.03618728369474411, 0.03500903770327568, 0.03384258225560188, 0.0326879620552063, 0.031545232981443405, 0.030414443463087082, 0.0292956605553627, 0.028188949450850487, 0.027094384655356407, 0.02601204626262188, 0.024942025542259216, 0.023884421214461327, 0.022839335724711418, 0.021806888282299042, 0.020787203684449196, 0.019780423492193222, 0.018786700442433357, 0.017806200310587883, 0.016839107498526573, 0.015885621309280396, 0.014945968054234982, 0.01402039173990488, 0.013109165243804455, 0.012212592177093029, 0.011331013403832912, 0.010464809834957123, 0.009614413604140282, 0.008780314587056637, 0.007963077165186405, 0.007163353264331818, 0.0063819061033427715, 0.005619642324745655, 0.004877655766904354, 0.004157294984906912, 0.003460264764726162, 0.0027887988835573196, 0.0021459676790982485, 0.001536299823783338, 0.0009672692976891994, 0.0004541343660093844]);
|
|
kn = $toNativeArray($kindUint32, [1991057938, 0, 1611602771, 1826899878, 1918584482, 1969227037, 2001281515, 2023368125, 2039498179, 2051788381, 2061460127, 2069267110, 2075699398, 2081089314, 2085670119, 2089610331, 2093034710, 2096037586, 2098691595, 2101053571, 2103168620, 2105072996, 2106796166, 2108362327, 2109791536, 2111100552, 2112303493, 2113412330, 2114437283, 2115387130, 2116269447, 2117090813, 2117856962, 2118572919, 2119243101, 2119871411, 2120461303, 2121015852, 2121537798, 2122029592, 2122493434, 2122931299, 2123344971, 2123736059, 2124106020, 2124456175, 2124787725, 2125101763, 2125399283, 2125681194, 2125948325, 2126201433, 2126441213, 2126668298, 2126883268, 2127086657, 2127278949, 2127460589, 2127631985, 2127793506, 2127945490, 2128088244, 2128222044, 2128347141, 2128463758, 2128572095, 2128672327, 2128764606, 2128849065, 2128925811, 2128994934, 2129056501, 2129110560, 2129157136, 2129196237, 2129227847, 2129251929, 2129268426, 2129277255, 2129278312, 2129271467, 2129256561, 2129233410, 2129201800, 2129161480, 2129112170, 2129053545, 2128985244, 2128906855, 2128817916, 2128717911, 2128606255, 2128482298, 2128345305, 2128194452, 2128028813, 2127847342, 2127648860, 2127432031, 2127195339, 2126937058, 2126655214, 2126347546, 2126011445, 2125643893, 2125241376, 2124799783, 2124314271, 2123779094, 2123187386, 2122530867, 2121799464, 2120980787, 2120059418, 2119015917, 2117825402, 2116455471, 2114863093, 2112989789, 2110753906, 2108037662, 2104664315, 2100355223, 2094642347, 2086670106, 2074676188, 2054300022, 2010539237]);
|
|
wn = $toNativeArray($kindFloat32, [1.7290404663583558e-09, 1.2680928529462676e-10, 1.689751810696194e-10, 1.9862687883343e-10, 2.223243117382978e-10, 2.4244936613904144e-10, 2.601613091623989e-10, 2.761198769629658e-10, 2.9073962681813725e-10, 3.042996965518796e-10, 3.169979556627567e-10, 3.289802041894774e-10, 3.4035738116777736e-10, 3.5121602848242617e-10, 3.61625090983253e-10, 3.7164057942185025e-10, 3.813085680537398e-10, 3.906675816178762e-10, 3.997501218933053e-10, 4.0858399996679395e-10, 4.1719308563337165e-10, 4.255982233303257e-10, 4.3381759295968436e-10, 4.4186720948857783e-10, 4.497613115272969e-10, 4.57512583373898e-10, 4.6513240481438345e-10, 4.726310454117311e-10, 4.800177477726209e-10, 4.873009773476156e-10, 4.944885056978876e-10, 5.015873272284921e-10, 5.086040477664255e-10, 5.155446070048697e-10, 5.224146670812502e-10, 5.292193350214802e-10, 5.359634958068682e-10, 5.426517013518151e-10, 5.492881705038144e-10, 5.558769555769061e-10, 5.624218868405251e-10, 5.689264614971989e-10, 5.75394121238304e-10, 5.818281967329142e-10, 5.882316855831959e-10, 5.946076964136182e-10, 6.009590047817426e-10, 6.072883862451306e-10, 6.135985053390414e-10, 6.19892026598734e-10, 6.261713370037114e-10, 6.324390455780815e-10, 6.386973727678935e-10, 6.449488165749528e-10, 6.511955974453087e-10, 6.574400468473129e-10, 6.636843297158634e-10, 6.699307220081607e-10, 6.761814441702541e-10, 6.824387166481927e-10, 6.887046488657234e-10, 6.949815167800466e-10, 7.012714853260604e-10, 7.075767749498141e-10, 7.13899661608508e-10, 7.202424212593428e-10, 7.266072743483676e-10, 7.329966078550854e-10, 7.394128087589991e-10, 7.458582640396116e-10, 7.523354716987285e-10, 7.588469852493063e-10, 7.653954137154528e-10, 7.719834771435785e-10, 7.786139510912449e-10, 7.852897221383159e-10, 7.920137878869582e-10, 7.987892014504894e-10, 8.056192379868321e-10, 8.125072836762115e-10, 8.194568912323064e-10, 8.264716688799467e-10, 8.3355555791087e-10, 8.407127216614185e-10, 8.479473234679347e-10, 8.552640262671218e-10, 8.626675485068347e-10, 8.701631637464402e-10, 8.777562010564566e-10, 8.854524335966119e-10, 8.932581896381464e-10, 9.011799639857543e-10, 9.092249730890956e-10, 9.174008219758889e-10, 9.25715837318819e-10, 9.341788453909317e-10, 9.42799727177146e-10, 9.515889187738935e-10, 9.605578554783278e-10, 9.697193048552322e-10, 9.790869226478094e-10, 9.886760299337993e-10, 9.985036131254788e-10, 1.008588212947359e-09, 1.0189509236369076e-09, 1.0296150598776421e-09, 1.040606933955246e-09, 1.0519566329136865e-09, 1.0636980185552147e-09, 1.0758701707302976e-09, 1.0885182755160372e-09, 1.101694735439196e-09, 1.115461056855338e-09, 1.1298901814171813e-09, 1.1450695946990663e-09, 1.1611052119775422e-09, 1.178127595480305e-09, 1.1962995039027646e-09, 1.2158286599728285e-09, 1.2369856250415978e-09, 1.2601323318151003e-09, 1.2857697129220469e-09, 1.3146201904845611e-09, 1.3477839955200466e-09, 1.3870635751089821e-09, 1.43574030442295e-09, 1.5008658760251592e-09, 1.6030947680434338e-09]);
|
|
fn = $toNativeArray($kindFloat32, [1, 0.963599681854248, 0.9362826943397522, 0.9130436182022095, 0.8922816514968872, 0.8732430338859558, 0.8555005788803101, 0.8387836217880249, 0.8229072093963623, 0.8077383041381836, 0.7931770086288452, 0.7791460752487183, 0.7655841708183289, 0.7524415850639343, 0.7396772503852844, 0.7272568941116333, 0.7151514887809753, 0.7033361196517944, 0.6917891502380371, 0.6804918646812439, 0.6694276928901672, 0.6585819721221924, 0.6479418277740479, 0.6374954581260681, 0.6272324919700623, 0.6171433925628662, 0.6072195172309875, 0.5974531769752502, 0.5878370404243469, 0.5783646702766418, 0.5690299868583679, 0.5598273873329163, 0.550751805305481, 0.5417983531951904, 0.5329626798629761, 0.5242405533790588, 0.5156282186508179, 0.5071220397949219, 0.49871864914894104, 0.4904148280620575, 0.48220765590667725, 0.47409430146217346, 0.466072142124176, 0.45813870429992676, 0.45029163360595703, 0.44252872467041016, 0.4348478317260742, 0.42724698781967163, 0.41972434520721436, 0.41227802634239197, 0.40490642189979553, 0.39760786294937134, 0.3903807997703552, 0.3832238018512726, 0.3761354684829712, 0.3691144585609436, 0.36215949058532715, 0.3552693724632263, 0.3484429717063904, 0.3416791558265686, 0.33497685194015503, 0.32833510637283325, 0.3217529058456421, 0.3152293860912323, 0.30876362323760986, 0.3023548424243927, 0.2960021495819092, 0.2897048592567444, 0.28346219658851624, 0.2772735059261322, 0.271138072013855, 0.2650552988052368, 0.25902456045150757, 0.25304529070854187, 0.24711695313453674, 0.24123899638652802, 0.23541094362735748, 0.22963231801986694, 0.22390270233154297, 0.21822164952754974, 0.21258877217769623, 0.20700371265411377, 0.20146611332893372, 0.1959756463766098, 0.19053204357624054, 0.18513499200344086, 0.17978426814079285, 0.1744796335697174, 0.16922089457511902, 0.16400785744190216, 0.1588403731584549, 0.15371830761432648, 0.14864157140254974, 0.14361007511615753, 0.13862377405166626, 0.13368265330791473, 0.12878671288490295, 0.12393598258495331, 0.11913054436445236, 0.11437050998210907, 0.10965602099895477, 0.1049872562289238, 0.10036443918943405, 0.09578784555196762, 0.09125780314207077, 0.08677466958761215, 0.08233889937400818, 0.07795098423957825, 0.07361150532960892, 0.06932111829519272, 0.06508058309555054, 0.06089077144861221, 0.05675266310572624, 0.05266740173101425, 0.048636294901371, 0.044660862535238266, 0.040742866694927216, 0.03688438981771469, 0.03308788686990738, 0.029356317594647408, 0.025693291798233986, 0.02210330404341221, 0.018592102453112602, 0.015167297795414925, 0.011839478276669979, 0.0086244847625494, 0.005548994988203049, 0.0026696291752159595]);
|
|
rngCooked = $toNativeArray($kindInt64, [new $Int64(-973649357, 3952672746), new $Int64(-1065661887, 3130416987), new $Int64(324977939, 3414273807), new $Int64(1241840476, 2806224363), new $Int64(-1477934308, 1997590414), new $Int64(2103305448, 2402795971), new $Int64(1663160183, 1140819369), new $Int64(1120601685, 1788868961), new $Int64(1848035537, 1089001426), new $Int64(1235702047, 873593504), new $Int64(1911387977, 581324885), new $Int64(-1654874170, 1609182556), new $Int64(1069394745, 1241596776), new $Int64(1895445337, 1771189259), new $Int64(-1374618802, 3467012610), new $Int64(-140526423, 2344407434), new $Int64(-1745367887, 782467244), new $Int64(26335124, 3404933915), new $Int64(1063924276, 618867887), new $Int64(-968700782, 520164395), new $Int64(-1591572833, 1341358184), new $Int64(-1515085039, 665794848), new $Int64(1527227641, 3183648150), new $Int64(1781176124, 696329606), new $Int64(1789146075, 4151988961), new $Int64(-2087444114, 998951326), new $Int64(-612324923, 1364957564), new $Int64(63173359, 4090230633), new $Int64(-1498029007, 4009697548), new $Int64(248009524, 2569622517), new $Int64(778703922, 3742421481), new $Int64(-1109106023, 1506914633), new $Int64(1738099768, 1983412561), new $Int64(236311649, 1436266083), new $Int64(-1111517500, 3922894967), new $Int64(-1336974714, 1792680179), new $Int64(563141142, 1188796351), new $Int64(1349617468, 405968250), new $Int64(1044074554, 433754187), new $Int64(870549669, 4073162024), new $Int64(-1094251604, 433121399), new $Int64(2451824, 4162580594), new $Int64(-137262572, 4132415622), new $Int64(-1536231048, 3033822028), new $Int64(2016407895, 824682382), new $Int64(2366218, 3583765414), new $Int64(-624604839, 535386927), new $Int64(1637219058, 2286693689), new $Int64(1453075389, 2968466525), new $Int64(193683513, 1351410206), new $Int64(-283806096, 1412813499), new $Int64(492736522, 4126267639), new $Int64(512765208, 2105529399), new $Int64(2132966268, 2413882233), new $Int64(947457634, 32226200), new $Int64(1149341356, 2032329073), new $Int64(106485445, 1356518208), new $Int64(-2067810156, 3430061722), new $Int64(-1484435135, 3820169661), new $Int64(-1665985194, 2981816134), new $Int64(1017155588, 4184371017), new $Int64(206574701, 2119206761), new $Int64(-852109057, 2472200560), new $Int64(-560457548, 2853524696), new $Int64(1307803389, 1681119904), new $Int64(-174986835, 95608918), new $Int64(392686347, 3690479145), new $Int64(-1205570926, 1397922290), new $Int64(-1159314025, 1516129515), new $Int64(-320178155, 1547420459), new $Int64(1311333971, 1470949486), new $Int64(-1953469798, 1336785672), new $Int64(-45086614, 4131677129), new $Int64(-1392278100, 4246329084), new $Int64(-1142500187, 3788585631), new $Int64(-66478285, 3080389532), new $Int64(-646438364, 2215402037), new $Int64(391002300, 1171593935), new $Int64(1408774047, 1423855166), new $Int64(-519177718, 2276716302), new $Int64(-368453140, 2068027241), new $Int64(1369359303, 3427553297), new $Int64(189241615, 3289637845), new $Int64(1057480830, 3486407650), new $Int64(-1512910664, 3071877822), new $Int64(1159653919, 3363620705), new $Int64(-934256930, 4159821533), new $Int64(-76621938, 1894661), new $Int64(-674493898, 1156868282), new $Int64(348271067, 776219088), new $Int64(-501428838, 2425634259), new $Int64(1716021749, 680510161), new $Int64(-574263456, 1310101429), new $Int64(1095885995, 2964454134), new $Int64(-325695512, 3467098407), new $Int64(1990672920, 2109628894), new $Int64(-2139648704, 1232604732), new $Int64(-1838070714, 3261916179), new $Int64(1699175360, 434597899), new $Int64(235436061, 1624796439), new $Int64(-1626402839, 3589632480), new $Int64(1198416575, 864579159), new $Int64(-1938748161, 1380889830), new $Int64(619206309, 2654509477), new $Int64(1419738251, 1468209306), new $Int64(-1744284772, 100794388), new $Int64(-1191421458, 2991674471), new $Int64(-208666741, 2224662036), new $Int64(-173659161, 977097250), new $Int64(1351320195, 726419512), new $Int64(-183459897, 1747974366), new $Int64(-753095183, 1556430604), new $Int64(-1049492215, 1080776742), new $Int64(-385846958, 280794874), new $Int64(117767733, 919835643), new $Int64(-967009426, 3434019658), new $Int64(-1951414480, 2461941785), new $Int64(133215641, 3615001066), new $Int64(417204809, 3103414427), new $Int64(790056561, 3380809712), new $Int64(-1267681408, 2724693469), new $Int64(547796833, 598827710), new $Int64(-1846559452, 3452273442), new $Int64(-75778224, 649274915), new $Int64(-801301329, 2585724112), new $Int64(-1510934263, 3165579553), new $Int64(1185578221, 2635894283), new $Int64(-52910178, 2053289721), new $Int64(985976581, 3169337108), new $Int64(1170569632, 144717764), new $Int64(1079216270, 1383666384), new $Int64(-124804942, 681540375), new $Int64(1375448925, 537050586), new $Int64(-1964768344, 315246468), new $Int64(226402871, 849323088), new $Int64(-885062465, 45543944), new $Int64(-946445250, 2319052083), new $Int64(-40708194, 3613090841), new $Int64(560472520, 2992171180), new $Int64(-381863169, 2068244785), new $Int64(917538188, 4239862634), new $Int64(-1369555809, 3892253031), new $Int64(720683925, 958186149), new $Int64(-423297785, 1877702262), new $Int64(1357886971, 837674867), new $Int64(1837048883, 1507589294), new $Int64(1905518400, 873336795), new $Int64(-1879761037, 2764496274), new $Int64(-1806480530, 4196182374), new $Int64(-1066765755, 550964545), new $Int64(818747069, 420611474), new $Int64(-1924830376, 204265180), new $Int64(1549974541, 1787046383), new $Int64(1215581865, 3102292318), new $Int64(418321538, 1552199393), new $Int64(1243493047, 980542004), new $Int64(267284263, 3293718720), new $Int64(1179528763, 3771917473), new $Int64(599484404, 2195808264), new $Int64(252818753, 3894702887), new $Int64(-1367475956, 2099949527), new $Int64(1424094358, 338442522), new $Int64(490737398, 637158004), new $Int64(-1727621530, 281976339), new $Int64(574970164, 3619802330), new $Int64(-431930823, 3084554784), new $Int64(-1264611183, 4129772886), new $Int64(-2104399043, 1680378557), new $Int64(-1621962591, 3339087776), new $Int64(1680500332, 4220317857), new $Int64(-1935828963, 2959322499), new $Int64(1675600481, 1488354890), new $Int64(-834863562, 3958162143), new $Int64(-1226511573, 2773705983), new $Int64(1876039582, 225908689), new $Int64(-1183735113, 908216283), new $Int64(-605696219, 3574646075), new $Int64(-1827723091, 1936937569), new $Int64(1519770881, 75492235), new $Int64(816689472, 1935193178), new $Int64(2142521206, 2018250883), new $Int64(455141620, 3943126022), new $Int64(-601399488, 3066544345), new $Int64(1932392669, 2793082663), new $Int64(-1239009361, 3297036421), new $Int64(1640597065, 2206987825), new $Int64(-553246738, 807894872), new $Int64(-1781325307, 766252117), new $Int64(2060649606, 3833114345), new $Int64(845619743, 1255067973), new $Int64(1201145605, 741697208), new $Int64(-1476242608, 2810093753), new $Int64(1109032642, 4229340371), new $Int64(1462188720, 1361684224), new $Int64(-1159399429, 1906263026), new $Int64(475781207, 3904421704), new $Int64(-623537128, 1769075545), new $Int64(1062308525, 2621599764), new $Int64(1279509432, 3431891480), new $Int64(-1742751146, 1871896503), new $Int64(128756421, 1412808876), new $Int64(1605404688, 952876175), new $Int64(-230443691, 1824438899), new $Int64(1662295856, 1005035476), new $Int64(-156574141, 527508597), new $Int64(1288873303, 3066806859), new $Int64(565995893, 3244940914), new $Int64(-889746188, 209092916), new $Int64(-247669406, 1242699167), new $Int64(-713830396, 456723774), new $Int64(1776978905, 1001252870), new $Int64(1468772157, 2026725874), new $Int64(857254202, 2137562569), new $Int64(765939740, 3183366709), new $Int64(1533887628, 2612072960), new $Int64(56977098, 1727148468), new $Int64(-1197583895, 3803658212), new $Int64(1883670356, 479946959), new $Int64(685713571, 1562982345), new $Int64(-1946242443, 1766109365), new $Int64(700596547, 3257093788), new $Int64(-184714929, 2365720207), new $Int64(93384808, 3742754173), new $Int64(-458385235, 2878193673), new $Int64(1096135042, 2174002182), new $Int64(-834260953, 3573511231), new $Int64(-754572527, 1760299077), new $Int64(-1375627191, 2260779833), new $Int64(-866019274, 1452805722), new $Int64(-1229671918, 2940011802), new $Int64(1890251082, 1886183802), new $Int64(893897673, 2514369088), new $Int64(1644345561, 3924317791), new $Int64(-1974867432, 500935732), new $Int64(1403501753, 676580929), new $Int64(-1565912283, 1184984890), new $Int64(-691968413, 1271474274), new $Int64(-1828754738, 3163791473), new $Int64(2051027584, 2842487377), new $Int64(1511537551, 2170968612), new $Int64(573262976, 3535856740), new $Int64(-2053227187, 1488599718), new $Int64(-1180531831, 3408913763), new $Int64(-2086531912, 2501050084), new $Int64(-875130448, 1639124157), new $Int64(-2009482504, 4088176393), new $Int64(1574896563, 3989947576), new $Int64(-165243708, 3414355209), new $Int64(-792329287, 2275136352), new $Int64(-2057774345, 2151835223), new $Int64(-931144933, 1654534827), new $Int64(-679921451, 377892833), new $Int64(-482716010, 660204544), new $Int64(85706799, 390828249), new $Int64(-1422172693, 3402783878), new $Int64(-1468634160, 3717936603), new $Int64(1113532086, 2211058823), new $Int64(1564224320, 2692150867), new $Int64(1952770442, 1928910388), new $Int64(788716862, 3931011137), new $Int64(1083670504, 1112701047), new $Int64(-68150572, 2452299106), new $Int64(-896164822, 2337204777), new $Int64(1774877857, 273889282), new $Int64(1798719843, 1462008793), new $Int64(2138834788, 1554494002), new $Int64(-1194967131, 182675323), new $Int64(-1598554764, 1882802136), new $Int64(589279648, 3700220025), new $Int64(381039426, 3083431543), new $Int64(-851859191, 3622207527), new $Int64(338126939, 432729309), new $Int64(-1667470126, 2391914317), new $Int64(-1849558151, 235747924), new $Int64(2120733629, 3088823825), new $Int64(-745079795, 2314658321), new $Int64(1165929723, 2957634338), new $Int64(501323675, 4117056981), new $Int64(1564699815, 1482500298), new $Int64(-740826490, 840489337), new $Int64(799522364, 3483178565), new $Int64(532129761, 2074004656), new $Int64(724246478, 3643392642), new $Int64(-665153481, 1583624461), new $Int64(-885822954, 287473085), new $Int64(1667835381, 3136843981), new $Int64(1138806821, 1266970974), new $Int64(135185781, 1998688839), new $Int64(392094735, 1492900209), new $Int64(1031326774, 1538112737), new $Int64(-2070568842, 2207265429), new $Int64(-1886797613, 963263315), new $Int64(1671145500, 2295892134), new $Int64(1068469660, 2002560897), new $Int64(-356250305, 1369254035), new $Int64(33436120, 3353312708), new $Int64(57507843, 947771099), new $Int64(-1945755145, 1747061399), new $Int64(1507240140, 2047354631), new $Int64(720000810, 4165367136), new $Int64(479265078, 3388864963), new $Int64(-952181250, 286492130), new $Int64(2045622690, 2795735007), new $Int64(-715730566, 3703961339), new $Int64(-148436487, 1797825479), new $Int64(1429039600, 1116589674), new $Int64(-1665420098, 2593309206), new $Int64(1329049334, 3404995677), new $Int64(-750579440, 3453462936), new $Int64(1014767077, 3016498634), new $Int64(75698599, 1650371545), new $Int64(1592007860, 212344364), new $Int64(1127766888, 3843932156), new $Int64(-748019856, 3573129983), new $Int64(-890581831, 665897820), new $Int64(1071492673, 1675628772), new $Int64(243225682, 2831752928), new $Int64(2120298836, 1486294219), new $Int64(-1954407413, 268782709), new $Int64(-1002123503, 4186179080), new $Int64(624342951, 1613720397), new $Int64(857179861, 2703686015), new $Int64(-911618704, 2205342611), new $Int64(-672703993, 1411666394), new $Int64(-1528454899, 677744900), new $Int64(-1876628533, 4172867247), new $Int64(135494707, 2163418403), new $Int64(849547544, 2841526879), new $Int64(-1117516959, 1082141470), new $Int64(-1770111792, 4046134367), new $Int64(51415528, 2142943655), new $Int64(-249824333, 3124627521), new $Int64(998228909, 219992939), new $Int64(-1078790951, 1756846531), new $Int64(1283749206, 1225118210), new $Int64(-525858006, 1647770243), new $Int64(-2035959705, 444807907), new $Int64(2036369448, 3952076173), new $Int64(53201823, 1461839639), new $Int64(315761893, 3699250910), new $Int64(702974850, 1373688981), new $Int64(734022261, 147523747), new $Int64(-2047330906, 1211276581), new $Int64(1294440951, 2548832680), new $Int64(1144696256, 1995631888), new $Int64(-1992983070, 2011457303), new $Int64(-1351022674, 3057425772), new $Int64(667839456, 81484597), new $Int64(-1681980888, 3646681560), new $Int64(-1372462725, 635548515), new $Int64(602489502, 2508044581), new $Int64(-1794220117, 1014917157), new $Int64(719992433, 3214891315), new $Int64(-1294799037, 959582252), new $Int64(226415134, 3347040449), new $Int64(-362868096, 4102971975), new $Int64(397887437, 4078022210), new $Int64(-536803826, 2851767182), new $Int64(-1398321012, 1540160644), new $Int64(-1549098876, 1057290595), new $Int64(-112592988, 3907769253), new $Int64(579300318, 4248952684), new $Int64(-1054576049, 132554364), new $Int64(-1085862414, 1029351092), new $Int64(697840928, 2583007416), new $Int64(298619124, 1486185789), new $Int64(55905697, 2871589073), new $Int64(2017643612, 723203291), new $Int64(146250550, 2494333952), new $Int64(-1082993397, 2230939180), new $Int64(-1804568072, 3943232912), new $Int64(1768732449, 2181367922), new $Int64(-729261111, 2889274791), new $Int64(1824032949, 2046728161), new $Int64(1653899792, 1376052477), new $Int64(1022327048, 381236993), new $Int64(-1113097690, 3188942166), new $Int64(-74480109, 350070824), new $Int64(144881592, 61758415), new $Int64(-741824226, 3492950336), new $Int64(-2030042720, 3093818430), new $Int64(-453590535, 2962480613), new $Int64(-1912050708, 3154871160), new $Int64(-1636478569, 3228564679), new $Int64(610731502, 888276216), new $Int64(-946702974, 3574998604), new $Int64(-1277068380, 1967526716), new $Int64(-1556147941, 1554691298), new $Int64(-1573024234, 339944798), new $Int64(1223764147, 1154515356), new $Int64(1825645307, 967516237), new $Int64(1546195135, 596588202), new $Int64(-1867600880, 3764362170), new $Int64(-1655392592, 266611402), new $Int64(-393255880, 2047856075), new $Int64(-1000726433, 21444105), new $Int64(-949424754, 3065563181), new $Int64(-232418803, 1140663212), new $Int64(633187674, 2323741028), new $Int64(2126290159, 3103873707), new $Int64(1008658319, 2766828349), new $Int64(-485587503, 1970872996), new $Int64(1628585413, 3766615585), new $Int64(-595148528, 2036813414), new $Int64(-1994877121, 3105536507), new $Int64(13954645, 3396176938), new $Int64(-721402003, 1377154485), new $Int64(-61839181, 3807014186), new $Int64(543009040, 3710110597), new $Int64(-1751425519, 916420443), new $Int64(734556788, 2103831255), new $Int64(-1766161494, 717331943), new $Int64(-1574598896, 3550505941), new $Int64(45939673, 378749927), new $Int64(-1997615719, 611017331), new $Int64(592130075, 758907650), new $Int64(1012992349, 154266815), new $Int64(-1040454942, 1407468696), new $Int64(-1678191250, 970098704), new $Int64(-285057486, 1971660656), new $Int64(998365243, 3332747885), new $Int64(1947089649, 1935189867), new $Int64(1510248801, 203520055), new $Int64(-1305165746, 3916463034), new $Int64(-388598655, 3474113316), new $Int64(1036101639, 316544223), new $Int64(-1773744891, 1650844677), new $Int64(-907191419, 4267565603), new $Int64(-1070275024, 2501167616), new $Int64(-1520651863, 3929401789), new $Int64(-2091360852, 337170252), new $Int64(-960502090, 2061966842), new $Int64(-304190848, 2508461464), new $Int64(-1941471116, 2791377107), new $Int64(1240791848, 1227227588), new $Int64(1813978778, 1709681848), new $Int64(1153692192, 3768820575), new $Int64(-1002297449, 2887126398), new $Int64(-1447111334, 296561685), new $Int64(700300844, 3729960077), new $Int64(-1572311344, 372833036), new $Int64(2078875613, 2409779288), new $Int64(1829161290, 555274064), new $Int64(-1105595719, 4239804901), new $Int64(1839403216, 3723486978), new $Int64(-1649093095, 2145871984), new $Int64(-1582765715, 3565480803), new $Int64(-1568653827, 2197313814), new $Int64(974785092, 3613674566), new $Int64(438638731, 3042093666), new $Int64(-96556264, 3324034321), new $Int64(869420878, 3708873369), new $Int64(946682149, 1698090092), new $Int64(1618900382, 4213940712), new $Int64(-1843479747, 2087477361), new $Int64(-1766167800, 2407950639), new $Int64(-1296225558, 3942568569), new $Int64(-1223900450, 4088074412), new $Int64(723260036, 2964773675), new $Int64(-673921829, 1539178386), new $Int64(1062961552, 2694849566), new $Int64(460977733, 2120273838), new $Int64(-1604570740, 2484608657), new $Int64(880846449, 2956190677), new $Int64(1970902366, 4223313749), new $Int64(662161910, 3502682327), new $Int64(705634754, 4133891139), new $Int64(-1031359300, 1166449596), new $Int64(1038247601, 3362705993), new $Int64(93734798, 3892921029), new $Int64(1876124043, 786869787), new $Int64(1057490746, 1046342263), new $Int64(242763728, 493777327), new $Int64(-853573201, 3304827646), new $Int64(616460742, 125356352), new $Int64(499300063, 74094113), new $Int64(-795586925, 2500816079), new $Int64(-490248444, 514015239), new $Int64(1377565129, 543520454), new $Int64(-2039776725, 3614531153), new $Int64(2056746300, 2356753985), new $Int64(1390062617, 2018141668), new $Int64(131272971, 2087974891), new $Int64(-1502927041, 3166972343), new $Int64(372256200, 1517638666), new $Int64(-935275664, 173466846), new $Int64(-695774461, 4241513471), new $Int64(-1413550842, 2783126920), new $Int64(1972004134, 4167264826), new $Int64(29260506, 3907395640), new $Int64(-910901561, 1539634186), new $Int64(-595957298, 178241987), new $Int64(-113277636, 182168164), new $Int64(-1102530459, 2386154934), new $Int64(1379126408, 4077374341), new $Int64(-2114679722, 1732699140), new $Int64(-421057745, 1041306002), new $Int64(1860414813, 2068001749), new $Int64(1005320202, 3208962910), new $Int64(844054010, 697710380), new $Int64(-1509359403, 2228431183), new $Int64(-810313977, 3554678728), new $Int64(-750989047, 173470263), new $Int64(-85886265, 3848297795), new $Int64(-926936977, 246236185), new $Int64(-1984190461, 2066374846), new $Int64(1771673660, 312890749), new $Int64(703378057, 3573310289), new $Int64(-598851901, 143166754), new $Int64(613554316, 2081511079), new $Int64(1197802104, 486038032), new $Int64(-1906483789, 2982218564), new $Int64(364901986, 1000939191), new $Int64(1902782651, 2750454885), new $Int64(-671844857, 3375313137), new $Int64(-1643868040, 881302957), new $Int64(-1508784745, 2514186393), new $Int64(-1703622845, 360024739), new $Int64(1399671872, 292500025), new $Int64(1381210821, 2276300752), new $Int64(521803381, 4069087683), new $Int64(-1938982667, 1637778212), new $Int64(720490469, 1676670893), new $Int64(1067262482, 3855174429), new $Int64(2114075974, 2067248671), new $Int64(-89426259, 2884561259), new $Int64(-805741095, 2456511185), new $Int64(983726246, 561175414), new $Int64(-1719489563, 432588903), new $Int64(885133709, 4059399550), new $Int64(-93096266, 1075014784), new $Int64(-1733832628, 2728058415), new $Int64(1839142064, 1299703678), new $Int64(1262333188, 2347583393), new $Int64(1285481956, 2468164145), new $Int64(-1158354011, 1140014346), new $Int64(2033889184, 1936972070), new $Int64(-1737578993, 3870530098), new $Int64(-484494257, 1717789158), new $Int64(-232997156, 1153452491), new $Int64(-990424416, 3948827651), new $Int64(-1357145630, 2101413152), new $Int64(1495744672, 3854091229), new $Int64(83644069, 4215565463), new $Int64(-1385277313, 1202710438), new $Int64(-564909037, 2072216740), new $Int64(705690639, 2066751068), new $Int64(-2113583312, 173902580), new $Int64(-741983806, 142459001), new $Int64(172391592, 1889151926), new $Int64(-498943125, 3034199774), new $Int64(1618587731, 516490102), new $Int64(93114264, 3692577783), new $Int64(-2078821353, 2953948865), new $Int64(-320938673, 4041040923), new $Int64(-1942517976, 592046130), new $Int64(-705643640, 384297211), new $Int64(-2051649464, 265863924), new $Int64(2101717619, 1333136237), new $Int64(1499611781, 1406273556), new $Int64(1074670496, 426305476), new $Int64(125704633, 2750898176), new $Int64(488068495, 1633944332), new $Int64(2037723464, 3236349343), new $Int64(-1703423246, 4013676611), new $Int64(1718532237, 2265047407), new $Int64(1433593806, 875071080), new $Int64(-343047503, 1418843655), new $Int64(2009228711, 451657300), new $Int64(1229446621, 1866374663), new $Int64(1653472867, 1551455622), new $Int64(577191481, 3560962459), new $Int64(1669204077, 3347903778), new $Int64(-298327194, 2675874918), new $Int64(-1831355577, 2762991672), new $Int64(530492383, 3689068477), new $Int64(844089962, 4071997905), new $Int64(1508155730, 1381702441), new $Int64(2089931018, 2373284878), new $Int64(-864267462, 2143983064), new $Int64(308739063, 1938207195), new $Int64(1754949306, 1188152253), new $Int64(1272345009, 615870490), new $Int64(742653194, 2662252621), new $Int64(1477718295, 3839976789), new $Int64(-2091334213, 306752547), new $Int64(-1426688067, 2162363077), new $Int64(-57052633, 2767224719), new $Int64(-1471624099, 2628837712), new $Int64(1678405918, 2967771969), new $Int64(1694285728, 499792248), new $Int64(-1744131281, 4285253508), new $Int64(962357072, 2856511070), new $Int64(679471692, 2526409716), new $Int64(-1793706473, 1240875658), new $Int64(-914893422, 2577342868), new $Int64(-1001298215, 4136853496), new $Int64(-1477114974, 2403540137), new $Int64(1372824515, 1371410668), new $Int64(-176562048, 371758825), new $Int64(-441063112, 1528834084), new $Int64(-71688630, 1504757260), new $Int64(-1461820072, 699052551), new $Int64(-505543539, 3347789870), new $Int64(1951619734, 3430604759), new $Int64(2119672219, 1935601723), new $Int64(966789690, 834676166)]);
|
|
globalRand = New(new lockedSource.ptr(new nosync.Mutex.ptr(false), $assertType(NewSource(new $Int64(0, 1)), Source64)));
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["net"] = (function() {
|
|
var $pkg = {}, $init, context, errors, js, bytealg, nettrace, poll, singleflight, dnsmessage, io, rand, os, runtime, sort, sync, atomic, syscall, time, policyTableEntry, policyTable, byMaskLength, Interface, Flags, ipv6ZoneCache, IP, IPMask, IPNet, IPAddr, HardwareAddr, Addr, OpError, timeout, temporary, ParseError, AddrError, file, sockaddr, ptrType, sliceType, sliceType$1, ptrType$5, ptrType$9, ptrType$13, ptrType$18, ptrType$22, ptrType$23, sliceType$7, sliceType$8, ptrType$24, ptrType$25, arrayType$2, ptrType$31, ptrType$32, arrayType$6, ptrType$48, mapType$1, mapType$2, ptrType$49, ptrType$52, rfc6724policyTable, errLameReferral, errCannotUnmarshalDNSMessage, errCannotMarshalDNSMessage, errServerMisbehaving, errInvalidDNSResponse, errNoAnswerFromDNSServer, errServerTemporarlyMisbehaving, testHookLookupIP, errInvalidInterface, errInvalidInterfaceIndex, errInvalidInterfaceName, errNoSuchInterface, errNoSuchMulticastInterface, flagNames, zoneCache, v4InV6Prefix, classAMask, classBMask, classCMask, netGo, errNoSuitableAddress, errMissingAddress, errCanceled, aLongTimeAgo, errNoSuchHost, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, init, mustCIDR, init$1, isConnError, interfaceByIndex, interfaceTable, newLink, linkFlags, interfaceAddrTable, addrTable, newAddr, interfaceMulticastAddrTable, parseProcNetIGMP, parseProcNetIGMP6, IPv4, IPv4Mask, CIDRMask, isZeros, allFF, ubtoa, hexString, ipEmptyString, simpleMaskLength, networkNumberAndMask, parseIPv4, parseIPv6, ParseIP, ParseCIDR, open, countAnyByte, splitAtBytes, dtoi, xtoi, xtoi2, uitoa, appendHex;
|
|
context = $packages["context"];
|
|
errors = $packages["errors"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
bytealg = $packages["internal/bytealg"];
|
|
nettrace = $packages["internal/nettrace"];
|
|
poll = $packages["internal/poll"];
|
|
singleflight = $packages["internal/singleflight"];
|
|
dnsmessage = $packages["internal/x/net/dns/dnsmessage"];
|
|
io = $packages["io"];
|
|
rand = $packages["math/rand"];
|
|
os = $packages["os"];
|
|
runtime = $packages["runtime"];
|
|
sort = $packages["sort"];
|
|
sync = $packages["sync"];
|
|
atomic = $packages["sync/atomic"];
|
|
syscall = $packages["syscall"];
|
|
time = $packages["time"];
|
|
policyTableEntry = $pkg.policyTableEntry = $newType(0, $kindStruct, "net.policyTableEntry", true, "net", false, function(Prefix_, Precedence_, Label_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Prefix = ptrType$5.nil;
|
|
this.Precedence = 0;
|
|
this.Label = 0;
|
|
return;
|
|
}
|
|
this.Prefix = Prefix_;
|
|
this.Precedence = Precedence_;
|
|
this.Label = Label_;
|
|
});
|
|
policyTable = $pkg.policyTable = $newType(12, $kindSlice, "net.policyTable", true, "net", false, null);
|
|
byMaskLength = $pkg.byMaskLength = $newType(12, $kindSlice, "net.byMaskLength", true, "net", false, null);
|
|
Interface = $pkg.Interface = $newType(0, $kindStruct, "net.Interface", true, "net", true, function(Index_, MTU_, Name_, HardwareAddr_, Flags_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Index = 0;
|
|
this.MTU = 0;
|
|
this.Name = "";
|
|
this.HardwareAddr = HardwareAddr.nil;
|
|
this.Flags = 0;
|
|
return;
|
|
}
|
|
this.Index = Index_;
|
|
this.MTU = MTU_;
|
|
this.Name = Name_;
|
|
this.HardwareAddr = HardwareAddr_;
|
|
this.Flags = Flags_;
|
|
});
|
|
Flags = $pkg.Flags = $newType(4, $kindUint, "net.Flags", true, "net", true, null);
|
|
ipv6ZoneCache = $pkg.ipv6ZoneCache = $newType(0, $kindStruct, "net.ipv6ZoneCache", true, "net", false, function(RWMutex_, lastFetched_, toIndex_, toName_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.RWMutex = new sync.RWMutex.ptr(new sync.Mutex.ptr(0, 0), 0, 0, 0, 0);
|
|
this.lastFetched = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType.nil);
|
|
this.toIndex = false;
|
|
this.toName = false;
|
|
return;
|
|
}
|
|
this.RWMutex = RWMutex_;
|
|
this.lastFetched = lastFetched_;
|
|
this.toIndex = toIndex_;
|
|
this.toName = toName_;
|
|
});
|
|
IP = $pkg.IP = $newType(12, $kindSlice, "net.IP", true, "net", true, null);
|
|
IPMask = $pkg.IPMask = $newType(12, $kindSlice, "net.IPMask", true, "net", true, null);
|
|
IPNet = $pkg.IPNet = $newType(0, $kindStruct, "net.IPNet", true, "net", true, function(IP_, Mask_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.IP = IP.nil;
|
|
this.Mask = IPMask.nil;
|
|
return;
|
|
}
|
|
this.IP = IP_;
|
|
this.Mask = Mask_;
|
|
});
|
|
IPAddr = $pkg.IPAddr = $newType(0, $kindStruct, "net.IPAddr", true, "net", true, function(IP_, Zone_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.IP = IP.nil;
|
|
this.Zone = "";
|
|
return;
|
|
}
|
|
this.IP = IP_;
|
|
this.Zone = Zone_;
|
|
});
|
|
HardwareAddr = $pkg.HardwareAddr = $newType(12, $kindSlice, "net.HardwareAddr", true, "net", true, null);
|
|
Addr = $pkg.Addr = $newType(8, $kindInterface, "net.Addr", true, "net", true, null);
|
|
OpError = $pkg.OpError = $newType(0, $kindStruct, "net.OpError", true, "net", true, function(Op_, Net_, Source_, Addr_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = "";
|
|
this.Net = "";
|
|
this.Source = $ifaceNil;
|
|
this.Addr = $ifaceNil;
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.Net = Net_;
|
|
this.Source = Source_;
|
|
this.Addr = Addr_;
|
|
this.Err = Err_;
|
|
});
|
|
timeout = $pkg.timeout = $newType(8, $kindInterface, "net.timeout", true, "net", false, null);
|
|
temporary = $pkg.temporary = $newType(8, $kindInterface, "net.temporary", true, "net", false, null);
|
|
ParseError = $pkg.ParseError = $newType(0, $kindStruct, "net.ParseError", true, "net", true, function(Type_, Text_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Type = "";
|
|
this.Text = "";
|
|
return;
|
|
}
|
|
this.Type = Type_;
|
|
this.Text = Text_;
|
|
});
|
|
AddrError = $pkg.AddrError = $newType(0, $kindStruct, "net.AddrError", true, "net", true, function(Err_, Addr_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Err = "";
|
|
this.Addr = "";
|
|
return;
|
|
}
|
|
this.Err = Err_;
|
|
this.Addr = Addr_;
|
|
});
|
|
file = $pkg.file = $newType(0, $kindStruct, "net.file", true, "net", false, function(file_, data_, atEOF_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.file = ptrType$18.nil;
|
|
this.data = sliceType$1.nil;
|
|
this.atEOF = false;
|
|
return;
|
|
}
|
|
this.file = file_;
|
|
this.data = data_;
|
|
this.atEOF = atEOF_;
|
|
});
|
|
sockaddr = $pkg.sockaddr = $newType(8, $kindInterface, "net.sockaddr", true, "net", false, null);
|
|
ptrType = $ptrType(time.Location);
|
|
sliceType = $sliceType($String);
|
|
sliceType$1 = $sliceType($Uint8);
|
|
ptrType$5 = $ptrType(IPNet);
|
|
ptrType$9 = $ptrType(IPAddr);
|
|
ptrType$13 = $ptrType(OpError);
|
|
ptrType$18 = $ptrType(os.File);
|
|
ptrType$22 = $ptrType(file);
|
|
ptrType$23 = $ptrType(Interface);
|
|
sliceType$7 = $sliceType(Addr);
|
|
sliceType$8 = $sliceType(Interface);
|
|
ptrType$24 = $ptrType(syscall.IfInfomsg);
|
|
ptrType$25 = $ptrType(syscall.IfAddrmsg);
|
|
arrayType$2 = $arrayType($Uint8, 4);
|
|
ptrType$31 = $ptrType(os.SyscallError);
|
|
ptrType$32 = $ptrType(AddrError);
|
|
arrayType$6 = $arrayType($Uint8, 20);
|
|
ptrType$48 = $ptrType(ipv6ZoneCache);
|
|
mapType$1 = $mapType($String, $Int);
|
|
mapType$2 = $mapType($Int, $String);
|
|
ptrType$49 = $ptrType(IP);
|
|
ptrType$52 = $ptrType(ParseError);
|
|
init = function() {
|
|
var $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = sort.Sort(sort.Reverse(($subslice(new byMaskLength(rfc6724policyTable.$array), rfc6724policyTable.$offset, rfc6724policyTable.$offset + rfc6724policyTable.$length)))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
byMaskLength.prototype.Len = function() {
|
|
var s;
|
|
s = this;
|
|
return s.$length;
|
|
};
|
|
$ptrType(byMaskLength).prototype.Len = function() { return this.$get().Len(); };
|
|
byMaskLength.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, i, j, s;
|
|
s = this;
|
|
_tmp = $clone(((j < 0 || j >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + j]), policyTableEntry);
|
|
_tmp$1 = $clone(((i < 0 || i >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i]), policyTableEntry);
|
|
policyTableEntry.copy(((i < 0 || i >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i]), _tmp);
|
|
policyTableEntry.copy(((j < 0 || j >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + j]), _tmp$1);
|
|
};
|
|
$ptrType(byMaskLength).prototype.Swap = function(i, j) { return this.$get().Swap(i, j); };
|
|
byMaskLength.prototype.Less = function(i, j) {
|
|
var _tuple, _tuple$1, i, isize, j, jsize, s;
|
|
s = this;
|
|
_tuple = ((i < 0 || i >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + i]).Prefix.Mask.Size();
|
|
isize = _tuple[0];
|
|
_tuple$1 = ((j < 0 || j >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + j]).Prefix.Mask.Size();
|
|
jsize = _tuple$1[0];
|
|
return isize < jsize;
|
|
};
|
|
$ptrType(byMaskLength).prototype.Less = function(i, j) { return this.$get().Less(i, j); };
|
|
mustCIDR = function(s) {
|
|
var _r$9, _tuple, err, ip, ipNet, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; _tuple = $f._tuple; err = $f.err; ip = $f.ip; ipNet = $f.ipNet; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tuple = ParseCIDR(s);
|
|
ip = _tuple[0];
|
|
ipNet = _tuple[1];
|
|
err = _tuple[2];
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 1:
|
|
_r$9 = err.Error(); /* */ $s = 3; case 3: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
$panic(new $String(_r$9));
|
|
/* } */ case 2:
|
|
if (!((ip.$length === 16))) {
|
|
$panic(new $String("unexpected IP length"));
|
|
}
|
|
$s = -1; return ipNet;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: mustCIDR }; } $f._r$9 = _r$9; $f._tuple = _tuple; $f.err = err; $f.ip = ip; $f.ipNet = ipNet; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
policyTable.prototype.Classify = function(ip) {
|
|
var _i, _ref, ent, ip, t;
|
|
t = this;
|
|
_ref = t;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
ent = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), policyTableEntry);
|
|
if (ent.Prefix.Contains(ip)) {
|
|
return ent;
|
|
}
|
|
_i++;
|
|
}
|
|
return new policyTableEntry.ptr(ptrType$5.nil, 0, 0);
|
|
};
|
|
$ptrType(policyTable).prototype.Classify = function(ip) { return this.$get().Classify(ip); };
|
|
init$1 = function() {
|
|
netGo = true;
|
|
};
|
|
isConnError = function(err) {
|
|
var _tuple, err, ok, se;
|
|
_tuple = $assertType(err, syscall.Errno, true);
|
|
se = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
return (se === 104) || (se === 103);
|
|
}
|
|
return false;
|
|
};
|
|
Flags.prototype.String = function() {
|
|
var _i, _ref, f, i, name, s, y;
|
|
f = this.$val;
|
|
s = "";
|
|
_ref = flagNames;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
name = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!((((f & (((y = ((i >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0) === 0))) {
|
|
if (!(s === "")) {
|
|
s = s + ("|");
|
|
}
|
|
s = s + (name);
|
|
}
|
|
_i++;
|
|
}
|
|
if (s === "") {
|
|
s = "0";
|
|
}
|
|
return s;
|
|
};
|
|
$ptrType(Flags).prototype.String = function() { return new Flags(this.$get()).String(); };
|
|
Interface.ptr.prototype.Addrs = function() {
|
|
var _r$9, _tuple, err, ifat, ifi, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; _tuple = $f._tuple; err = $f.err; ifat = $f.ifat; ifi = $f.ifi; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ifi = this;
|
|
if (ifi === ptrType$23.nil) {
|
|
$s = -1; return [sliceType$7.nil, new OpError.ptr("route", "ip+net", $ifaceNil, $ifaceNil, errInvalidInterface)];
|
|
}
|
|
_r$9 = interfaceAddrTable(ifi); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
ifat = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
err = new OpError.ptr("route", "ip+net", $ifaceNil, $ifaceNil, err);
|
|
}
|
|
$s = -1; return [ifat, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Interface.ptr.prototype.Addrs }; } $f._r$9 = _r$9; $f._tuple = _tuple; $f.err = err; $f.ifat = ifat; $f.ifi = ifi; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Interface.prototype.Addrs = function() { return this.$val.Addrs(); };
|
|
Interface.ptr.prototype.MulticastAddrs = function() {
|
|
var _r$9, _tuple, err, ifat, ifi, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; _tuple = $f._tuple; err = $f.err; ifat = $f.ifat; ifi = $f.ifi; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ifi = this;
|
|
if (ifi === ptrType$23.nil) {
|
|
$s = -1; return [sliceType$7.nil, new OpError.ptr("route", "ip+net", $ifaceNil, $ifaceNil, errInvalidInterface)];
|
|
}
|
|
_r$9 = interfaceMulticastAddrTable(ifi); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
ifat = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
err = new OpError.ptr("route", "ip+net", $ifaceNil, $ifaceNil, err);
|
|
}
|
|
$s = -1; return [ifat, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Interface.ptr.prototype.MulticastAddrs }; } $f._r$9 = _r$9; $f._tuple = _tuple; $f.err = err; $f.ifat = ifat; $f.ifi = ifi; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Interface.prototype.MulticastAddrs = function() { return this.$val.MulticastAddrs(); };
|
|
interfaceByIndex = function(ift, index) {
|
|
var _i, _ref, ifi, ift, index;
|
|
_ref = ift;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
ifi = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), Interface);
|
|
if (index === ifi.Index) {
|
|
return [ifi, $ifaceNil];
|
|
}
|
|
_i++;
|
|
}
|
|
return [ptrType$23.nil, errNoSuchInterface];
|
|
};
|
|
interfaceTable = function(ifindex) {
|
|
var _1, _i, _r$9, _ref, _tuple, _tuple$1, _tuple$2, attrs, err, err$1, ifim, ifindex, ift, m, msgs, tab, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _i = $f._i; _r$9 = $f._r$9; _ref = $f._ref; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; attrs = $f.attrs; err = $f.err; err$1 = $f.err$1; ifim = $f.ifim; ifindex = $f.ifindex; ift = $f.ift; m = $f.m; msgs = $f.msgs; tab = $f.tab; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
m = [m];
|
|
_r$9 = syscall.NetlinkRIB(18, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
tab = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType$8.nil, os.NewSyscallError("netlinkrib", err)];
|
|
}
|
|
_tuple$1 = syscall.ParseNetlinkMessage(tab);
|
|
msgs = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType$8.nil, os.NewSyscallError("parsenetlinkmessage", err)];
|
|
}
|
|
ift = sliceType$8.nil;
|
|
_ref = msgs;
|
|
_i = 0;
|
|
loop:
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
m[0] = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syscall.NetlinkMessage);
|
|
_1 = m[0].Header.Type;
|
|
if (_1 === (3)) {
|
|
break loop;
|
|
} else if (_1 === (16)) {
|
|
ifim = ($pointerOfStructConversion(($sliceToArray(m[0].Data)), ptrType$24));
|
|
if ((ifindex === 0) || (ifindex === ((ifim.Index >> 0)))) {
|
|
_tuple$2 = syscall.ParseNetlinkRouteAttr(m[0]);
|
|
attrs = _tuple$2[0];
|
|
err$1 = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [sliceType$8.nil, os.NewSyscallError("parsenetlinkrouteattr", err$1)];
|
|
}
|
|
ift = $append(ift, newLink(ifim, attrs));
|
|
if (ifindex === ((ifim.Index >> 0))) {
|
|
break loop;
|
|
}
|
|
}
|
|
}
|
|
_i++;
|
|
}
|
|
$s = -1; return [ift, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: interfaceTable }; } $f._1 = _1; $f._i = _i; $f._r$9 = _r$9; $f._ref = _ref; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.attrs = attrs; $f.err = err; $f.err$1 = err$1; $f.ifim = ifim; $f.ifindex = ifindex; $f.ift = ift; $f.m = m; $f.msgs = msgs; $f.tab = tab; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
newLink = function(ifim, attrs) {
|
|
var _1, _2, _3, _4, _i, _i$1, _ref, _ref$1, a, attrs, b, ifi, ifim, nonzero, x, x$1;
|
|
ifi = new Interface.ptr(((ifim.Index >> 0)), 0, "", HardwareAddr.nil, linkFlags(ifim.Flags));
|
|
_ref = attrs;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
a = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syscall.NetlinkRouteAttr);
|
|
_1 = a.Attr.Type;
|
|
if (_1 === (1)) {
|
|
_2 = a.Value.$length;
|
|
if (_2 === (4)) {
|
|
_3 = ifim.Type;
|
|
if ((_3 === (768)) || (_3 === (778)) || (_3 === (776))) {
|
|
_i++;
|
|
continue;
|
|
}
|
|
} else if (_2 === (16)) {
|
|
_4 = ifim.Type;
|
|
if ((_4 === (769)) || (_4 === (823))) {
|
|
_i++;
|
|
continue;
|
|
}
|
|
}
|
|
nonzero = false;
|
|
_ref$1 = a.Value;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
b = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
if (!((b === 0))) {
|
|
nonzero = true;
|
|
break;
|
|
}
|
|
_i$1++;
|
|
}
|
|
if (nonzero) {
|
|
ifi.HardwareAddr = (x = a.Value, $subslice(new HardwareAddr(x.$array), x.$offset, x.$offset + x.$length));
|
|
}
|
|
} else if (_1 === (3)) {
|
|
ifi.Name = ($bytesToString($subslice(a.Value, 0, (a.Value.$length - 1 >> 0))));
|
|
} else if (_1 === (4)) {
|
|
ifi.MTU = (((x$1 = $subslice(a.Value, 0, 4), (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])) >> 0));
|
|
}
|
|
_i++;
|
|
}
|
|
return ifi;
|
|
};
|
|
linkFlags = function(rawFlags) {
|
|
var f, rawFlags;
|
|
f = 0;
|
|
if (!((((rawFlags & 1) >>> 0) === 0))) {
|
|
f = (f | (1)) >>> 0;
|
|
}
|
|
if (!((((rawFlags & 2) >>> 0) === 0))) {
|
|
f = (f | (2)) >>> 0;
|
|
}
|
|
if (!((((rawFlags & 8) >>> 0) === 0))) {
|
|
f = (f | (4)) >>> 0;
|
|
}
|
|
if (!((((rawFlags & 16) >>> 0) === 0))) {
|
|
f = (f | (8)) >>> 0;
|
|
}
|
|
if (!((((rawFlags & 4096) >>> 0) === 0))) {
|
|
f = (f | (16)) >>> 0;
|
|
}
|
|
return f;
|
|
};
|
|
interfaceAddrTable = function(ifi) {
|
|
var _r$10, _r$9, _tuple, _tuple$1, _tuple$2, _tuple$3, err, err$1, ifat, ifi, ift, msgs, tab, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; err = $f.err; err$1 = $f.err$1; ifat = $f.ifat; ifi = $f.ifi; ift = $f.ift; msgs = $f.msgs; tab = $f.tab; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$9 = syscall.NetlinkRIB(22, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
tab = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType$7.nil, os.NewSyscallError("netlinkrib", err)];
|
|
}
|
|
_tuple$1 = syscall.ParseNetlinkMessage(tab);
|
|
msgs = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType$7.nil, os.NewSyscallError("parsenetlinkmessage", err)];
|
|
}
|
|
ift = sliceType$8.nil;
|
|
/* */ if (ifi === ptrType$23.nil) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (ifi === ptrType$23.nil) { */ case 2:
|
|
err$1 = $ifaceNil;
|
|
_r$10 = interfaceTable(0); /* */ $s = 4; case 4: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$10;
|
|
ift = _tuple$2[0];
|
|
err$1 = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [sliceType$7.nil, err$1];
|
|
}
|
|
/* } */ case 3:
|
|
_tuple$3 = addrTable(ift, ifi, msgs);
|
|
ifat = _tuple$3[0];
|
|
err = _tuple$3[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [sliceType$7.nil, err];
|
|
}
|
|
$s = -1; return [ifat, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: interfaceAddrTable }; } $f._r$10 = _r$10; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.err = err; $f.err$1 = err$1; $f.ifat = ifat; $f.ifi = ifi; $f.ift = ift; $f.msgs = msgs; $f.tab = tab; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
addrTable = function(ift, ifi, msgs) {
|
|
var _1, _i, _ref, _tuple, _tuple$1, attrs, err, err$1, ifa, ifam, ifat, ifi, ift, m, msgs;
|
|
ifat = sliceType$7.nil;
|
|
_ref = msgs;
|
|
_i = 0;
|
|
loop:
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
m = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syscall.NetlinkMessage);
|
|
_1 = m.Header.Type;
|
|
if (_1 === (3)) {
|
|
break loop;
|
|
} else if (_1 === (20)) {
|
|
ifam = ($pointerOfStructConversion(($sliceToArray(m.Data)), ptrType$25));
|
|
if (!((ift.$length === 0)) || (ifi.Index === ((ifam.Index >> 0)))) {
|
|
if (!((ift.$length === 0))) {
|
|
err = $ifaceNil;
|
|
_tuple = interfaceByIndex(ift, ((ifam.Index >> 0)));
|
|
ifi = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return [sliceType$7.nil, err];
|
|
}
|
|
}
|
|
_tuple$1 = syscall.ParseNetlinkRouteAttr(m);
|
|
attrs = _tuple$1[0];
|
|
err$1 = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
return [sliceType$7.nil, os.NewSyscallError("parsenetlinkrouteattr", err$1)];
|
|
}
|
|
ifa = newAddr(ifam, attrs);
|
|
if (!($interfaceIsEqual(ifa, $ifaceNil))) {
|
|
ifat = $append(ifat, ifa);
|
|
}
|
|
}
|
|
}
|
|
_i++;
|
|
}
|
|
return [ifat, $ifaceNil];
|
|
};
|
|
newAddr = function(ifam, attrs) {
|
|
var _1, _i, _i$1, _ref, _ref$1, a, a$1, attrs, ifa, ifam, ipPointToPoint, x, x$1, x$2, x$3;
|
|
ipPointToPoint = false;
|
|
_ref = attrs;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
a = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), syscall.NetlinkRouteAttr);
|
|
if (a.Attr.Type === 2) {
|
|
ipPointToPoint = true;
|
|
break;
|
|
}
|
|
_i++;
|
|
}
|
|
_ref$1 = attrs;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
a$1 = $clone(((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]), syscall.NetlinkRouteAttr);
|
|
if (ipPointToPoint && (a$1.Attr.Type === 1)) {
|
|
_i$1++;
|
|
continue;
|
|
}
|
|
_1 = ifam.Family;
|
|
if (_1 === (2)) {
|
|
return new IPNet.ptr(IPv4((x = a$1.Value, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])), (x$1 = a$1.Value, (1 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 1])), (x$2 = a$1.Value, (2 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 2])), (x$3 = a$1.Value, (3 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 3]))), CIDRMask(((ifam.Prefixlen >> 0)), 32));
|
|
} else if (_1 === (10)) {
|
|
ifa = new IPNet.ptr($makeSlice(IP, 16), CIDRMask(((ifam.Prefixlen >> 0)), 128));
|
|
$copySlice(ifa.IP, a$1.Value);
|
|
return ifa;
|
|
}
|
|
_i$1++;
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
interfaceMulticastAddrTable = function(ifi) {
|
|
var _r$10, _r$9, ifi, ifmat4, ifmat6, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$9 = $f._r$9; ifi = $f.ifi; ifmat4 = $f.ifmat4; ifmat6 = $f.ifmat6; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$9 = parseProcNetIGMP("/proc/net/igmp", ifi); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
ifmat4 = _r$9;
|
|
_r$10 = parseProcNetIGMP6("/proc/net/igmp6", ifi); /* */ $s = 2; case 2: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
ifmat6 = _r$10;
|
|
$s = -1; return [$appendSlice(ifmat4, ifmat6), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: interfaceMulticastAddrTable }; } $f._r$10 = _r$10; $f._r$9 = _r$9; $f.ifi = ifi; $f.ifmat4 = ifmat4; $f.ifmat6 = ifmat6; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseProcNetIGMP = function(path, ifi) {
|
|
var _q, _r$10, _r$11, _r$12, _r$13, _r$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, b, err, f, fd, i, i$1, ifi, ifma, ifmat, l, name, ok, path, x, x$1, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; b = $f.b; err = $f.err; f = $f.f; fd = $f.fd; i = $f.i; i$1 = $f.i$1; ifi = $f.ifi; ifma = $f.ifma; ifmat = $f.ifmat; l = $f.l; name = $f.name; ok = $f.ok; path = $f.path; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
_r$9 = open(path); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
fd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return sliceType$7.nil;
|
|
}
|
|
$deferred.push([$methodVal(fd, "close"), []]);
|
|
ifmat = sliceType$7.nil;
|
|
name = "";
|
|
_r$10 = fd.readLine(); /* */ $s = 2; case 2: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_r$10;
|
|
b = $makeSlice(sliceType$1, 4);
|
|
_r$11 = fd.readLine(); /* */ $s = 3; case 3: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$11;
|
|
l = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
/* while (true) { */ case 4:
|
|
/* if (!(ok)) { break; } */ if(!(ok)) { $s = 5; continue; }
|
|
f = splitAtBytes(l, " :\r\t\n");
|
|
/* */ if (f.$length < 4) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (f.$length < 4) { */ case 6:
|
|
_r$12 = fd.readLine(); /* */ $s = 8; case 8: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$12;
|
|
l = _tuple$2[0];
|
|
ok = _tuple$2[1];
|
|
/* continue; */ $s = 4; continue;
|
|
/* } */ case 7:
|
|
if (!((l.charCodeAt(0) === 32)) && !((l.charCodeAt(0) === 9))) {
|
|
name = (1 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 1]);
|
|
} else if (((0 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 0]).length === 8)) {
|
|
if (ifi === ptrType$23.nil || name === ifi.Name) {
|
|
i = 0;
|
|
while (true) {
|
|
if (!((i + 1 >> 0) < (0 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 0]).length)) { break; }
|
|
_tuple$3 = xtoi2($substring((0 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 0]), i, (i + 2 >> 0)), 0);
|
|
(x = (_q = i / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")), ((x < 0 || x >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + x] = _tuple$3[0]));
|
|
i = i + (2) >> 0;
|
|
}
|
|
i$1 = (x$1 = $subslice(b, 0, 4), (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0]));
|
|
ifma = new IPAddr.ptr(IPv4((((i$1 >>> 24 >>> 0) << 24 >>> 24)), (((i$1 >>> 16 >>> 0) << 24 >>> 24)), (((i$1 >>> 8 >>> 0) << 24 >>> 24)), ((i$1 << 24 >>> 24))), "");
|
|
ifmat = $append(ifmat, ifma);
|
|
}
|
|
}
|
|
_r$13 = fd.readLine(); /* */ $s = 9; case 9: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$13;
|
|
l = _tuple$4[0];
|
|
ok = _tuple$4[1];
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return ifmat;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return sliceType$7.nil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: parseProcNetIGMP }; } $f._q = _q; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.b = b; $f.err = err; $f.f = f; $f.fd = fd; $f.i = i; $f.i$1 = i$1; $f.ifi = ifi; $f.ifma = ifma; $f.ifmat = ifmat; $f.l = l; $f.name = name; $f.ok = ok; $f.path = path; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
parseProcNetIGMP6 = function(path, ifi) {
|
|
var _q, _r$10, _r$11, _r$12, _r$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, b, err, f, fd, i, ifi, ifma, ifmat, l, ok, path, x, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; b = $f.b; err = $f.err; f = $f.f; fd = $f.fd; i = $f.i; ifi = $f.ifi; ifma = $f.ifma; ifmat = $f.ifmat; l = $f.l; ok = $f.ok; path = $f.path; x = $f.x; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
_r$9 = open(path); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
fd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return sliceType$7.nil;
|
|
}
|
|
$deferred.push([$methodVal(fd, "close"), []]);
|
|
ifmat = sliceType$7.nil;
|
|
b = $makeSlice(sliceType$1, 16);
|
|
_r$10 = fd.readLine(); /* */ $s = 2; case 2: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$10;
|
|
l = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
/* while (true) { */ case 3:
|
|
/* if (!(ok)) { break; } */ if(!(ok)) { $s = 4; continue; }
|
|
f = splitAtBytes(l, " \r\t\n");
|
|
/* */ if (f.$length < 6) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (f.$length < 6) { */ case 5:
|
|
_r$11 = fd.readLine(); /* */ $s = 7; case 7: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$11;
|
|
l = _tuple$2[0];
|
|
ok = _tuple$2[1];
|
|
/* continue; */ $s = 3; continue;
|
|
/* } */ case 6:
|
|
if (ifi === ptrType$23.nil || (1 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 1]) === ifi.Name) {
|
|
i = 0;
|
|
while (true) {
|
|
if (!((i + 1 >> 0) < (2 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 2]).length)) { break; }
|
|
_tuple$3 = xtoi2($substring((2 >= f.$length ? ($throwRuntimeError("index out of range"), undefined) : f.$array[f.$offset + 2]), i, (i + 2 >> 0)), 0);
|
|
(x = (_q = i / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")), ((x < 0 || x >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + x] = _tuple$3[0]));
|
|
i = i + (2) >> 0;
|
|
}
|
|
ifma = new IPAddr.ptr(new IP([(0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]), (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]), (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]), (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]), (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]), (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]), (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]), (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]), (8 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 8]), (9 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 9]), (10 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 10]), (11 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 11]), (12 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 12]), (13 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 13]), (14 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 14]), (15 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 15])]), "");
|
|
ifmat = $append(ifmat, ifma);
|
|
}
|
|
_r$12 = fd.readLine(); /* */ $s = 8; case 8: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$12;
|
|
l = _tuple$4[0];
|
|
ok = _tuple$4[1];
|
|
/* } */ $s = 3; continue; case 4:
|
|
$s = -1; return ifmat;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return sliceType$7.nil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: parseProcNetIGMP6 }; } $f._q = _q; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.b = b; $f.err = err; $f.f = f; $f.fd = fd; $f.i = i; $f.ifi = ifi; $f.ifma = ifma; $f.ifmat = ifmat; $f.l = l; $f.ok = ok; $f.path = path; $f.x = x; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
IPv4 = function(a, b, c, d) {
|
|
var a, b, c, d, p;
|
|
p = $makeSlice(IP, 16);
|
|
$copySlice(p, v4InV6Prefix);
|
|
(12 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 12] = a);
|
|
(13 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 13] = b);
|
|
(14 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 14] = c);
|
|
(15 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 15] = d);
|
|
return p;
|
|
};
|
|
$pkg.IPv4 = IPv4;
|
|
IPv4Mask = function(a, b, c, d) {
|
|
var a, b, c, d, p;
|
|
p = $makeSlice(IPMask, 4);
|
|
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = a);
|
|
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = b);
|
|
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = c);
|
|
(3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3] = d);
|
|
return p;
|
|
};
|
|
$pkg.IPv4Mask = IPv4Mask;
|
|
CIDRMask = function(ones, bits) {
|
|
var _q, bits, i, l, m, n, ones, y;
|
|
if (!((bits === 32)) && !((bits === 128))) {
|
|
return IPMask.nil;
|
|
}
|
|
if (ones < 0 || ones > bits) {
|
|
return IPMask.nil;
|
|
}
|
|
l = (_q = bits / 8, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
m = $makeSlice(IPMask, l);
|
|
n = ((ones >>> 0));
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < l)) { break; }
|
|
if (n >= 8) {
|
|
((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i] = 255);
|
|
n = n - (8) >>> 0;
|
|
i = i + (1) >> 0;
|
|
continue;
|
|
}
|
|
((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i] = (~(((y = n, y < 32 ? (255 >>> y) : 0) << 24 >>> 24)) << 24 >>> 24));
|
|
n = 0;
|
|
i = i + (1) >> 0;
|
|
}
|
|
return m;
|
|
};
|
|
$pkg.CIDRMask = CIDRMask;
|
|
IP.prototype.IsUnspecified = function() {
|
|
var ip;
|
|
ip = this;
|
|
return ip.Equal($pkg.IPv4zero) || ip.Equal($pkg.IPv6unspecified);
|
|
};
|
|
$ptrType(IP).prototype.IsUnspecified = function() { return this.$get().IsUnspecified(); };
|
|
IP.prototype.IsLoopback = function() {
|
|
var ip, ip4;
|
|
ip = this;
|
|
ip4 = ip.To4();
|
|
if (!(ip4 === IP.nil)) {
|
|
return (0 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 0]) === 127;
|
|
}
|
|
return ip.Equal($pkg.IPv6loopback);
|
|
};
|
|
$ptrType(IP).prototype.IsLoopback = function() { return this.$get().IsLoopback(); };
|
|
IP.prototype.IsMulticast = function() {
|
|
var ip, ip4;
|
|
ip = this;
|
|
ip4 = ip.To4();
|
|
if (!(ip4 === IP.nil)) {
|
|
return (((0 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 0]) & 240) >>> 0) === 224;
|
|
}
|
|
return (ip.$length === 16) && ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) === 255);
|
|
};
|
|
$ptrType(IP).prototype.IsMulticast = function() { return this.$get().IsMulticast(); };
|
|
IP.prototype.IsInterfaceLocalMulticast = function() {
|
|
var ip;
|
|
ip = this;
|
|
return (ip.$length === 16) && ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) === 255) && ((((1 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 1]) & 15) >>> 0) === 1);
|
|
};
|
|
$ptrType(IP).prototype.IsInterfaceLocalMulticast = function() { return this.$get().IsInterfaceLocalMulticast(); };
|
|
IP.prototype.IsLinkLocalMulticast = function() {
|
|
var ip, ip4;
|
|
ip = this;
|
|
ip4 = ip.To4();
|
|
if (!(ip4 === IP.nil)) {
|
|
return ((0 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 0]) === 224) && ((1 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 1]) === 0) && ((2 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 2]) === 0);
|
|
}
|
|
return (ip.$length === 16) && ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) === 255) && ((((1 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 1]) & 15) >>> 0) === 2);
|
|
};
|
|
$ptrType(IP).prototype.IsLinkLocalMulticast = function() { return this.$get().IsLinkLocalMulticast(); };
|
|
IP.prototype.IsLinkLocalUnicast = function() {
|
|
var ip, ip4;
|
|
ip = this;
|
|
ip4 = ip.To4();
|
|
if (!(ip4 === IP.nil)) {
|
|
return ((0 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 0]) === 169) && ((1 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 1]) === 254);
|
|
}
|
|
return (ip.$length === 16) && ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) === 254) && ((((1 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 1]) & 192) >>> 0) === 128);
|
|
};
|
|
$ptrType(IP).prototype.IsLinkLocalUnicast = function() { return this.$get().IsLinkLocalUnicast(); };
|
|
IP.prototype.IsGlobalUnicast = function() {
|
|
var ip;
|
|
ip = this;
|
|
return ((ip.$length === 4) || (ip.$length === 16)) && !ip.Equal($pkg.IPv4bcast) && !ip.IsUnspecified() && !ip.IsLoopback() && !ip.IsMulticast() && !ip.IsLinkLocalUnicast();
|
|
};
|
|
$ptrType(IP).prototype.IsGlobalUnicast = function() { return this.$get().IsGlobalUnicast(); };
|
|
isZeros = function(p) {
|
|
var i, p;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < p.$length)) { break; }
|
|
if (!((((i < 0 || i >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i]) === 0))) {
|
|
return false;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
IP.prototype.To4 = function() {
|
|
var ip;
|
|
ip = this;
|
|
if (ip.$length === 4) {
|
|
return ip;
|
|
}
|
|
if ((ip.$length === 16) && isZeros($subslice(ip, 0, 10)) && ((10 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 10]) === 255) && ((11 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 11]) === 255)) {
|
|
return $subslice(ip, 12, 16);
|
|
}
|
|
return IP.nil;
|
|
};
|
|
$ptrType(IP).prototype.To4 = function() { return this.$get().To4(); };
|
|
IP.prototype.To16 = function() {
|
|
var ip;
|
|
ip = this;
|
|
if (ip.$length === 4) {
|
|
return IPv4((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]), (1 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 1]), (2 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 2]), (3 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 3]));
|
|
}
|
|
if (ip.$length === 16) {
|
|
return ip;
|
|
}
|
|
return IP.nil;
|
|
};
|
|
$ptrType(IP).prototype.To16 = function() { return this.$get().To16(); };
|
|
IP.prototype.DefaultMask = function() {
|
|
var ip;
|
|
ip = this;
|
|
ip = ip.To4();
|
|
if (ip === IP.nil) {
|
|
return IPMask.nil;
|
|
}
|
|
if ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) < 128) {
|
|
return classAMask;
|
|
} else if ((0 >= ip.$length ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + 0]) < 192) {
|
|
return classBMask;
|
|
} else {
|
|
return classCMask;
|
|
}
|
|
};
|
|
$ptrType(IP).prototype.DefaultMask = function() { return this.$get().DefaultMask(); };
|
|
allFF = function(b) {
|
|
var _i, _ref, b, c;
|
|
_ref = b;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (!((c === 255))) {
|
|
return false;
|
|
}
|
|
_i++;
|
|
}
|
|
return true;
|
|
};
|
|
IP.prototype.Mask = function(mask) {
|
|
var i, ip, mask, n, out, x, x$1;
|
|
ip = this;
|
|
if ((mask.$length === 16) && (ip.$length === 4) && allFF((x = $subslice(mask, 0, 12), $subslice(new sliceType$1(x.$array), x.$offset, x.$offset + x.$length)))) {
|
|
mask = $subslice(mask, 12);
|
|
}
|
|
if ((mask.$length === 4) && (ip.$length === 16) && bytealg.Equal((x$1 = $subslice(ip, 0, 12), $subslice(new sliceType$1(x$1.$array), x$1.$offset, x$1.$offset + x$1.$length)), v4InV6Prefix)) {
|
|
ip = $subslice(ip, 12);
|
|
}
|
|
n = ip.$length;
|
|
if (!((n === mask.$length))) {
|
|
return IP.nil;
|
|
}
|
|
out = $makeSlice(IP, n);
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < n)) { break; }
|
|
((i < 0 || i >= out.$length) ? ($throwRuntimeError("index out of range"), undefined) : out.$array[out.$offset + i] = ((((i < 0 || i >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + i]) & ((i < 0 || i >= mask.$length) ? ($throwRuntimeError("index out of range"), undefined) : mask.$array[mask.$offset + i])) >>> 0));
|
|
i = i + (1) >> 0;
|
|
}
|
|
return out;
|
|
};
|
|
$ptrType(IP).prototype.Mask = function(mask) { return this.$get().Mask(mask); };
|
|
ubtoa = function(dst, start, v) {
|
|
var _q, _q$1, _q$2, _r$10, _r$11, _r$9, dst, start, v, x, x$1, x$2;
|
|
if (v < 10) {
|
|
((start < 0 || start >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + start] = (v + 48 << 24 >>> 24));
|
|
return 1;
|
|
} else if (v < 100) {
|
|
(x = start + 1 >> 0, ((x < 0 || x >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + x] = ((_r$9 = v % 10, _r$9 === _r$9 ? _r$9 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24)));
|
|
((start < 0 || start >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + start] = ((_q = v / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24));
|
|
return 2;
|
|
}
|
|
(x$1 = start + 2 >> 0, ((x$1 < 0 || x$1 >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + x$1] = ((_r$10 = v % 10, _r$10 === _r$10 ? _r$10 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24)));
|
|
(x$2 = start + 1 >> 0, ((x$2 < 0 || x$2 >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + x$2] = ((_r$11 = ((_q$1 = v / 10, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"))) % 10, _r$11 === _r$11 ? _r$11 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24)));
|
|
((start < 0 || start >= dst.$length) ? ($throwRuntimeError("index out of range"), undefined) : dst.$array[dst.$offset + start] = ((_q$2 = v / 100, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >>> 0 : $throwRuntimeError("integer divide by zero")) + 48 << 24 >>> 24));
|
|
return 3;
|
|
};
|
|
IP.prototype.String = function() {
|
|
var b, b$1, e0, e1, i, i$1, ip, j, n, p, p4, x, x$1;
|
|
ip = this;
|
|
p = ip;
|
|
if (ip.$length === 0) {
|
|
return "<nil>";
|
|
}
|
|
p4 = p.To4();
|
|
if (p4.$length === 4) {
|
|
b = $makeSlice(sliceType$1, 15);
|
|
n = ubtoa(b, 0, (0 >= p4.$length ? ($throwRuntimeError("index out of range"), undefined) : p4.$array[p4.$offset + 0]));
|
|
((n < 0 || n >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + n] = 46);
|
|
n = n + (1) >> 0;
|
|
n = n + (ubtoa(b, n, (1 >= p4.$length ? ($throwRuntimeError("index out of range"), undefined) : p4.$array[p4.$offset + 1]))) >> 0;
|
|
((n < 0 || n >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + n] = 46);
|
|
n = n + (1) >> 0;
|
|
n = n + (ubtoa(b, n, (2 >= p4.$length ? ($throwRuntimeError("index out of range"), undefined) : p4.$array[p4.$offset + 2]))) >> 0;
|
|
((n < 0 || n >= b.$length) ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + n] = 46);
|
|
n = n + (1) >> 0;
|
|
n = n + (ubtoa(b, n, (3 >= p4.$length ? ($throwRuntimeError("index out of range"), undefined) : p4.$array[p4.$offset + 3]))) >> 0;
|
|
return ($bytesToString($subslice(b, 0, n)));
|
|
}
|
|
if (!((p.$length === 16))) {
|
|
return "?" + hexString($subslice(new sliceType$1(ip.$array), ip.$offset, ip.$offset + ip.$length));
|
|
}
|
|
e0 = -1;
|
|
e1 = -1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 16)) { break; }
|
|
j = i;
|
|
while (true) {
|
|
if (!(j < 16 && (((j < 0 || j >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + j]) === 0) && ((x = j + 1 >> 0, ((x < 0 || x >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x])) === 0))) { break; }
|
|
j = j + (2) >> 0;
|
|
}
|
|
if (j > i && (j - i >> 0) > (e1 - e0 >> 0)) {
|
|
e0 = i;
|
|
e1 = j;
|
|
i = j;
|
|
}
|
|
i = i + (2) >> 0;
|
|
}
|
|
if ((e1 - e0 >> 0) <= 2) {
|
|
e0 = -1;
|
|
e1 = -1;
|
|
}
|
|
b$1 = $makeSlice(sliceType$1, 0, 39);
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < 16)) { break; }
|
|
if (i$1 === e0) {
|
|
b$1 = $append(b$1, 58, 58);
|
|
i$1 = e1;
|
|
if (i$1 >= 16) {
|
|
break;
|
|
}
|
|
} else if (i$1 > 0) {
|
|
b$1 = $append(b$1, 58);
|
|
}
|
|
b$1 = appendHex(b$1, (((((((i$1 < 0 || i$1 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + i$1]) >>> 0)) << 8 >>> 0)) | (((x$1 = i$1 + 1 >> 0, ((x$1 < 0 || x$1 >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + x$1])) >>> 0))) >>> 0);
|
|
i$1 = i$1 + (2) >> 0;
|
|
}
|
|
return ($bytesToString(b$1));
|
|
};
|
|
$ptrType(IP).prototype.String = function() { return this.$get().String(); };
|
|
hexString = function(b) {
|
|
var _i, _ref, _tmp, _tmp$1, b, i, s, tn, x, x$1;
|
|
s = $makeSlice(sliceType$1, ($imul(b.$length, 2)));
|
|
_ref = b;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
tn = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
_tmp = "0123456789abcdef".charCodeAt((tn >>> 4 << 24 >>> 24));
|
|
_tmp$1 = "0123456789abcdef".charCodeAt(((tn & 15) >>> 0));
|
|
(x = $imul(i, 2), ((x < 0 || x >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + x] = _tmp));
|
|
(x$1 = ($imul(i, 2)) + 1 >> 0, ((x$1 < 0 || x$1 >= s.$length) ? ($throwRuntimeError("index out of range"), undefined) : s.$array[s.$offset + x$1] = _tmp$1));
|
|
_i++;
|
|
}
|
|
return ($bytesToString(s));
|
|
};
|
|
ipEmptyString = function(ip) {
|
|
var ip;
|
|
if (ip.$length === 0) {
|
|
return "";
|
|
}
|
|
return ip.String();
|
|
};
|
|
IP.prototype.MarshalText = function() {
|
|
var ip;
|
|
ip = this;
|
|
if (ip.$length === 0) {
|
|
return [(new sliceType$1($stringToBytes(""))), $ifaceNil];
|
|
}
|
|
if (!((ip.$length === 4)) && !((ip.$length === 16))) {
|
|
return [sliceType$1.nil, new AddrError.ptr("invalid IP address", hexString($subslice(new sliceType$1(ip.$array), ip.$offset, ip.$offset + ip.$length)))];
|
|
}
|
|
return [(new sliceType$1($stringToBytes(ip.String()))), $ifaceNil];
|
|
};
|
|
$ptrType(IP).prototype.MarshalText = function() { return this.$get().MarshalText(); };
|
|
$ptrType(IP).prototype.UnmarshalText = function(text) {
|
|
var ip, s, text, x;
|
|
ip = this;
|
|
if (text.$length === 0) {
|
|
ip.$set(IP.nil);
|
|
return $ifaceNil;
|
|
}
|
|
s = ($bytesToString(text));
|
|
x = ParseIP(s);
|
|
if (x === IP.nil) {
|
|
return new ParseError.ptr("IP address", s);
|
|
}
|
|
ip.$set(x);
|
|
return $ifaceNil;
|
|
};
|
|
IP.prototype.Equal = function(x) {
|
|
var ip, x, x$1, x$2, x$3, x$4;
|
|
ip = this;
|
|
if (ip.$length === x.$length) {
|
|
return bytealg.Equal($subslice(new sliceType$1(ip.$array), ip.$offset, ip.$offset + ip.$length), $subslice(new sliceType$1(x.$array), x.$offset, x.$offset + x.$length));
|
|
}
|
|
if ((ip.$length === 4) && (x.$length === 16)) {
|
|
return bytealg.Equal((x$1 = $subslice(x, 0, 12), $subslice(new sliceType$1(x$1.$array), x$1.$offset, x$1.$offset + x$1.$length)), v4InV6Prefix) && bytealg.Equal($subslice(new sliceType$1(ip.$array), ip.$offset, ip.$offset + ip.$length), (x$2 = $subslice(x, 12), $subslice(new sliceType$1(x$2.$array), x$2.$offset, x$2.$offset + x$2.$length)));
|
|
}
|
|
if ((ip.$length === 16) && (x.$length === 4)) {
|
|
return bytealg.Equal((x$3 = $subslice(ip, 0, 12), $subslice(new sliceType$1(x$3.$array), x$3.$offset, x$3.$offset + x$3.$length)), v4InV6Prefix) && bytealg.Equal((x$4 = $subslice(ip, 12), $subslice(new sliceType$1(x$4.$array), x$4.$offset, x$4.$offset + x$4.$length)), $subslice(new sliceType$1(x.$array), x.$offset, x.$offset + x.$length));
|
|
}
|
|
return false;
|
|
};
|
|
$ptrType(IP).prototype.Equal = function(x) { return this.$get().Equal(x); };
|
|
simpleMaskLength = function(mask) {
|
|
var _i, _ref, i, mask, n, v, y;
|
|
n = 0;
|
|
_ref = mask;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
v = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (v === 255) {
|
|
n = n + (8) >> 0;
|
|
_i++;
|
|
continue;
|
|
}
|
|
while (true) {
|
|
if (!(!((((v & 128) >>> 0) === 0)))) { break; }
|
|
n = n + (1) >> 0;
|
|
v = (y = (1), y < 32 ? (v << y) : 0) << 24 >>> 24;
|
|
}
|
|
if (!((v === 0))) {
|
|
return -1;
|
|
}
|
|
i = i + (1) >> 0;
|
|
while (true) {
|
|
if (!(i < mask.$length)) { break; }
|
|
if (!((((i < 0 || i >= mask.$length) ? ($throwRuntimeError("index out of range"), undefined) : mask.$array[mask.$offset + i]) === 0))) {
|
|
return -1;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
break;
|
|
}
|
|
return n;
|
|
};
|
|
IPMask.prototype.Size = function() {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, bits, m, ones;
|
|
ones = 0;
|
|
bits = 0;
|
|
m = this;
|
|
_tmp = simpleMaskLength(m);
|
|
_tmp$1 = $imul(m.$length, 8);
|
|
ones = _tmp;
|
|
bits = _tmp$1;
|
|
if (ones === -1) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = 0;
|
|
ones = _tmp$2;
|
|
bits = _tmp$3;
|
|
return [ones, bits];
|
|
}
|
|
return [ones, bits];
|
|
};
|
|
$ptrType(IPMask).prototype.Size = function() { return this.$get().Size(); };
|
|
IPMask.prototype.String = function() {
|
|
var m;
|
|
m = this;
|
|
if (m.$length === 0) {
|
|
return "<nil>";
|
|
}
|
|
return hexString($subslice(new sliceType$1(m.$array), m.$offset, m.$offset + m.$length));
|
|
};
|
|
$ptrType(IPMask).prototype.String = function() { return this.$get().String(); };
|
|
networkNumberAndMask = function(n) {
|
|
var _1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, ip, m, n;
|
|
ip = IP.nil;
|
|
m = IPMask.nil;
|
|
ip = n.IP.To4();
|
|
if (ip === IP.nil) {
|
|
ip = n.IP;
|
|
if (!((ip.$length === 16))) {
|
|
_tmp = IP.nil;
|
|
_tmp$1 = IPMask.nil;
|
|
ip = _tmp;
|
|
m = _tmp$1;
|
|
return [ip, m];
|
|
}
|
|
}
|
|
m = n.Mask;
|
|
_1 = m.$length;
|
|
if (_1 === (4)) {
|
|
if (!((ip.$length === 4))) {
|
|
_tmp$2 = IP.nil;
|
|
_tmp$3 = IPMask.nil;
|
|
ip = _tmp$2;
|
|
m = _tmp$3;
|
|
return [ip, m];
|
|
}
|
|
} else if (_1 === (16)) {
|
|
if (ip.$length === 4) {
|
|
m = $subslice(m, 12);
|
|
}
|
|
} else {
|
|
_tmp$4 = IP.nil;
|
|
_tmp$5 = IPMask.nil;
|
|
ip = _tmp$4;
|
|
m = _tmp$5;
|
|
return [ip, m];
|
|
}
|
|
return [ip, m];
|
|
};
|
|
IPNet.ptr.prototype.Contains = function(ip) {
|
|
var _tuple, i, ip, l, m, n, nn, x;
|
|
n = this;
|
|
_tuple = networkNumberAndMask(n);
|
|
nn = _tuple[0];
|
|
m = _tuple[1];
|
|
x = ip.To4();
|
|
if (!(x === IP.nil)) {
|
|
ip = x;
|
|
}
|
|
l = ip.$length;
|
|
if (!((l === nn.$length))) {
|
|
return false;
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < l)) { break; }
|
|
if (!((((((i < 0 || i >= nn.$length) ? ($throwRuntimeError("index out of range"), undefined) : nn.$array[nn.$offset + i]) & ((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i])) >>> 0) === ((((i < 0 || i >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + i]) & ((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i])) >>> 0)))) {
|
|
return false;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
IPNet.prototype.Contains = function(ip) { return this.$val.Contains(ip); };
|
|
IPNet.ptr.prototype.Network = function() {
|
|
var n;
|
|
n = this;
|
|
return "ip+net";
|
|
};
|
|
IPNet.prototype.Network = function() { return this.$val.Network(); };
|
|
IPNet.ptr.prototype.String = function() {
|
|
var _tuple, l, m, n, nn;
|
|
n = this;
|
|
_tuple = networkNumberAndMask(n);
|
|
nn = _tuple[0];
|
|
m = _tuple[1];
|
|
if (nn === IP.nil || m === IPMask.nil) {
|
|
return "<nil>";
|
|
}
|
|
l = simpleMaskLength(m);
|
|
if (l === -1) {
|
|
return nn.String() + "/" + m.String();
|
|
}
|
|
return nn.String() + "/" + uitoa(((l >>> 0)));
|
|
};
|
|
IPNet.prototype.String = function() { return this.$val.String(); };
|
|
parseIPv4 = function(s) {
|
|
var _tuple, c, i, n, ok, p, s;
|
|
p = arrayType$2.zero();
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 4)) { break; }
|
|
if (s.length === 0) {
|
|
return IP.nil;
|
|
}
|
|
if (i > 0) {
|
|
if (!((s.charCodeAt(0) === 46))) {
|
|
return IP.nil;
|
|
}
|
|
s = $substring(s, 1);
|
|
}
|
|
_tuple = dtoi(s);
|
|
n = _tuple[0];
|
|
c = _tuple[1];
|
|
ok = _tuple[2];
|
|
if (!ok || n > 255) {
|
|
return IP.nil;
|
|
}
|
|
s = $substring(s, c);
|
|
((i < 0 || i >= p.length) ? ($throwRuntimeError("index out of range"), undefined) : p[i] = ((n << 24 >>> 24)));
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (!((s.length === 0))) {
|
|
return IP.nil;
|
|
}
|
|
return IPv4(p[0], p[1], p[2], p[3]);
|
|
};
|
|
parseIPv6 = function(s) {
|
|
var _tuple, c, ellipsis, i, ip, ip4, j, j$1, n, n$1, ok, s, x, x$1, x$2, x$3, x$4;
|
|
ip = IP.nil;
|
|
ip = $makeSlice(IP, 16);
|
|
ellipsis = -1;
|
|
if (s.length >= 2 && (s.charCodeAt(0) === 58) && (s.charCodeAt(1) === 58)) {
|
|
ellipsis = 0;
|
|
s = $substring(s, 2);
|
|
if (s.length === 0) {
|
|
ip = ip;
|
|
return ip;
|
|
}
|
|
}
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < 16)) { break; }
|
|
_tuple = xtoi(s);
|
|
n = _tuple[0];
|
|
c = _tuple[1];
|
|
ok = _tuple[2];
|
|
if (!ok || n > 65535) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
if (c < s.length && (s.charCodeAt(c) === 46)) {
|
|
if (ellipsis < 0 && !((i === 12))) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
if ((i + 4 >> 0) > 16) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
ip4 = parseIPv4(s);
|
|
if (ip4 === IP.nil) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
((i < 0 || i >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + i] = (12 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 12]));
|
|
(x = i + 1 >> 0, ((x < 0 || x >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + x] = (13 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 13])));
|
|
(x$1 = i + 2 >> 0, ((x$1 < 0 || x$1 >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + x$1] = (14 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 14])));
|
|
(x$2 = i + 3 >> 0, ((x$2 < 0 || x$2 >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + x$2] = (15 >= ip4.$length ? ($throwRuntimeError("index out of range"), undefined) : ip4.$array[ip4.$offset + 15])));
|
|
s = "";
|
|
i = i + (4) >> 0;
|
|
break;
|
|
}
|
|
((i < 0 || i >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + i] = (((n >> 8 >> 0) << 24 >>> 24)));
|
|
(x$3 = i + 1 >> 0, ((x$3 < 0 || x$3 >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + x$3] = ((n << 24 >>> 24))));
|
|
i = i + (2) >> 0;
|
|
s = $substring(s, c);
|
|
if (s.length === 0) {
|
|
break;
|
|
}
|
|
if (!((s.charCodeAt(0) === 58)) || (s.length === 1)) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
s = $substring(s, 1);
|
|
if (s.charCodeAt(0) === 58) {
|
|
if (ellipsis >= 0) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
ellipsis = i;
|
|
s = $substring(s, 1);
|
|
if (s.length === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!((s.length === 0))) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
if (i < 16) {
|
|
if (ellipsis < 0) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
n$1 = 16 - i >> 0;
|
|
j = i - 1 >> 0;
|
|
while (true) {
|
|
if (!(j >= ellipsis)) { break; }
|
|
(x$4 = j + n$1 >> 0, ((x$4 < 0 || x$4 >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + x$4] = ((j < 0 || j >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + j])));
|
|
j = j - (1) >> 0;
|
|
}
|
|
j$1 = (ellipsis + n$1 >> 0) - 1 >> 0;
|
|
while (true) {
|
|
if (!(j$1 >= ellipsis)) { break; }
|
|
((j$1 < 0 || j$1 >= ip.$length) ? ($throwRuntimeError("index out of range"), undefined) : ip.$array[ip.$offset + j$1] = 0);
|
|
j$1 = j$1 - (1) >> 0;
|
|
}
|
|
} else if (ellipsis >= 0) {
|
|
ip = IP.nil;
|
|
return ip;
|
|
}
|
|
ip = ip;
|
|
return ip;
|
|
};
|
|
ParseIP = function(s) {
|
|
var _1, i, s;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
_1 = s.charCodeAt(i);
|
|
if (_1 === (46)) {
|
|
return parseIPv4(s);
|
|
} else if (_1 === (58)) {
|
|
return parseIPv6(s);
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return IP.nil;
|
|
};
|
|
$pkg.ParseIP = ParseIP;
|
|
ParseCIDR = function(s) {
|
|
var _tmp, _tmp$1, _tuple, addr, i, ip, iplen, m, mask, n, ok, s;
|
|
i = bytealg.IndexByteString(s, 47);
|
|
if (i < 0) {
|
|
return [IP.nil, ptrType$5.nil, new ParseError.ptr("CIDR address", s)];
|
|
}
|
|
_tmp = $substring(s, 0, i);
|
|
_tmp$1 = $substring(s, (i + 1 >> 0));
|
|
addr = _tmp;
|
|
mask = _tmp$1;
|
|
iplen = 4;
|
|
ip = parseIPv4(addr);
|
|
if (ip === IP.nil) {
|
|
iplen = 16;
|
|
ip = parseIPv6(addr);
|
|
}
|
|
_tuple = dtoi(mask);
|
|
n = _tuple[0];
|
|
i = _tuple[1];
|
|
ok = _tuple[2];
|
|
if (ip === IP.nil || !ok || !((i === mask.length)) || n < 0 || n > ($imul(8, iplen))) {
|
|
return [IP.nil, ptrType$5.nil, new ParseError.ptr("CIDR address", s)];
|
|
}
|
|
m = CIDRMask(n, $imul(8, iplen));
|
|
return [ip, new IPNet.ptr(ip.Mask(m), m), $ifaceNil];
|
|
};
|
|
$pkg.ParseCIDR = ParseCIDR;
|
|
IPAddr.ptr.prototype.Network = function() {
|
|
var a;
|
|
a = this;
|
|
return "ip";
|
|
};
|
|
IPAddr.prototype.Network = function() { return this.$val.Network(); };
|
|
IPAddr.ptr.prototype.String = function() {
|
|
var a, ip;
|
|
a = this;
|
|
if (a === ptrType$9.nil) {
|
|
return "<nil>";
|
|
}
|
|
ip = ipEmptyString(a.IP);
|
|
if (!(a.Zone === "")) {
|
|
return ip + "%" + a.Zone;
|
|
}
|
|
return ip;
|
|
};
|
|
IPAddr.prototype.String = function() { return this.$val.String(); };
|
|
HardwareAddr.prototype.String = function() {
|
|
var _i, _ref, a, b, buf, i;
|
|
a = this;
|
|
if (a.$length === 0) {
|
|
return "";
|
|
}
|
|
buf = $makeSlice(sliceType$1, 0, (($imul(a.$length, 3)) - 1 >> 0));
|
|
_ref = a;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = _i;
|
|
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
if (i > 0) {
|
|
buf = $append(buf, 58);
|
|
}
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt((b >>> 4 << 24 >>> 24)));
|
|
buf = $append(buf, "0123456789abcdef".charCodeAt(((b & 15) >>> 0)));
|
|
_i++;
|
|
}
|
|
return ($bytesToString(buf));
|
|
};
|
|
$ptrType(HardwareAddr).prototype.String = function() { return this.$get().String(); };
|
|
OpError.ptr.prototype.Error = function() {
|
|
var _r$10, _r$11, _r$9, e, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$9 = $f._r$9; e = $f.e; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
if (e === ptrType$13.nil) {
|
|
$s = -1; return "<nil>";
|
|
}
|
|
s = e.Op;
|
|
if (!(e.Net === "")) {
|
|
s = s + (" " + e.Net);
|
|
}
|
|
/* */ if (!($interfaceIsEqual(e.Source, $ifaceNil))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!($interfaceIsEqual(e.Source, $ifaceNil))) { */ case 1:
|
|
_r$9 = e.Source.String(); /* */ $s = 3; case 3: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
s = s + (" " + _r$9);
|
|
/* } */ case 2:
|
|
/* */ if (!($interfaceIsEqual(e.Addr, $ifaceNil))) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (!($interfaceIsEqual(e.Addr, $ifaceNil))) { */ case 4:
|
|
if (!($interfaceIsEqual(e.Source, $ifaceNil))) {
|
|
s = s + ("->");
|
|
} else {
|
|
s = s + (" ");
|
|
}
|
|
_r$10 = e.Addr.String(); /* */ $s = 6; case 6: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
s = s + (_r$10);
|
|
/* } */ case 5:
|
|
_r$11 = e.Err.Error(); /* */ $s = 7; case 7: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
s = s + (": " + _r$11);
|
|
$s = -1; return s;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: OpError.ptr.prototype.Error }; } $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$9 = _r$9; $f.e = e; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
OpError.prototype.Error = function() { return this.$val.Error(); };
|
|
OpError.ptr.prototype.Timeout = function() {
|
|
var _r$10, _r$9, _tuple, _tuple$1, _tuple$2, _v, _v$1, e, ne, ok, ok$1, ok$2, t, t$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _v = $f._v; _v$1 = $f._v$1; e = $f.e; ne = $f.ne; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; t = $f.t; t$1 = $f.t$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_tuple = $assertType(e.Err, ptrType$31, true);
|
|
ne = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_tuple$1 = $assertType(ne.Err, timeout, true);
|
|
t = _tuple$1[0];
|
|
ok$1 = _tuple$1[1];
|
|
if (!(ok$1)) { _v = false; $s = 3; continue s; }
|
|
_r$9 = t.Timeout(); /* */ $s = 4; case 4: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_v = _r$9; case 3:
|
|
$s = -1; return _v;
|
|
/* } */ case 2:
|
|
_tuple$2 = $assertType(e.Err, timeout, true);
|
|
t$1 = _tuple$2[0];
|
|
ok$2 = _tuple$2[1];
|
|
if (!(ok$2)) { _v$1 = false; $s = 5; continue s; }
|
|
_r$10 = t$1.Timeout(); /* */ $s = 6; case 6: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_v$1 = _r$10; case 5:
|
|
$s = -1; return _v$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: OpError.ptr.prototype.Timeout }; } $f._r$10 = _r$10; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._v = _v; $f._v$1 = _v$1; $f.e = e; $f.ne = ne; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.t = t; $f.t$1 = t$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
OpError.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
OpError.ptr.prototype.Temporary = function() {
|
|
var _r$10, _r$9, _tuple, _tuple$1, _tuple$2, _v, _v$1, e, ne, ok, ok$1, ok$2, t, t$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _v = $f._v; _v$1 = $f._v$1; e = $f.e; ne = $f.ne; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; t = $f.t; t$1 = $f.t$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
if (e.Op === "accept" && isConnError(e.Err)) {
|
|
$s = -1; return true;
|
|
}
|
|
_tuple = $assertType(e.Err, ptrType$31, true);
|
|
ne = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_tuple$1 = $assertType(ne.Err, temporary, true);
|
|
t = _tuple$1[0];
|
|
ok$1 = _tuple$1[1];
|
|
if (!(ok$1)) { _v = false; $s = 3; continue s; }
|
|
_r$9 = t.Temporary(); /* */ $s = 4; case 4: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_v = _r$9; case 3:
|
|
$s = -1; return _v;
|
|
/* } */ case 2:
|
|
_tuple$2 = $assertType(e.Err, temporary, true);
|
|
t$1 = _tuple$2[0];
|
|
ok$2 = _tuple$2[1];
|
|
if (!(ok$2)) { _v$1 = false; $s = 5; continue s; }
|
|
_r$10 = t$1.Temporary(); /* */ $s = 6; case 6: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_v$1 = _r$10; case 5:
|
|
$s = -1; return _v$1;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: OpError.ptr.prototype.Temporary }; } $f._r$10 = _r$10; $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._v = _v; $f._v$1 = _v$1; $f.e = e; $f.ne = ne; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.t = t; $f.t$1 = t$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
OpError.prototype.Temporary = function() { return this.$val.Temporary(); };
|
|
ParseError.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
return "invalid " + e.Type + ": " + e.Text;
|
|
};
|
|
ParseError.prototype.Error = function() { return this.$val.Error(); };
|
|
AddrError.ptr.prototype.Error = function() {
|
|
var e, s;
|
|
e = this;
|
|
if (e === ptrType$32.nil) {
|
|
return "<nil>";
|
|
}
|
|
s = e.Err;
|
|
if (!(e.Addr === "")) {
|
|
s = "address " + e.Addr + ": " + s;
|
|
}
|
|
return s;
|
|
};
|
|
AddrError.prototype.Error = function() { return this.$val.Error(); };
|
|
AddrError.ptr.prototype.Timeout = function() {
|
|
var e;
|
|
e = this;
|
|
return false;
|
|
};
|
|
AddrError.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
AddrError.ptr.prototype.Temporary = function() {
|
|
var e;
|
|
e = this;
|
|
return false;
|
|
};
|
|
AddrError.prototype.Temporary = function() { return this.$val.Temporary(); };
|
|
file.ptr.prototype.close = function() {
|
|
var _r$9, f, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
f = this;
|
|
_r$9 = f.file.Close(); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_r$9;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: file.ptr.prototype.close }; } $f._r$9 = _r$9; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
file.prototype.close = function() { return this.$val.close(); };
|
|
file.ptr.prototype.getLineFromData = function() {
|
|
var data, f, i, n, ok, s;
|
|
s = "";
|
|
ok = false;
|
|
f = this;
|
|
data = f.data;
|
|
i = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < data.$length)) { break; }
|
|
if (((i < 0 || i >= data.$length) ? ($throwRuntimeError("index out of range"), undefined) : data.$array[data.$offset + i]) === 10) {
|
|
s = ($bytesToString($subslice(data, 0, i)));
|
|
ok = true;
|
|
i = i + (1) >> 0;
|
|
n = data.$length - i >> 0;
|
|
$copySlice($subslice(data, 0), $subslice(data, i));
|
|
f.data = $subslice(data, 0, n);
|
|
return [s, ok];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (f.atEOF && f.data.$length > 0) {
|
|
s = ($bytesToString(data));
|
|
f.data = $subslice(f.data, 0, 0);
|
|
ok = true;
|
|
}
|
|
return [s, ok];
|
|
};
|
|
file.prototype.getLineFromData = function() { return this.$val.getLineFromData(); };
|
|
file.ptr.prototype.readLine = function() {
|
|
var _r$9, _tuple, _tuple$1, _tuple$2, err, f, ln, n, ok, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; err = $f.err; f = $f.f; ln = $f.ln; n = $f.n; ok = $f.ok; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = "";
|
|
ok = false;
|
|
f = this;
|
|
_tuple = f.getLineFromData();
|
|
s = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
$s = -1; return [s, ok];
|
|
}
|
|
/* */ if (f.data.$length < f.data.$capacity) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (f.data.$length < f.data.$capacity) { */ case 1:
|
|
ln = f.data.$length;
|
|
_r$9 = io.ReadFull(f.file, $subslice(f.data, ln, f.data.$capacity)); /* */ $s = 3; case 3: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$9;
|
|
n = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (n >= 0) {
|
|
f.data = $subslice(f.data, 0, (ln + n >> 0));
|
|
}
|
|
if ($interfaceIsEqual(err, io.EOF) || $interfaceIsEqual(err, io.ErrUnexpectedEOF)) {
|
|
f.atEOF = true;
|
|
}
|
|
/* } */ case 2:
|
|
_tuple$2 = f.getLineFromData();
|
|
s = _tuple$2[0];
|
|
ok = _tuple$2[1];
|
|
$s = -1; return [s, ok];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: file.ptr.prototype.readLine }; } $f._r$9 = _r$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.err = err; $f.f = f; $f.ln = ln; $f.n = n; $f.ok = ok; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
file.prototype.readLine = function() { return this.$val.readLine(); };
|
|
open = function(name) {
|
|
var _r$9, _tuple, err, fd, name, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$9 = $f._r$9; _tuple = $f._tuple; err = $f.err; fd = $f.fd; name = $f.name; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$9 = os.Open(name); /* */ $s = 1; case 1: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_tuple = _r$9;
|
|
fd = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$22.nil, err];
|
|
}
|
|
$s = -1; return [new file.ptr(fd, $makeSlice(sliceType$1, 0, 65536), false), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: open }; } $f._r$9 = _r$9; $f._tuple = _tuple; $f.err = err; $f.fd = fd; $f.name = name; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
countAnyByte = function(s, t) {
|
|
var i, n, s, t;
|
|
n = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (bytealg.IndexByteString(t, s.charCodeAt(i)) >= 0) {
|
|
n = n + (1) >> 0;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return n;
|
|
};
|
|
splitAtBytes = function(s, t) {
|
|
var a, i, last$1, n, s, t;
|
|
a = $makeSlice(sliceType, (1 + countAnyByte(s, t) >> 0));
|
|
n = 0;
|
|
last$1 = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (bytealg.IndexByteString(t, s.charCodeAt(i)) >= 0) {
|
|
if (last$1 < i) {
|
|
((n < 0 || n >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + n] = $substring(s, last$1, i));
|
|
n = n + (1) >> 0;
|
|
}
|
|
last$1 = i + 1 >> 0;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (last$1 < s.length) {
|
|
((n < 0 || n >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + n] = $substring(s, last$1));
|
|
n = n + (1) >> 0;
|
|
}
|
|
return $subslice(a, 0, n);
|
|
};
|
|
dtoi = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, i, n, ok, s;
|
|
n = 0;
|
|
i = 0;
|
|
ok = false;
|
|
n = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length && 48 <= s.charCodeAt(i) && s.charCodeAt(i) <= 57)) { break; }
|
|
n = ($imul(n, 10)) + (((s.charCodeAt(i) - 48 << 24 >>> 24) >> 0)) >> 0;
|
|
if (n >= 16777215) {
|
|
_tmp = 16777215;
|
|
_tmp$1 = i;
|
|
_tmp$2 = false;
|
|
n = _tmp;
|
|
i = _tmp$1;
|
|
ok = _tmp$2;
|
|
return [n, i, ok];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (i === 0) {
|
|
_tmp$3 = 0;
|
|
_tmp$4 = 0;
|
|
_tmp$5 = false;
|
|
n = _tmp$3;
|
|
i = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [n, i, ok];
|
|
}
|
|
_tmp$6 = n;
|
|
_tmp$7 = i;
|
|
_tmp$8 = true;
|
|
n = _tmp$6;
|
|
i = _tmp$7;
|
|
ok = _tmp$8;
|
|
return [n, i, ok];
|
|
};
|
|
xtoi = function(s) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, i, n, ok, s;
|
|
n = 0;
|
|
i = 0;
|
|
ok = false;
|
|
n = 0;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
if (48 <= s.charCodeAt(i) && s.charCodeAt(i) <= 57) {
|
|
n = $imul(n, (16));
|
|
n = n + ((((s.charCodeAt(i) - 48 << 24 >>> 24) >> 0))) >> 0;
|
|
} else if (97 <= s.charCodeAt(i) && s.charCodeAt(i) <= 102) {
|
|
n = $imul(n, (16));
|
|
n = n + (((((s.charCodeAt(i) - 97 << 24 >>> 24) >> 0)) + 10 >> 0)) >> 0;
|
|
} else if (65 <= s.charCodeAt(i) && s.charCodeAt(i) <= 70) {
|
|
n = $imul(n, (16));
|
|
n = n + (((((s.charCodeAt(i) - 65 << 24 >>> 24) >> 0)) + 10 >> 0)) >> 0;
|
|
} else {
|
|
break;
|
|
}
|
|
if (n >= 16777215) {
|
|
_tmp = 0;
|
|
_tmp$1 = i;
|
|
_tmp$2 = false;
|
|
n = _tmp;
|
|
i = _tmp$1;
|
|
ok = _tmp$2;
|
|
return [n, i, ok];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if (i === 0) {
|
|
_tmp$3 = 0;
|
|
_tmp$4 = i;
|
|
_tmp$5 = false;
|
|
n = _tmp$3;
|
|
i = _tmp$4;
|
|
ok = _tmp$5;
|
|
return [n, i, ok];
|
|
}
|
|
_tmp$6 = n;
|
|
_tmp$7 = i;
|
|
_tmp$8 = true;
|
|
n = _tmp$6;
|
|
i = _tmp$7;
|
|
ok = _tmp$8;
|
|
return [n, i, ok];
|
|
};
|
|
xtoi2 = function(s, e) {
|
|
var _tuple, e, ei, n, ok, s;
|
|
if (s.length > 2 && !((s.charCodeAt(2) === e))) {
|
|
return [0, false];
|
|
}
|
|
_tuple = xtoi($substring(s, 0, 2));
|
|
n = _tuple[0];
|
|
ei = _tuple[1];
|
|
ok = _tuple[2];
|
|
return [((n << 24 >>> 24)), ok && (ei === 2)];
|
|
};
|
|
uitoa = function(val) {
|
|
var _q, buf, i, q, val;
|
|
if (val === 0) {
|
|
return "0";
|
|
}
|
|
buf = arrayType$6.zero();
|
|
i = 19;
|
|
while (true) {
|
|
if (!(val >= 10)) { break; }
|
|
q = (_q = val / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = ((((48 + val >>> 0) - (q * 10 >>> 0) >>> 0) << 24 >>> 24)));
|
|
i = i - (1) >> 0;
|
|
val = q;
|
|
}
|
|
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = (((48 + val >>> 0) << 24 >>> 24)));
|
|
return ($bytesToString($subslice(new sliceType$1(buf), i)));
|
|
};
|
|
appendHex = function(dst, i) {
|
|
var dst, i, j, v, y;
|
|
if (i === 0) {
|
|
return $append(dst, 48);
|
|
}
|
|
j = 7;
|
|
while (true) {
|
|
if (!(j >= 0)) { break; }
|
|
v = (y = ((($imul(j, 4)) >>> 0)), y < 32 ? (i >>> y) : 0) >>> 0;
|
|
if (v > 0) {
|
|
dst = $append(dst, "0123456789abcdef".charCodeAt(((v & 15) >>> 0)));
|
|
}
|
|
j = j - (1) >> 0;
|
|
}
|
|
return dst;
|
|
};
|
|
policyTable.methods = [{prop: "Classify", name: "Classify", pkg: "", typ: $funcType([IP], [policyTableEntry], false)}];
|
|
byMaskLength.methods = [{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}];
|
|
ptrType$23.methods = [{prop: "Addrs", name: "Addrs", pkg: "", typ: $funcType([], [sliceType$7, $error], false)}, {prop: "MulticastAddrs", name: "MulticastAddrs", pkg: "", typ: $funcType([], [sliceType$7, $error], false)}];
|
|
Flags.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$48.methods = [{prop: "update", name: "update", pkg: "net", typ: $funcType([sliceType$8, $Bool], [$Bool], false)}, {prop: "name", name: "name", pkg: "net", typ: $funcType([$Int], [$String], false)}, {prop: "index", name: "index", pkg: "net", typ: $funcType([$String], [$Int], false)}];
|
|
IP.methods = [{prop: "IsUnspecified", name: "IsUnspecified", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsLoopback", name: "IsLoopback", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsMulticast", name: "IsMulticast", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsInterfaceLocalMulticast", name: "IsInterfaceLocalMulticast", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsLinkLocalMulticast", name: "IsLinkLocalMulticast", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsLinkLocalUnicast", name: "IsLinkLocalUnicast", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsGlobalUnicast", name: "IsGlobalUnicast", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "To4", name: "To4", pkg: "", typ: $funcType([], [IP], false)}, {prop: "To16", name: "To16", pkg: "", typ: $funcType([], [IP], false)}, {prop: "DefaultMask", name: "DefaultMask", pkg: "", typ: $funcType([], [IPMask], false)}, {prop: "Mask", name: "Mask", pkg: "", typ: $funcType([IPMask], [IP], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "MarshalText", name: "MarshalText", pkg: "", typ: $funcType([], [sliceType$1, $error], false)}, {prop: "Equal", name: "Equal", pkg: "", typ: $funcType([IP], [$Bool], false)}, {prop: "matchAddrFamily", name: "matchAddrFamily", pkg: "net", typ: $funcType([IP], [$Bool], false)}];
|
|
ptrType$49.methods = [{prop: "UnmarshalText", name: "UnmarshalText", pkg: "", typ: $funcType([sliceType$1], [$error], false)}];
|
|
IPMask.methods = [{prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int, $Int], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$5.methods = [{prop: "Contains", name: "Contains", pkg: "", typ: $funcType([IP], [$Bool], false)}, {prop: "Network", name: "Network", pkg: "", typ: $funcType([], [$String], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$9.methods = [{prop: "Network", name: "Network", pkg: "", typ: $funcType([], [$String], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "isWildcard", name: "isWildcard", pkg: "net", typ: $funcType([], [$Bool], false)}, {prop: "opAddr", name: "opAddr", pkg: "net", typ: $funcType([], [Addr], false)}, {prop: "family", name: "family", pkg: "net", typ: $funcType([], [$Int], false)}, {prop: "sockaddr", name: "sockaddr", pkg: "net", typ: $funcType([$Int], [syscall.Sockaddr, $error], false)}, {prop: "toLocal", name: "toLocal", pkg: "net", typ: $funcType([$String], [sockaddr], false)}];
|
|
HardwareAddr.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$13.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$52.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$32.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$22.methods = [{prop: "close", name: "close", pkg: "net", typ: $funcType([], [], false)}, {prop: "getLineFromData", name: "getLineFromData", pkg: "net", typ: $funcType([], [$String, $Bool], false)}, {prop: "readLine", name: "readLine", pkg: "net", typ: $funcType([], [$String, $Bool], false)}];
|
|
policyTableEntry.init("", [{prop: "Prefix", name: "Prefix", embedded: false, exported: true, typ: ptrType$5, tag: ""}, {prop: "Precedence", name: "Precedence", embedded: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Label", name: "Label", embedded: false, exported: true, typ: $Uint8, tag: ""}]);
|
|
policyTable.init(policyTableEntry);
|
|
byMaskLength.init(policyTableEntry);
|
|
Interface.init("", [{prop: "Index", name: "Index", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "MTU", name: "MTU", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "Name", name: "Name", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "HardwareAddr", name: "HardwareAddr", embedded: false, exported: true, typ: HardwareAddr, tag: ""}, {prop: "Flags", name: "Flags", embedded: false, exported: true, typ: Flags, tag: ""}]);
|
|
ipv6ZoneCache.init("net", [{prop: "RWMutex", name: "RWMutex", embedded: true, exported: true, typ: sync.RWMutex, tag: ""}, {prop: "lastFetched", name: "lastFetched", embedded: false, exported: false, typ: time.Time, tag: ""}, {prop: "toIndex", name: "toIndex", embedded: false, exported: false, typ: mapType$1, tag: ""}, {prop: "toName", name: "toName", embedded: false, exported: false, typ: mapType$2, tag: ""}]);
|
|
IP.init($Uint8);
|
|
IPMask.init($Uint8);
|
|
IPNet.init("", [{prop: "IP", name: "IP", embedded: false, exported: true, typ: IP, tag: ""}, {prop: "Mask", name: "Mask", embedded: false, exported: true, typ: IPMask, tag: ""}]);
|
|
IPAddr.init("", [{prop: "IP", name: "IP", embedded: false, exported: true, typ: IP, tag: ""}, {prop: "Zone", name: "Zone", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
HardwareAddr.init($Uint8);
|
|
Addr.init([{prop: "Network", name: "Network", pkg: "", typ: $funcType([], [$String], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}]);
|
|
OpError.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Net", name: "Net", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Source", name: "Source", embedded: false, exported: true, typ: Addr, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: Addr, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
timeout.init([{prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}]);
|
|
temporary.init([{prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}]);
|
|
ParseError.init("", [{prop: "Type", name: "Type", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Text", name: "Text", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
AddrError.init("", [{prop: "Err", name: "Err", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Addr", name: "Addr", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
file.init("net", [{prop: "file", name: "file", embedded: false, exported: false, typ: ptrType$18, tag: ""}, {prop: "data", name: "data", embedded: false, exported: false, typ: sliceType$1, tag: ""}, {prop: "atEOF", name: "atEOF", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
sockaddr.init([{prop: "Network", name: "Network", pkg: "", typ: $funcType([], [$String], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "family", name: "family", pkg: "net", typ: $funcType([], [$Int], false)}, {prop: "isWildcard", name: "isWildcard", pkg: "net", typ: $funcType([], [$Bool], false)}, {prop: "sockaddr", name: "sockaddr", pkg: "net", typ: $funcType([$Int], [syscall.Sockaddr, $error], false)}, {prop: "toLocal", name: "toLocal", pkg: "net", typ: $funcType([$String], [sockaddr], false)}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = context.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = errors.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bytealg.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = nettrace.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = poll.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = singleflight.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = dnsmessage.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = rand.$init(); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = os.$init(); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sort.$init(); /* */ $s = 13; case 13: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 14; case 14: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 15; case 15: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = syscall.$init(); /* */ $s = 16; case 16: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 17; case 17: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
netGo = false;
|
|
errLameReferral = errors.New("lame referral");
|
|
errCannotUnmarshalDNSMessage = errors.New("cannot unmarshal DNS message");
|
|
errCannotMarshalDNSMessage = errors.New("cannot marshal DNS message");
|
|
errServerMisbehaving = errors.New("server misbehaving");
|
|
errInvalidDNSResponse = errors.New("invalid DNS response");
|
|
errNoAnswerFromDNSServer = errors.New("no answer from DNS server");
|
|
errServerTemporarlyMisbehaving = errors.New("server misbehaving");
|
|
testHookLookupIP = (function $b(ctx, fn, network, host) {
|
|
var _r, ctx, fn, host, network, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; ctx = $f.ctx; fn = $f.fn; host = $f.host; network = $f.network; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = fn(ctx, network, host); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r = _r; $f.ctx = ctx; $f.fn = fn; $f.host = host; $f.network = network; $f.$s = $s; $f.$r = $r; return $f;
|
|
});
|
|
errInvalidInterface = errors.New("invalid network interface");
|
|
errInvalidInterfaceIndex = errors.New("invalid network interface index");
|
|
errInvalidInterfaceName = errors.New("invalid network interface name");
|
|
errNoSuchInterface = errors.New("no such network interface");
|
|
errNoSuchMulticastInterface = errors.New("no such multicast network interface");
|
|
flagNames = new sliceType(["up", "broadcast", "loopback", "pointtopoint", "multicast"]);
|
|
zoneCache = new ipv6ZoneCache.ptr(new sync.RWMutex.ptr(new sync.Mutex.ptr(0, 0), 0, 0, 0, 0), new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType.nil), {}, {});
|
|
v4InV6Prefix = new sliceType$1([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255]);
|
|
$pkg.IPv4bcast = IPv4(255, 255, 255, 255);
|
|
$pkg.IPv4allsys = IPv4(224, 0, 0, 1);
|
|
$pkg.IPv4allrouter = IPv4(224, 0, 0, 2);
|
|
$pkg.IPv4zero = IPv4(0, 0, 0, 0);
|
|
$pkg.IPv6unspecified = new IP([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
$pkg.IPv6loopback = new IP([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
|
classAMask = IPv4Mask(255, 0, 0, 0);
|
|
classBMask = IPv4Mask(255, 255, 0, 0);
|
|
classCMask = IPv4Mask(255, 255, 255, 0);
|
|
errNoSuitableAddress = errors.New("no suitable address found");
|
|
errMissingAddress = errors.New("missing address");
|
|
errCanceled = errors.New("operation was canceled");
|
|
$pkg.ErrWriteToConnected = errors.New("use of WriteTo with pre-connected connection");
|
|
aLongTimeAgo = $clone(time.Unix(new $Int64(0, 1), new $Int64(0, 0)), time.Time);
|
|
errNoSuchHost = errors.New("no such host");
|
|
_r = mustCIDR("::1/128"); /* */ $s = 18; case 18: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r$1 = mustCIDR("::/0"); /* */ $s = 19; case 19: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$2 = mustCIDR("::ffff:0:0/96"); /* */ $s = 20; case 20: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$3 = mustCIDR("2002::/16"); /* */ $s = 21; case 21: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_r$4 = mustCIDR("2001::/32"); /* */ $s = 22; case 22: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$5 = mustCIDR("fc00::/7"); /* */ $s = 23; case 23: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$6 = mustCIDR("::/96"); /* */ $s = 24; case 24: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$7 = mustCIDR("fec0::/10"); /* */ $s = 25; case 25: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_r$8 = mustCIDR("3ffe::/16"); /* */ $s = 26; case 26: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
rfc6724policyTable = new policyTable([new policyTableEntry.ptr(_r, 50, 0), new policyTableEntry.ptr(_r$1, 40, 1), new policyTableEntry.ptr(_r$2, 35, 4), new policyTableEntry.ptr(_r$3, 30, 2), new policyTableEntry.ptr(_r$4, 5, 5), new policyTableEntry.ptr(_r$5, 3, 13), new policyTableEntry.ptr(_r$6, 1, 3), new policyTableEntry.ptr(_r$7, 1, 11), new policyTableEntry.ptr(_r$8, 1, 12)]);
|
|
$r = init(); /* */ $s = 27; case 27: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
init$1();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["net/url"] = (function() {
|
|
var $pkg = {}, $init, errors, fmt, sort, strconv, strings, Error, timeout, temporary, EscapeError, InvalidHostError, URL, Userinfo, Values, sliceType, arrayType, ptrType, ptrType$1, sliceType$1, ptrType$2, sliceType$2, ptrType$3, ishex, unhex, shouldEscape, QueryUnescape, unescape, QueryEscape, escape, User, UserPassword, getscheme, split, Parse, parse, parseAuthority, parseHost, validEncodedPath, validOptionalPort, ParseQuery, parseQuery, resolvePath, splitHostPort, validUserinfo, stringContainsCTLByte;
|
|
errors = $packages["errors"];
|
|
fmt = $packages["fmt"];
|
|
sort = $packages["sort"];
|
|
strconv = $packages["strconv"];
|
|
strings = $packages["strings"];
|
|
Error = $pkg.Error = $newType(0, $kindStruct, "url.Error", true, "net/url", true, function(Op_, URL_, Err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Op = "";
|
|
this.URL = "";
|
|
this.Err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.Op = Op_;
|
|
this.URL = URL_;
|
|
this.Err = Err_;
|
|
});
|
|
timeout = $pkg.timeout = $newType(8, $kindInterface, "url.timeout", true, "net/url", false, null);
|
|
temporary = $pkg.temporary = $newType(8, $kindInterface, "url.temporary", true, "net/url", false, null);
|
|
EscapeError = $pkg.EscapeError = $newType(8, $kindString, "url.EscapeError", true, "net/url", true, null);
|
|
InvalidHostError = $pkg.InvalidHostError = $newType(8, $kindString, "url.InvalidHostError", true, "net/url", true, null);
|
|
URL = $pkg.URL = $newType(0, $kindStruct, "url.URL", true, "net/url", true, function(Scheme_, Opaque_, User_, Host_, Path_, RawPath_, ForceQuery_, RawQuery_, Fragment_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Scheme = "";
|
|
this.Opaque = "";
|
|
this.User = ptrType.nil;
|
|
this.Host = "";
|
|
this.Path = "";
|
|
this.RawPath = "";
|
|
this.ForceQuery = false;
|
|
this.RawQuery = "";
|
|
this.Fragment = "";
|
|
return;
|
|
}
|
|
this.Scheme = Scheme_;
|
|
this.Opaque = Opaque_;
|
|
this.User = User_;
|
|
this.Host = Host_;
|
|
this.Path = Path_;
|
|
this.RawPath = RawPath_;
|
|
this.ForceQuery = ForceQuery_;
|
|
this.RawQuery = RawQuery_;
|
|
this.Fragment = Fragment_;
|
|
});
|
|
Userinfo = $pkg.Userinfo = $newType(0, $kindStruct, "url.Userinfo", true, "net/url", true, function(username_, password_, passwordSet_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.username = "";
|
|
this.password = "";
|
|
this.passwordSet = false;
|
|
return;
|
|
}
|
|
this.username = username_;
|
|
this.password = password_;
|
|
this.passwordSet = passwordSet_;
|
|
});
|
|
Values = $pkg.Values = $newType(4, $kindMap, "url.Values", true, "net/url", true, null);
|
|
sliceType = $sliceType($Uint8);
|
|
arrayType = $arrayType($Uint8, 64);
|
|
ptrType = $ptrType(Userinfo);
|
|
ptrType$1 = $ptrType(URL);
|
|
sliceType$1 = $sliceType($emptyInterface);
|
|
ptrType$2 = $ptrType(strings.Builder);
|
|
sliceType$2 = $sliceType($String);
|
|
ptrType$3 = $ptrType(Error);
|
|
Error.ptr.prototype.Error = function() {
|
|
var _r, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return e.Op + " " + e.URL + ": " + _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Error.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Error.prototype.Error = function() { return this.$val.Error(); };
|
|
Error.ptr.prototype.Timeout = function() {
|
|
var _r, _tuple, _v, e, ok, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _v = $f._v; e = $f.e; ok = $f.ok; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_tuple = $assertType(e.Err, timeout, true);
|
|
t = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!(ok)) { _v = false; $s = 1; continue s; }
|
|
_r = t.Timeout(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 1:
|
|
$s = -1; return _v;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Error.ptr.prototype.Timeout }; } $f._r = _r; $f._tuple = _tuple; $f._v = _v; $f.e = e; $f.ok = ok; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Error.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
Error.ptr.prototype.Temporary = function() {
|
|
var _r, _tuple, _v, e, ok, t, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _v = $f._v; e = $f.e; ok = $f.ok; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
_tuple = $assertType(e.Err, temporary, true);
|
|
t = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (!(ok)) { _v = false; $s = 1; continue s; }
|
|
_r = t.Temporary(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 1:
|
|
$s = -1; return _v;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Error.ptr.prototype.Temporary }; } $f._r = _r; $f._tuple = _tuple; $f._v = _v; $f.e = e; $f.ok = ok; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Error.prototype.Temporary = function() { return this.$val.Temporary(); };
|
|
ishex = function(c) {
|
|
var c;
|
|
if (48 <= c && c <= 57) {
|
|
return true;
|
|
} else if (97 <= c && c <= 102) {
|
|
return true;
|
|
} else if (65 <= c && c <= 70) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
unhex = function(c) {
|
|
var c;
|
|
if (48 <= c && c <= 57) {
|
|
return c - 48 << 24 >>> 24;
|
|
} else if (97 <= c && c <= 102) {
|
|
return (c - 97 << 24 >>> 24) + 10 << 24 >>> 24;
|
|
} else if (65 <= c && c <= 70) {
|
|
return (c - 65 << 24 >>> 24) + 10 << 24 >>> 24;
|
|
}
|
|
return 0;
|
|
};
|
|
EscapeError.prototype.Error = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return "invalid URL escape " + strconv.Quote((e));
|
|
};
|
|
$ptrType(EscapeError).prototype.Error = function() { return new EscapeError(this.$get()).Error(); };
|
|
InvalidHostError.prototype.Error = function() {
|
|
var e;
|
|
e = this.$val;
|
|
return "invalid character " + strconv.Quote((e)) + " in host name";
|
|
};
|
|
$ptrType(InvalidHostError).prototype.Error = function() { return new InvalidHostError(this.$get()).Error(); };
|
|
shouldEscape = function(c, mode) {
|
|
var _1, _2, _3, _4, c, mode;
|
|
if (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57) {
|
|
return false;
|
|
}
|
|
if ((mode === 3) || (mode === 4)) {
|
|
_1 = c;
|
|
if ((_1 === (33)) || (_1 === (36)) || (_1 === (38)) || (_1 === (39)) || (_1 === (40)) || (_1 === (41)) || (_1 === (42)) || (_1 === (43)) || (_1 === (44)) || (_1 === (59)) || (_1 === (61)) || (_1 === (58)) || (_1 === (91)) || (_1 === (93)) || (_1 === (60)) || (_1 === (62)) || (_1 === (34))) {
|
|
return false;
|
|
}
|
|
}
|
|
_2 = c;
|
|
if ((_2 === (45)) || (_2 === (95)) || (_2 === (46)) || (_2 === (126))) {
|
|
return false;
|
|
} else if ((_2 === (36)) || (_2 === (38)) || (_2 === (43)) || (_2 === (44)) || (_2 === (47)) || (_2 === (58)) || (_2 === (59)) || (_2 === (61)) || (_2 === (63)) || (_2 === (64))) {
|
|
_3 = mode;
|
|
if (_3 === (1)) {
|
|
return c === 63;
|
|
} else if (_3 === (2)) {
|
|
return (c === 47) || (c === 59) || (c === 44) || (c === 63);
|
|
} else if (_3 === (5)) {
|
|
return (c === 64) || (c === 47) || (c === 63) || (c === 58);
|
|
} else if (_3 === (6)) {
|
|
return true;
|
|
} else if (_3 === (7)) {
|
|
return false;
|
|
}
|
|
}
|
|
if (mode === 7) {
|
|
_4 = c;
|
|
if ((_4 === (33)) || (_4 === (40)) || (_4 === (41)) || (_4 === (42))) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
QueryUnescape = function(s) {
|
|
var s;
|
|
return unescape(s, 6);
|
|
};
|
|
$pkg.QueryUnescape = QueryUnescape;
|
|
unescape = function(s, mode) {
|
|
var _1, _2, hasPlus, i, i$1, j, mode, n, s, t, v;
|
|
n = 0;
|
|
hasPlus = false;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
_1 = s.charCodeAt(i);
|
|
if (_1 === (37)) {
|
|
n = n + (1) >> 0;
|
|
if ((i + 2 >> 0) >= s.length || !ishex(s.charCodeAt((i + 1 >> 0))) || !ishex(s.charCodeAt((i + 2 >> 0)))) {
|
|
s = $substring(s, i);
|
|
if (s.length > 3) {
|
|
s = $substring(s, 0, 3);
|
|
}
|
|
return ["", new EscapeError((s))];
|
|
}
|
|
if ((mode === 3) && unhex(s.charCodeAt((i + 1 >> 0))) < 8 && !($substring(s, i, (i + 3 >> 0)) === "%25")) {
|
|
return ["", new EscapeError(($substring(s, i, (i + 3 >> 0))))];
|
|
}
|
|
if (mode === 4) {
|
|
v = ((unhex(s.charCodeAt((i + 1 >> 0))) << 4 << 24 >>> 24) | unhex(s.charCodeAt((i + 2 >> 0)))) >>> 0;
|
|
if (!($substring(s, i, (i + 3 >> 0)) === "%25") && !((v === 32)) && shouldEscape(v, 3)) {
|
|
return ["", new EscapeError(($substring(s, i, (i + 3 >> 0))))];
|
|
}
|
|
}
|
|
i = i + (3) >> 0;
|
|
} else if (_1 === (43)) {
|
|
hasPlus = mode === 6;
|
|
i = i + (1) >> 0;
|
|
} else {
|
|
if (((mode === 3) || (mode === 4)) && s.charCodeAt(i) < 128 && shouldEscape(s.charCodeAt(i), mode)) {
|
|
return ["", new InvalidHostError(($substring(s, i, (i + 1 >> 0))))];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
}
|
|
if ((n === 0) && !hasPlus) {
|
|
return [s, $ifaceNil];
|
|
}
|
|
t = $makeSlice(sliceType, (s.length - ($imul(2, n)) >> 0));
|
|
j = 0;
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < s.length)) { break; }
|
|
_2 = s.charCodeAt(i$1);
|
|
if (_2 === (37)) {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = (((unhex(s.charCodeAt((i$1 + 1 >> 0))) << 4 << 24 >>> 24) | unhex(s.charCodeAt((i$1 + 2 >> 0)))) >>> 0));
|
|
j = j + (1) >> 0;
|
|
i$1 = i$1 + (3) >> 0;
|
|
} else if (_2 === (43)) {
|
|
if (mode === 6) {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = 32);
|
|
} else {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = 43);
|
|
}
|
|
j = j + (1) >> 0;
|
|
i$1 = i$1 + (1) >> 0;
|
|
} else {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = s.charCodeAt(i$1));
|
|
j = j + (1) >> 0;
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
}
|
|
return [($bytesToString(t)), $ifaceNil];
|
|
};
|
|
QueryEscape = function(s) {
|
|
var s;
|
|
return escape(s, 6);
|
|
};
|
|
$pkg.QueryEscape = QueryEscape;
|
|
escape = function(s, mode) {
|
|
var _tmp, _tmp$1, buf, c, c$1, hexCount, i, i$1, i$2, j, mode, required, s, spaceCount, t, x, x$1;
|
|
_tmp = 0;
|
|
_tmp$1 = 0;
|
|
spaceCount = _tmp;
|
|
hexCount = _tmp$1;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
c = s.charCodeAt(i);
|
|
if (shouldEscape(c, mode)) {
|
|
if ((c === 32) && (mode === 6)) {
|
|
spaceCount = spaceCount + (1) >> 0;
|
|
} else {
|
|
hexCount = hexCount + (1) >> 0;
|
|
}
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
if ((spaceCount === 0) && (hexCount === 0)) {
|
|
return s;
|
|
}
|
|
buf = arrayType.zero();
|
|
t = sliceType.nil;
|
|
required = s.length + ($imul(2, hexCount)) >> 0;
|
|
if (required <= 64) {
|
|
t = $subslice(new sliceType(buf), 0, required);
|
|
} else {
|
|
t = $makeSlice(sliceType, required);
|
|
}
|
|
if (hexCount === 0) {
|
|
$copyString(t, s);
|
|
i$1 = 0;
|
|
while (true) {
|
|
if (!(i$1 < s.length)) { break; }
|
|
if (s.charCodeAt(i$1) === 32) {
|
|
((i$1 < 0 || i$1 >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + i$1] = 43);
|
|
}
|
|
i$1 = i$1 + (1) >> 0;
|
|
}
|
|
return ($bytesToString(t));
|
|
}
|
|
j = 0;
|
|
i$2 = 0;
|
|
while (true) {
|
|
if (!(i$2 < s.length)) { break; }
|
|
c$1 = s.charCodeAt(i$2);
|
|
if ((c$1 === 32) && (mode === 6)) {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = 43);
|
|
j = j + (1) >> 0;
|
|
} else if (shouldEscape(c$1, mode)) {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = 37);
|
|
(x = j + 1 >> 0, ((x < 0 || x >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + x] = "0123456789ABCDEF".charCodeAt((c$1 >>> 4 << 24 >>> 24))));
|
|
(x$1 = j + 2 >> 0, ((x$1 < 0 || x$1 >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + x$1] = "0123456789ABCDEF".charCodeAt(((c$1 & 15) >>> 0))));
|
|
j = j + (3) >> 0;
|
|
} else {
|
|
((j < 0 || j >= t.$length) ? ($throwRuntimeError("index out of range"), undefined) : t.$array[t.$offset + j] = s.charCodeAt(i$2));
|
|
j = j + (1) >> 0;
|
|
}
|
|
i$2 = i$2 + (1) >> 0;
|
|
}
|
|
return ($bytesToString(t));
|
|
};
|
|
User = function(username) {
|
|
var username;
|
|
return new Userinfo.ptr(username, "", false);
|
|
};
|
|
$pkg.User = User;
|
|
UserPassword = function(username, password) {
|
|
var password, username;
|
|
return new Userinfo.ptr(username, password, true);
|
|
};
|
|
$pkg.UserPassword = UserPassword;
|
|
Userinfo.ptr.prototype.Username = function() {
|
|
var u;
|
|
u = this;
|
|
if (u === ptrType.nil) {
|
|
return "";
|
|
}
|
|
return u.username;
|
|
};
|
|
Userinfo.prototype.Username = function() { return this.$val.Username(); };
|
|
Userinfo.ptr.prototype.Password = function() {
|
|
var u;
|
|
u = this;
|
|
if (u === ptrType.nil) {
|
|
return ["", false];
|
|
}
|
|
return [u.password, u.passwordSet];
|
|
};
|
|
Userinfo.prototype.Password = function() { return this.$val.Password(); };
|
|
Userinfo.ptr.prototype.String = function() {
|
|
var s, u;
|
|
u = this;
|
|
if (u === ptrType.nil) {
|
|
return "";
|
|
}
|
|
s = escape(u.username, 5);
|
|
if (u.passwordSet) {
|
|
s = s + (":" + escape(u.password, 5));
|
|
}
|
|
return s;
|
|
};
|
|
Userinfo.prototype.String = function() { return this.$val.String(); };
|
|
getscheme = function(rawurl) {
|
|
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, c, err, i, path, rawurl, scheme;
|
|
scheme = "";
|
|
path = "";
|
|
err = $ifaceNil;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < rawurl.length)) { break; }
|
|
c = rawurl.charCodeAt(i);
|
|
if (97 <= c && c <= 122 || 65 <= c && c <= 90) {
|
|
} else if (48 <= c && c <= 57 || (c === 43) || (c === 45) || (c === 46)) {
|
|
if (i === 0) {
|
|
_tmp = "";
|
|
_tmp$1 = rawurl;
|
|
_tmp$2 = $ifaceNil;
|
|
scheme = _tmp;
|
|
path = _tmp$1;
|
|
err = _tmp$2;
|
|
return [scheme, path, err];
|
|
}
|
|
} else if ((c === 58)) {
|
|
if (i === 0) {
|
|
_tmp$3 = "";
|
|
_tmp$4 = "";
|
|
_tmp$5 = errors.New("missing protocol scheme");
|
|
scheme = _tmp$3;
|
|
path = _tmp$4;
|
|
err = _tmp$5;
|
|
return [scheme, path, err];
|
|
}
|
|
_tmp$6 = $substring(rawurl, 0, i);
|
|
_tmp$7 = $substring(rawurl, (i + 1 >> 0));
|
|
_tmp$8 = $ifaceNil;
|
|
scheme = _tmp$6;
|
|
path = _tmp$7;
|
|
err = _tmp$8;
|
|
return [scheme, path, err];
|
|
} else {
|
|
_tmp$9 = "";
|
|
_tmp$10 = rawurl;
|
|
_tmp$11 = $ifaceNil;
|
|
scheme = _tmp$9;
|
|
path = _tmp$10;
|
|
err = _tmp$11;
|
|
return [scheme, path, err];
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
_tmp$12 = "";
|
|
_tmp$13 = rawurl;
|
|
_tmp$14 = $ifaceNil;
|
|
scheme = _tmp$12;
|
|
path = _tmp$13;
|
|
err = _tmp$14;
|
|
return [scheme, path, err];
|
|
};
|
|
split = function(s, c, cutc) {
|
|
var c, cutc, i, s;
|
|
i = strings.Index(s, c);
|
|
if (i < 0) {
|
|
return [s, ""];
|
|
}
|
|
if (cutc) {
|
|
return [$substring(s, 0, i), $substring(s, (i + c.length >> 0))];
|
|
}
|
|
return [$substring(s, 0, i), $substring(s, i)];
|
|
};
|
|
Parse = function(rawurl) {
|
|
var _r, _tuple, _tuple$1, _tuple$2, err, frag, rawurl, u, url, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; err = $f.err; frag = $f.frag; rawurl = $f.rawurl; u = $f.u; url = $f.url; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_tuple = split(rawurl, "#", true);
|
|
u = _tuple[0];
|
|
frag = _tuple[1];
|
|
_r = parse(u, false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
url = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, new Error.ptr("parse", u, err)];
|
|
}
|
|
if (frag === "") {
|
|
$s = -1; return [url, $ifaceNil];
|
|
}
|
|
_tuple$2 = unescape(frag, 7);
|
|
url.Fragment = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, new Error.ptr("parse", rawurl, err)];
|
|
}
|
|
$s = -1; return [url, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Parse }; } $f._r = _r; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.err = err; $f.frag = frag; $f.rawurl = rawurl; $f.u = u; $f.url = url; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Parse = Parse;
|
|
parse = function(rawurl, viaRequest) {
|
|
var _r, _r$1, _tuple, _tuple$1, _tuple$2, _tuple$3, authority, colon, err, err$1, rawurl, rest, slash, url, viaRequest, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; authority = $f.authority; colon = $f.colon; err = $f.err; err$1 = $f.err$1; rawurl = $f.rawurl; rest = $f.rest; slash = $f.slash; url = $f.url; viaRequest = $f.viaRequest; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
rest = "";
|
|
err = $ifaceNil;
|
|
if (stringContainsCTLByte(rawurl)) {
|
|
$s = -1; return [ptrType$1.nil, errors.New("net/url: invalid control character in URL")];
|
|
}
|
|
if (rawurl === "" && viaRequest) {
|
|
$s = -1; return [ptrType$1.nil, errors.New("empty url")];
|
|
}
|
|
url = new URL.ptr("", "", ptrType.nil, "", "", "", false, "", "");
|
|
if (rawurl === "*") {
|
|
url.Path = "*";
|
|
$s = -1; return [url, $ifaceNil];
|
|
}
|
|
_tuple = getscheme(rawurl);
|
|
url.Scheme = _tuple[0];
|
|
rest = _tuple[1];
|
|
err = _tuple[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err];
|
|
}
|
|
_r = strings.ToLower(url.Scheme); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
url.Scheme = _r;
|
|
if (strings.HasSuffix(rest, "?") && (strings.Count(rest, "?") === 1)) {
|
|
url.ForceQuery = true;
|
|
rest = $substring(rest, 0, (rest.length - 1 >> 0));
|
|
} else {
|
|
_tuple$1 = split(rest, "?", true);
|
|
rest = _tuple$1[0];
|
|
url.RawQuery = _tuple$1[1];
|
|
}
|
|
if (!strings.HasPrefix(rest, "/")) {
|
|
if (!(url.Scheme === "")) {
|
|
url.Opaque = rest;
|
|
$s = -1; return [url, $ifaceNil];
|
|
}
|
|
if (viaRequest) {
|
|
$s = -1; return [ptrType$1.nil, errors.New("invalid URI for request")];
|
|
}
|
|
colon = strings.Index(rest, ":");
|
|
slash = strings.Index(rest, "/");
|
|
if (colon >= 0 && (slash < 0 || colon < slash)) {
|
|
$s = -1; return [ptrType$1.nil, errors.New("first path segment in URL cannot contain colon")];
|
|
}
|
|
}
|
|
/* */ if ((!(url.Scheme === "") || !viaRequest && !strings.HasPrefix(rest, "///")) && strings.HasPrefix(rest, "//")) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if ((!(url.Scheme === "") || !viaRequest && !strings.HasPrefix(rest, "///")) && strings.HasPrefix(rest, "//")) { */ case 2:
|
|
authority = "";
|
|
_tuple$2 = split($substring(rest, 2), "/", false);
|
|
authority = _tuple$2[0];
|
|
rest = _tuple$2[1];
|
|
_r$1 = parseAuthority(authority); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$1;
|
|
url.User = _tuple$3[0];
|
|
url.Host = _tuple$3[1];
|
|
err = _tuple$3[2];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err];
|
|
}
|
|
/* } */ case 3:
|
|
err$1 = url.setPath(rest);
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err$1];
|
|
}
|
|
$s = -1; return [url, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parse }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.authority = authority; $f.colon = colon; $f.err = err; $f.err$1 = err$1; $f.rawurl = rawurl; $f.rest = rest; $f.slash = slash; $f.url = url; $f.viaRequest = viaRequest; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseAuthority = function(authority) {
|
|
var _r, _r$1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, authority, err, host, i, password, user, userinfo, username, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$16 = $f._tmp$16; _tmp$17 = $f._tmp$17; _tmp$18 = $f._tmp$18; _tmp$19 = $f._tmp$19; _tmp$2 = $f._tmp$2; _tmp$20 = $f._tmp$20; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; authority = $f.authority; err = $f.err; host = $f.host; i = $f.i; password = $f.password; user = $f.user; userinfo = $f.userinfo; username = $f.username; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
user = ptrType.nil;
|
|
host = "";
|
|
err = $ifaceNil;
|
|
i = strings.LastIndex(authority, "@");
|
|
/* */ if (i < 0) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (i < 0) { */ case 1:
|
|
_r = parseHost(authority); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
host = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
_r$1 = parseHost($substring(authority, (i + 1 >> 0))); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
host = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
/* } */ case 3:
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp = ptrType.nil;
|
|
_tmp$1 = "";
|
|
_tmp$2 = err;
|
|
user = _tmp;
|
|
host = _tmp$1;
|
|
err = _tmp$2;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
if (i < 0) {
|
|
_tmp$3 = ptrType.nil;
|
|
_tmp$4 = host;
|
|
_tmp$5 = $ifaceNil;
|
|
user = _tmp$3;
|
|
host = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
userinfo = $substring(authority, 0, i);
|
|
if (!validUserinfo(userinfo)) {
|
|
_tmp$6 = ptrType.nil;
|
|
_tmp$7 = "";
|
|
_tmp$8 = errors.New("net/url: invalid userinfo");
|
|
user = _tmp$6;
|
|
host = _tmp$7;
|
|
err = _tmp$8;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
if (!strings.Contains(userinfo, ":")) {
|
|
_tuple$2 = unescape(userinfo, 5);
|
|
userinfo = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$9 = ptrType.nil;
|
|
_tmp$10 = "";
|
|
_tmp$11 = err;
|
|
user = _tmp$9;
|
|
host = _tmp$10;
|
|
err = _tmp$11;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
user = User(userinfo);
|
|
} else {
|
|
_tuple$3 = split(userinfo, ":", true);
|
|
username = _tuple$3[0];
|
|
password = _tuple$3[1];
|
|
_tuple$4 = unescape(username, 5);
|
|
username = _tuple$4[0];
|
|
err = _tuple$4[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$12 = ptrType.nil;
|
|
_tmp$13 = "";
|
|
_tmp$14 = err;
|
|
user = _tmp$12;
|
|
host = _tmp$13;
|
|
err = _tmp$14;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
_tuple$5 = unescape(password, 5);
|
|
password = _tuple$5[0];
|
|
err = _tuple$5[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp$15 = ptrType.nil;
|
|
_tmp$16 = "";
|
|
_tmp$17 = err;
|
|
user = _tmp$15;
|
|
host = _tmp$16;
|
|
err = _tmp$17;
|
|
$s = -1; return [user, host, err];
|
|
}
|
|
user = UserPassword(username, password);
|
|
}
|
|
_tmp$18 = user;
|
|
_tmp$19 = host;
|
|
_tmp$20 = $ifaceNil;
|
|
user = _tmp$18;
|
|
host = _tmp$19;
|
|
err = _tmp$20;
|
|
$s = -1; return [user, host, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parseAuthority }; } $f._r = _r; $f._r$1 = _r$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$16 = _tmp$16; $f._tmp$17 = _tmp$17; $f._tmp$18 = _tmp$18; $f._tmp$19 = _tmp$19; $f._tmp$2 = _tmp$2; $f._tmp$20 = _tmp$20; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f.authority = authority; $f.err = err; $f.host = host; $f.i = i; $f.password = password; $f.user = user; $f.userinfo = userinfo; $f.username = username; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
parseHost = function(host) {
|
|
var _r, _r$1, _tuple, _tuple$1, _tuple$2, _tuple$3, colonPort, colonPort$1, err, err$1, host, host1, host2, host3, i, i$1, zone, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; colonPort = $f.colonPort; colonPort$1 = $f.colonPort$1; err = $f.err; err$1 = $f.err$1; host = $f.host; host1 = $f.host1; host2 = $f.host2; host3 = $f.host3; i = $f.i; i$1 = $f.i$1; zone = $f.zone; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* */ if (strings.HasPrefix(host, "[")) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (strings.HasPrefix(host, "[")) { */ case 1:
|
|
i = strings.LastIndex(host, "]");
|
|
if (i < 0) {
|
|
$s = -1; return ["", errors.New("missing ']' in host")];
|
|
}
|
|
colonPort = $substring(host, (i + 1 >> 0));
|
|
/* */ if (!validOptionalPort(colonPort)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if (!validOptionalPort(colonPort)) { */ case 4:
|
|
_r = fmt.Errorf("invalid port %q after host", new sliceType$1([new $String(colonPort)])); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return ["", _r];
|
|
/* } */ case 5:
|
|
zone = strings.Index($substring(host, 0, i), "%25");
|
|
if (zone >= 0) {
|
|
_tuple = unescape($substring(host, 0, zone), 3);
|
|
host1 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return ["", err];
|
|
}
|
|
_tuple$1 = unescape($substring(host, zone, i), 4);
|
|
host2 = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return ["", err];
|
|
}
|
|
_tuple$2 = unescape($substring(host, i), 3);
|
|
host3 = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return ["", err];
|
|
}
|
|
$s = -1; return [host1 + host2 + host3, $ifaceNil];
|
|
}
|
|
$s = 3; continue;
|
|
/* } else { */ case 2:
|
|
i$1 = strings.LastIndex(host, ":");
|
|
/* */ if (!((i$1 === -1))) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!((i$1 === -1))) { */ case 7:
|
|
colonPort$1 = $substring(host, i$1);
|
|
/* */ if (!validOptionalPort(colonPort$1)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!validOptionalPort(colonPort$1)) { */ case 9:
|
|
_r$1 = fmt.Errorf("invalid port %q after host", new sliceType$1([new $String(colonPort$1)])); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return ["", _r$1];
|
|
/* } */ case 10:
|
|
/* } */ case 8:
|
|
/* } */ case 3:
|
|
err$1 = $ifaceNil;
|
|
_tuple$3 = unescape(host, 3);
|
|
host = _tuple$3[0];
|
|
err$1 = _tuple$3[1];
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
$s = -1; return ["", err$1];
|
|
}
|
|
$s = -1; return [host, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: parseHost }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.colonPort = colonPort; $f.colonPort$1 = colonPort$1; $f.err = err; $f.err$1 = err$1; $f.host = host; $f.host1 = host1; $f.host2 = host2; $f.host3 = host3; $f.i = i; $f.i$1 = i$1; $f.zone = zone; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
URL.ptr.prototype.setPath = function(p) {
|
|
var _tuple, err, escp, p, path, u;
|
|
u = this;
|
|
_tuple = unescape(p, 1);
|
|
path = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
u.Path = path;
|
|
escp = escape(path, 1);
|
|
if (p === escp) {
|
|
u.RawPath = "";
|
|
} else {
|
|
u.RawPath = p;
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
URL.prototype.setPath = function(p) { return this.$val.setPath(p); };
|
|
URL.ptr.prototype.EscapedPath = function() {
|
|
var _tuple, err, p, u;
|
|
u = this;
|
|
if (!(u.RawPath === "") && validEncodedPath(u.RawPath)) {
|
|
_tuple = unescape(u.RawPath, 1);
|
|
p = _tuple[0];
|
|
err = _tuple[1];
|
|
if ($interfaceIsEqual(err, $ifaceNil) && p === u.Path) {
|
|
return u.RawPath;
|
|
}
|
|
}
|
|
if (u.Path === "*") {
|
|
return "*";
|
|
}
|
|
return escape(u.Path, 1);
|
|
};
|
|
URL.prototype.EscapedPath = function() { return this.$val.EscapedPath(); };
|
|
validEncodedPath = function(s) {
|
|
var _1, i, s;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
_1 = s.charCodeAt(i);
|
|
if ((_1 === (33)) || (_1 === (36)) || (_1 === (38)) || (_1 === (39)) || (_1 === (40)) || (_1 === (41)) || (_1 === (42)) || (_1 === (43)) || (_1 === (44)) || (_1 === (59)) || (_1 === (61)) || (_1 === (58)) || (_1 === (64))) {
|
|
} else if ((_1 === (91)) || (_1 === (93))) {
|
|
} else if (_1 === (37)) {
|
|
} else if (shouldEscape(s.charCodeAt(i), 1)) {
|
|
return false;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return true;
|
|
};
|
|
validOptionalPort = function(port) {
|
|
var _i, _ref, _rune, b, port;
|
|
if (port === "") {
|
|
return true;
|
|
}
|
|
if (!((port.charCodeAt(0) === 58))) {
|
|
return false;
|
|
}
|
|
_ref = $substring(port, 1);
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
b = _rune[0];
|
|
if (b < 48 || b > 57) {
|
|
return false;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return true;
|
|
};
|
|
URL.ptr.prototype.String = function() {
|
|
var buf, h, i, path, u, ui;
|
|
u = this;
|
|
buf = new strings.Builder.ptr(ptrType$2.nil, sliceType.nil);
|
|
if (!(u.Scheme === "")) {
|
|
buf.WriteString(u.Scheme);
|
|
buf.WriteByte(58);
|
|
}
|
|
if (!(u.Opaque === "")) {
|
|
buf.WriteString(u.Opaque);
|
|
} else {
|
|
if (!(u.Scheme === "") || !(u.Host === "") || !(u.User === ptrType.nil)) {
|
|
if (!(u.Host === "") || !(u.Path === "") || !(u.User === ptrType.nil)) {
|
|
buf.WriteString("//");
|
|
}
|
|
ui = u.User;
|
|
if (!(ui === ptrType.nil)) {
|
|
buf.WriteString(ui.String());
|
|
buf.WriteByte(64);
|
|
}
|
|
h = u.Host;
|
|
if (!(h === "")) {
|
|
buf.WriteString(escape(h, 3));
|
|
}
|
|
}
|
|
path = u.EscapedPath();
|
|
if (!(path === "") && !((path.charCodeAt(0) === 47)) && !(u.Host === "")) {
|
|
buf.WriteByte(47);
|
|
}
|
|
if (buf.Len() === 0) {
|
|
i = strings.IndexByte(path, 58);
|
|
if (i > -1 && (strings.IndexByte($substring(path, 0, i), 47) === -1)) {
|
|
buf.WriteString("./");
|
|
}
|
|
}
|
|
buf.WriteString(path);
|
|
}
|
|
if (u.ForceQuery || !(u.RawQuery === "")) {
|
|
buf.WriteByte(63);
|
|
buf.WriteString(u.RawQuery);
|
|
}
|
|
if (!(u.Fragment === "")) {
|
|
buf.WriteByte(35);
|
|
buf.WriteString(escape(u.Fragment, 7));
|
|
}
|
|
return buf.String();
|
|
};
|
|
URL.prototype.String = function() { return this.$val.String(); };
|
|
Values.prototype.Get = function(key) {
|
|
var _entry, key, v, vs;
|
|
v = this.$val;
|
|
if (v === false) {
|
|
return "";
|
|
}
|
|
vs = (_entry = v[$String.keyFor(key)], _entry !== undefined ? _entry.v : sliceType$2.nil);
|
|
if (vs.$length === 0) {
|
|
return "";
|
|
}
|
|
return (0 >= vs.$length ? ($throwRuntimeError("index out of range"), undefined) : vs.$array[vs.$offset + 0]);
|
|
};
|
|
$ptrType(Values).prototype.Get = function(key) { return new Values(this.$get()).Get(key); };
|
|
Values.prototype.Set = function(key, value) {
|
|
var _key, key, v, value;
|
|
v = this.$val;
|
|
_key = key; (v || $throwRuntimeError("assignment to entry in nil map"))[$String.keyFor(_key)] = { k: _key, v: new sliceType$2([value]) };
|
|
};
|
|
$ptrType(Values).prototype.Set = function(key, value) { return new Values(this.$get()).Set(key, value); };
|
|
Values.prototype.Add = function(key, value) {
|
|
var _entry, _key, key, v, value;
|
|
v = this.$val;
|
|
_key = key; (v || $throwRuntimeError("assignment to entry in nil map"))[$String.keyFor(_key)] = { k: _key, v: $append((_entry = v[$String.keyFor(key)], _entry !== undefined ? _entry.v : sliceType$2.nil), value) };
|
|
};
|
|
$ptrType(Values).prototype.Add = function(key, value) { return new Values(this.$get()).Add(key, value); };
|
|
Values.prototype.Del = function(key) {
|
|
var key, v;
|
|
v = this.$val;
|
|
delete v[$String.keyFor(key)];
|
|
};
|
|
$ptrType(Values).prototype.Del = function(key) { return new Values(this.$get()).Del(key); };
|
|
ParseQuery = function(query) {
|
|
var err, m, query;
|
|
m = {};
|
|
err = parseQuery(m, query);
|
|
return [m, err];
|
|
};
|
|
$pkg.ParseQuery = ParseQuery;
|
|
parseQuery = function(m, query) {
|
|
var _entry, _key, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, _tuple$1, err, err1, i, i$1, key, m, query, value;
|
|
err = $ifaceNil;
|
|
while (true) {
|
|
if (!(!(query === ""))) { break; }
|
|
key = query;
|
|
i = strings.IndexAny(key, "&;");
|
|
if (i >= 0) {
|
|
_tmp = $substring(key, 0, i);
|
|
_tmp$1 = $substring(key, (i + 1 >> 0));
|
|
key = _tmp;
|
|
query = _tmp$1;
|
|
} else {
|
|
query = "";
|
|
}
|
|
if (key === "") {
|
|
continue;
|
|
}
|
|
value = "";
|
|
i$1 = strings.Index(key, "=");
|
|
if (i$1 >= 0) {
|
|
_tmp$2 = $substring(key, 0, i$1);
|
|
_tmp$3 = $substring(key, (i$1 + 1 >> 0));
|
|
key = _tmp$2;
|
|
value = _tmp$3;
|
|
}
|
|
_tuple = QueryUnescape(key);
|
|
key = _tuple[0];
|
|
err1 = _tuple[1];
|
|
if (!($interfaceIsEqual(err1, $ifaceNil))) {
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
err = err1;
|
|
}
|
|
continue;
|
|
}
|
|
_tuple$1 = QueryUnescape(value);
|
|
value = _tuple$1[0];
|
|
err1 = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err1, $ifaceNil))) {
|
|
if ($interfaceIsEqual(err, $ifaceNil)) {
|
|
err = err1;
|
|
}
|
|
continue;
|
|
}
|
|
_key = key; (m || $throwRuntimeError("assignment to entry in nil map"))[$String.keyFor(_key)] = { k: _key, v: $append((_entry = m[$String.keyFor(key)], _entry !== undefined ? _entry.v : sliceType$2.nil), value) };
|
|
}
|
|
err = err;
|
|
return err;
|
|
};
|
|
Values.prototype.Encode = function() {
|
|
var _entry, _entry$1, _i, _i$1, _i$2, _keys, _ref, _ref$1, _ref$2, buf, k, k$1, keyEscaped, keys, v, v$1, vs, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _keys = $f._keys; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; buf = $f.buf; k = $f.k; k$1 = $f.k$1; keyEscaped = $f.keyEscaped; keys = $f.keys; v = $f.v; v$1 = $f.v$1; vs = $f.vs; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
v = this.$val;
|
|
if (v === false) {
|
|
$s = -1; return "";
|
|
}
|
|
buf = new strings.Builder.ptr(ptrType$2.nil, sliceType.nil);
|
|
keys = $makeSlice(sliceType$2, 0, $keys(v).length);
|
|
_ref = v;
|
|
_i = 0;
|
|
_keys = $keys(_ref);
|
|
while (true) {
|
|
if (!(_i < _keys.length)) { break; }
|
|
_entry = _ref[_keys[_i]];
|
|
if (_entry === undefined) {
|
|
_i++;
|
|
continue;
|
|
}
|
|
k = _entry.k;
|
|
keys = $append(keys, k);
|
|
_i++;
|
|
}
|
|
$r = sort.Strings(keys); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_ref$1 = keys;
|
|
_i$1 = 0;
|
|
while (true) {
|
|
if (!(_i$1 < _ref$1.$length)) { break; }
|
|
k$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
|
|
vs = (_entry$1 = v[$String.keyFor(k$1)], _entry$1 !== undefined ? _entry$1.v : sliceType$2.nil);
|
|
keyEscaped = QueryEscape(k$1);
|
|
_ref$2 = vs;
|
|
_i$2 = 0;
|
|
while (true) {
|
|
if (!(_i$2 < _ref$2.$length)) { break; }
|
|
v$1 = ((_i$2 < 0 || _i$2 >= _ref$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$2.$array[_ref$2.$offset + _i$2]);
|
|
if (buf.Len() > 0) {
|
|
buf.WriteByte(38);
|
|
}
|
|
buf.WriteString(keyEscaped);
|
|
buf.WriteByte(61);
|
|
buf.WriteString(QueryEscape(v$1));
|
|
_i$2++;
|
|
}
|
|
_i$1++;
|
|
}
|
|
$s = -1; return buf.String();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Values.prototype.Encode }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._keys = _keys; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f.buf = buf; $f.k = k; $f.k$1 = k$1; $f.keyEscaped = keyEscaped; $f.keys = keys; $f.v = v; $f.v$1 = v$1; $f.vs = vs; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(Values).prototype.Encode = function() { return new Values(this.$get()).Encode(); };
|
|
resolvePath = function(base, ref) {
|
|
var _1, _i, _ref, base, dst, elem, full, i, last, ref, src, x;
|
|
full = "";
|
|
if (ref === "") {
|
|
full = base;
|
|
} else if (!((ref.charCodeAt(0) === 47))) {
|
|
i = strings.LastIndex(base, "/");
|
|
full = $substring(base, 0, (i + 1 >> 0)) + ref;
|
|
} else {
|
|
full = ref;
|
|
}
|
|
if (full === "") {
|
|
return "";
|
|
}
|
|
dst = sliceType$2.nil;
|
|
src = strings.Split(full, "/");
|
|
_ref = src;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
elem = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
|
|
_1 = elem;
|
|
if (_1 === (".")) {
|
|
} else if (_1 === ("..")) {
|
|
if (dst.$length > 0) {
|
|
dst = $subslice(dst, 0, (dst.$length - 1 >> 0));
|
|
}
|
|
} else {
|
|
dst = $append(dst, elem);
|
|
}
|
|
_i++;
|
|
}
|
|
last = (x = src.$length - 1 >> 0, ((x < 0 || x >= src.$length) ? ($throwRuntimeError("index out of range"), undefined) : src.$array[src.$offset + x]));
|
|
if (last === "." || last === "..") {
|
|
dst = $append(dst, "");
|
|
}
|
|
return "/" + strings.TrimPrefix(strings.Join(dst, "/"), "/");
|
|
};
|
|
URL.ptr.prototype.IsAbs = function() {
|
|
var u;
|
|
u = this;
|
|
return !(u.Scheme === "");
|
|
};
|
|
URL.prototype.IsAbs = function() { return this.$val.IsAbs(); };
|
|
URL.ptr.prototype.Parse = function(ref) {
|
|
var _r, _tuple, err, ref, refurl, u, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; ref = $f.ref; refurl = $f.refurl; u = $f.u; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
u = this;
|
|
_r = Parse(ref); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
refurl = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$1.nil, err];
|
|
}
|
|
$s = -1; return [u.ResolveReference(refurl), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: URL.ptr.prototype.Parse }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.ref = ref; $f.refurl = refurl; $f.u = u; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
URL.prototype.Parse = function(ref) { return this.$val.Parse(ref); };
|
|
URL.ptr.prototype.ResolveReference = function(ref) {
|
|
var ref, u, url;
|
|
u = this;
|
|
url = $clone(ref, URL);
|
|
if (ref.Scheme === "") {
|
|
url.Scheme = u.Scheme;
|
|
}
|
|
if (!(ref.Scheme === "") || !(ref.Host === "") || !(ref.User === ptrType.nil)) {
|
|
url.setPath(resolvePath(ref.EscapedPath(), ""));
|
|
return url;
|
|
}
|
|
if (!(ref.Opaque === "")) {
|
|
url.User = ptrType.nil;
|
|
url.Host = "";
|
|
url.Path = "";
|
|
return url;
|
|
}
|
|
if (ref.Path === "" && ref.RawQuery === "") {
|
|
url.RawQuery = u.RawQuery;
|
|
if (ref.Fragment === "") {
|
|
url.Fragment = u.Fragment;
|
|
}
|
|
}
|
|
url.Host = u.Host;
|
|
url.User = u.User;
|
|
url.setPath(resolvePath(u.EscapedPath(), ref.EscapedPath()));
|
|
return url;
|
|
};
|
|
URL.prototype.ResolveReference = function(ref) { return this.$val.ResolveReference(ref); };
|
|
URL.ptr.prototype.Query = function() {
|
|
var _tuple, u, v;
|
|
u = this;
|
|
_tuple = ParseQuery(u.RawQuery);
|
|
v = _tuple[0];
|
|
return v;
|
|
};
|
|
URL.prototype.Query = function() { return this.$val.Query(); };
|
|
URL.ptr.prototype.RequestURI = function() {
|
|
var result, u;
|
|
u = this;
|
|
result = u.Opaque;
|
|
if (result === "") {
|
|
result = u.EscapedPath();
|
|
if (result === "") {
|
|
result = "/";
|
|
}
|
|
} else {
|
|
if (strings.HasPrefix(result, "//")) {
|
|
result = u.Scheme + ":" + result;
|
|
}
|
|
}
|
|
if (u.ForceQuery || !(u.RawQuery === "")) {
|
|
result = result + ("?" + u.RawQuery);
|
|
}
|
|
return result;
|
|
};
|
|
URL.prototype.RequestURI = function() { return this.$val.RequestURI(); };
|
|
URL.ptr.prototype.Hostname = function() {
|
|
var _tuple, host, u;
|
|
u = this;
|
|
_tuple = splitHostPort(u.Host);
|
|
host = _tuple[0];
|
|
return host;
|
|
};
|
|
URL.prototype.Hostname = function() { return this.$val.Hostname(); };
|
|
URL.ptr.prototype.Port = function() {
|
|
var _tuple, port, u;
|
|
u = this;
|
|
_tuple = splitHostPort(u.Host);
|
|
port = _tuple[1];
|
|
return port;
|
|
};
|
|
URL.prototype.Port = function() { return this.$val.Port(); };
|
|
splitHostPort = function(hostport) {
|
|
var _tmp, _tmp$1, colon, host, hostport, port;
|
|
host = "";
|
|
port = "";
|
|
host = hostport;
|
|
colon = strings.LastIndexByte(host, 58);
|
|
if (!((colon === -1)) && validOptionalPort($substring(host, colon))) {
|
|
_tmp = $substring(host, 0, colon);
|
|
_tmp$1 = $substring(host, (colon + 1 >> 0));
|
|
host = _tmp;
|
|
port = _tmp$1;
|
|
}
|
|
if (strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]")) {
|
|
host = $substring(host, 1, (host.length - 1 >> 0));
|
|
}
|
|
return [host, port];
|
|
};
|
|
URL.ptr.prototype.MarshalBinary = function() {
|
|
var _tmp, _tmp$1, err, text, u;
|
|
text = sliceType.nil;
|
|
err = $ifaceNil;
|
|
u = this;
|
|
_tmp = (new sliceType($stringToBytes(u.String())));
|
|
_tmp$1 = $ifaceNil;
|
|
text = _tmp;
|
|
err = _tmp$1;
|
|
return [text, err];
|
|
};
|
|
URL.prototype.MarshalBinary = function() { return this.$val.MarshalBinary(); };
|
|
URL.ptr.prototype.UnmarshalBinary = function(text) {
|
|
var _r, _tuple, err, text, u, u1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; text = $f.text; u = $f.u; u1 = $f.u1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
u = this;
|
|
_r = Parse(($bytesToString(text))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
u1 = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return err;
|
|
}
|
|
URL.copy(u, u1);
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: URL.ptr.prototype.UnmarshalBinary }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.text = text; $f.u = u; $f.u1 = u1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
URL.prototype.UnmarshalBinary = function(text) { return this.$val.UnmarshalBinary(text); };
|
|
validUserinfo = function(s) {
|
|
var _1, _i, _ref, _rune, r, s;
|
|
_ref = s;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.length)) { break; }
|
|
_rune = $decodeRune(_ref, _i);
|
|
r = _rune[0];
|
|
if (65 <= r && r <= 90) {
|
|
_i += _rune[1];
|
|
continue;
|
|
}
|
|
if (97 <= r && r <= 122) {
|
|
_i += _rune[1];
|
|
continue;
|
|
}
|
|
if (48 <= r && r <= 57) {
|
|
_i += _rune[1];
|
|
continue;
|
|
}
|
|
_1 = r;
|
|
if ((_1 === (45)) || (_1 === (46)) || (_1 === (95)) || (_1 === (58)) || (_1 === (126)) || (_1 === (33)) || (_1 === (36)) || (_1 === (38)) || (_1 === (39)) || (_1 === (40)) || (_1 === (41)) || (_1 === (42)) || (_1 === (43)) || (_1 === (44)) || (_1 === (59)) || (_1 === (61)) || (_1 === (37)) || (_1 === (64))) {
|
|
_i += _rune[1];
|
|
continue;
|
|
} else {
|
|
return false;
|
|
}
|
|
_i += _rune[1];
|
|
}
|
|
return true;
|
|
};
|
|
stringContainsCTLByte = function(s) {
|
|
var b, i, s;
|
|
i = 0;
|
|
while (true) {
|
|
if (!(i < s.length)) { break; }
|
|
b = s.charCodeAt(i);
|
|
if (b < 32 || (b === 127)) {
|
|
return true;
|
|
}
|
|
i = i + (1) >> 0;
|
|
}
|
|
return false;
|
|
};
|
|
ptrType$3.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
EscapeError.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
InvalidHostError.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$1.methods = [{prop: "setPath", name: "setPath", pkg: "net/url", typ: $funcType([$String], [$error], false)}, {prop: "EscapedPath", name: "EscapedPath", pkg: "", typ: $funcType([], [$String], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "IsAbs", name: "IsAbs", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Parse", name: "Parse", pkg: "", typ: $funcType([$String], [ptrType$1, $error], false)}, {prop: "ResolveReference", name: "ResolveReference", pkg: "", typ: $funcType([ptrType$1], [ptrType$1], false)}, {prop: "Query", name: "Query", pkg: "", typ: $funcType([], [Values], false)}, {prop: "RequestURI", name: "RequestURI", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Hostname", name: "Hostname", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Port", name: "Port", pkg: "", typ: $funcType([], [$String], false)}, {prop: "MarshalBinary", name: "MarshalBinary", pkg: "", typ: $funcType([], [sliceType, $error], false)}, {prop: "UnmarshalBinary", name: "UnmarshalBinary", pkg: "", typ: $funcType([sliceType], [$error], false)}];
|
|
ptrType.methods = [{prop: "Username", name: "Username", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Password", name: "Password", pkg: "", typ: $funcType([], [$String, $Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
Values.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "Set", name: "Set", pkg: "", typ: $funcType([$String, $String], [], false)}, {prop: "Add", name: "Add", pkg: "", typ: $funcType([$String, $String], [], false)}, {prop: "Del", name: "Del", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Encode", name: "Encode", pkg: "", typ: $funcType([], [$String], false)}];
|
|
Error.init("", [{prop: "Op", name: "Op", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "URL", name: "URL", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", embedded: false, exported: true, typ: $error, tag: ""}]);
|
|
timeout.init([{prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}]);
|
|
temporary.init([{prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}]);
|
|
URL.init("", [{prop: "Scheme", name: "Scheme", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Opaque", name: "Opaque", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "User", name: "User", embedded: false, exported: true, typ: ptrType, tag: ""}, {prop: "Host", name: "Host", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Path", name: "Path", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "RawPath", name: "RawPath", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "ForceQuery", name: "ForceQuery", embedded: false, exported: true, typ: $Bool, tag: ""}, {prop: "RawQuery", name: "RawQuery", embedded: false, exported: true, typ: $String, tag: ""}, {prop: "Fragment", name: "Fragment", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
Userinfo.init("net/url", [{prop: "username", name: "username", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "password", name: "password", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "passwordSet", name: "passwordSet", embedded: false, exported: false, typ: $Bool, tag: ""}]);
|
|
Values.init($String, sliceType$2);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmt.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sort.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strconv.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = strings.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket"] = (function() {
|
|
var $pkg = {}, $init, bytes, fmt, js, websocketjs, io, net, url, time, addr, closeError, deadlineErr, conn, messageEvent, sliceType, ptrType, ptrType$1, ptrType$2, ptrType$3, sliceType$1, ptrType$4, ptrType$5, ptrType$6, ptrType$7, ptrType$8, ptrType$9, chanType, errDeadlineReached, beginHandlerOpen, beginHandlerClose, Dial, getFrameData;
|
|
bytes = $packages["bytes"];
|
|
fmt = $packages["fmt"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
websocketjs = $packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket/websocketjs"];
|
|
io = $packages["io"];
|
|
net = $packages["net"];
|
|
url = $packages["net/url"];
|
|
time = $packages["time"];
|
|
addr = $pkg.addr = $newType(0, $kindStruct, "websocket.addr", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", false, function(URL_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.URL = ptrType$4.nil;
|
|
return;
|
|
}
|
|
this.URL = URL_;
|
|
});
|
|
closeError = $pkg.closeError = $newType(0, $kindStruct, "websocket.closeError", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", false, function(Object_, Code_, Reason_, WasClean_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Object = null;
|
|
this.Code = 0;
|
|
this.Reason = "";
|
|
this.WasClean = false;
|
|
return;
|
|
}
|
|
this.Object = Object_;
|
|
this.Code = Code_;
|
|
this.Reason = Reason_;
|
|
this.WasClean = WasClean_;
|
|
});
|
|
deadlineErr = $pkg.deadlineErr = $newType(0, $kindStruct, "websocket.deadlineErr", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", false, function() {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
return;
|
|
}
|
|
});
|
|
conn = $pkg.conn = $newType(0, $kindStruct, "websocket.conn", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", false, function(WebSocket_, ch_, readBuf_, readDeadline_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.WebSocket = ptrType.nil;
|
|
this.ch = $chanNil;
|
|
this.readBuf = ptrType$1.nil;
|
|
this.readDeadline = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil);
|
|
return;
|
|
}
|
|
this.WebSocket = WebSocket_;
|
|
this.ch = ch_;
|
|
this.readBuf = readBuf_;
|
|
this.readDeadline = readDeadline_;
|
|
});
|
|
messageEvent = $pkg.messageEvent = $newType(0, $kindStruct, "websocket.messageEvent", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", false, function(Object_, Data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Object = null;
|
|
this.Data = null;
|
|
return;
|
|
}
|
|
this.Object = Object_;
|
|
this.Data = Data_;
|
|
});
|
|
sliceType = $sliceType($emptyInterface);
|
|
ptrType = $ptrType(websocketjs.WebSocket);
|
|
ptrType$1 = $ptrType(bytes.Reader);
|
|
ptrType$2 = $ptrType(time.Location);
|
|
ptrType$3 = $ptrType(messageEvent);
|
|
sliceType$1 = $sliceType($Uint8);
|
|
ptrType$4 = $ptrType(url.URL);
|
|
ptrType$5 = $ptrType(addr);
|
|
ptrType$6 = $ptrType(closeError);
|
|
ptrType$7 = $ptrType(js.Object);
|
|
ptrType$8 = $ptrType(deadlineErr);
|
|
ptrType$9 = $ptrType(conn);
|
|
chanType = $chanType(ptrType$3, false, false);
|
|
addr.ptr.prototype.Network = function() {
|
|
var addr$1;
|
|
addr$1 = this;
|
|
return "websocket";
|
|
};
|
|
addr.prototype.Network = function() { return this.$val.Network(); };
|
|
beginHandlerOpen = function(ch, removeHandlers) {
|
|
var ch, removeHandlers;
|
|
return (function $b(ev) {
|
|
var ev, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; ev = $f.ev; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = removeHandlers(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$close(ch);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f.ev = ev; $f.$s = $s; $f.$r = $r; return $f;
|
|
});
|
|
};
|
|
closeError.ptr.prototype.Error = function() {
|
|
var _r, cleanStmt, e, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; cleanStmt = $f.cleanStmt; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
e = this;
|
|
cleanStmt = "";
|
|
if (!!(e.Object.wasClean)) {
|
|
cleanStmt = "clean";
|
|
} else {
|
|
cleanStmt = "unclean";
|
|
}
|
|
_r = fmt.Sprintf("CloseEvent: (%s) (%d) %s", new sliceType([new $String(cleanStmt), new $Int(($parseInt(e.Object.code) >> 0)), new $String($internalize(e.Object.reason, $String))])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: closeError.ptr.prototype.Error }; } $f._r = _r; $f.cleanStmt = cleanStmt; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
closeError.prototype.Error = function() { return this.$val.Error(); };
|
|
beginHandlerClose = function(ch, removeHandlers) {
|
|
var ch, removeHandlers;
|
|
return (function $b(ev) {
|
|
var ev, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; ev = $f.ev; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
ev = [ev];
|
|
$r = removeHandlers(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$go((function(ev) { return function $b() {
|
|
var $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = $send(ch, new closeError.ptr(ev[0], 0, "", false)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$close(ch);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(ev), []);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f.ev = ev; $f.$s = $s; $f.$r = $r; return $f;
|
|
});
|
|
};
|
|
deadlineErr.ptr.prototype.Error = function() {
|
|
var e;
|
|
e = this;
|
|
return "i/o timeout: deadline reached";
|
|
};
|
|
deadlineErr.prototype.Error = function() { return this.$val.Error(); };
|
|
deadlineErr.ptr.prototype.Timeout = function() {
|
|
var e;
|
|
e = this;
|
|
return true;
|
|
};
|
|
deadlineErr.prototype.Timeout = function() { return this.$val.Timeout(); };
|
|
deadlineErr.ptr.prototype.Temporary = function() {
|
|
var e;
|
|
e = this;
|
|
return true;
|
|
};
|
|
deadlineErr.prototype.Temporary = function() { return this.$val.Temporary(); };
|
|
Dial = function(url$1) {
|
|
var _r, _tuple, _tuple$1, closeHandler, conn$1, err, ok, openCh, openHandler, removeHandlers, url$1, ws, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; closeHandler = $f.closeHandler; conn$1 = $f.conn$1; err = $f.err; ok = $f.ok; openCh = $f.openCh; openHandler = $f.openHandler; removeHandlers = $f.removeHandlers; url$1 = $f.url$1; ws = $f.ws; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
closeHandler = [closeHandler];
|
|
openHandler = [openHandler];
|
|
ws = [ws];
|
|
_tuple = websocketjs.New(url$1);
|
|
ws[0] = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [$ifaceNil, err];
|
|
}
|
|
conn$1 = new conn.ptr(ws[0], new $Chan(ptrType$3, 1), ptrType$1.nil, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil));
|
|
conn$1.initialize();
|
|
openCh = new $Chan($error, 1);
|
|
openHandler[0] = $throwNilPointerError;
|
|
closeHandler[0] = $throwNilPointerError;
|
|
removeHandlers = (function(closeHandler, openHandler, ws) { return function() {
|
|
ws[0].RemoveEventListener("open", false, openHandler[0]);
|
|
ws[0].RemoveEventListener("close", false, closeHandler[0]);
|
|
}; })(closeHandler, openHandler, ws);
|
|
openHandler[0] = beginHandlerOpen(openCh, removeHandlers);
|
|
closeHandler[0] = beginHandlerClose(openCh, removeHandlers);
|
|
ws[0].AddEventListener("open", false, openHandler[0]);
|
|
ws[0].AddEventListener("close", false, closeHandler[0]);
|
|
_r = $recv(openCh); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
err = _tuple$1[0];
|
|
ok = _tuple$1[1];
|
|
if (ok && !($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [$ifaceNil, err];
|
|
}
|
|
$s = -1; return [conn$1, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Dial }; } $f._r = _r; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.closeHandler = closeHandler; $f.conn$1 = conn$1; $f.err = err; $f.ok = ok; $f.openCh = openCh; $f.openHandler = openHandler; $f.removeHandlers = removeHandlers; $f.url$1 = url$1; $f.ws = ws; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Dial = Dial;
|
|
conn.ptr.prototype.onMessage = function(event) {
|
|
var c, event;
|
|
c = this;
|
|
$go((function $b() {
|
|
var $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = $send(c.ch, new messageEvent.ptr(event, null)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
}), []);
|
|
};
|
|
conn.prototype.onMessage = function(event) { return this.$val.onMessage(event); };
|
|
conn.ptr.prototype.onClose = function(event) {
|
|
var c, event;
|
|
c = this;
|
|
$go((function $b() {
|
|
var $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = $send(c.ch, ptrType$3.nil); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
}), []);
|
|
};
|
|
conn.prototype.onClose = function(event) { return this.$val.onClose(event); };
|
|
conn.ptr.prototype.initialize = function() {
|
|
var c;
|
|
c = this;
|
|
c.WebSocket.Object.binaryType = $externalize("arraybuffer", $String);
|
|
c.WebSocket.AddEventListener("message", false, $methodVal(c, "onMessage"));
|
|
c.WebSocket.AddEventListener("close", false, $methodVal(c, "onClose"));
|
|
};
|
|
conn.prototype.initialize = function() { return this.$val.initialize(); };
|
|
conn.ptr.prototype.handleFrame = function(message, ok) {
|
|
var c, message, ok;
|
|
c = this;
|
|
if (!ok) {
|
|
return [ptrType$3.nil, io.EOF];
|
|
} else if (message === ptrType$3.nil) {
|
|
$close(c.ch);
|
|
return [ptrType$3.nil, io.EOF];
|
|
}
|
|
return [message, $ifaceNil];
|
|
};
|
|
conn.prototype.handleFrame = function(message, ok) { return this.$val.handleFrame(message, ok); };
|
|
conn.ptr.prototype.receiveFrame = function(observeDeadline) {
|
|
var _r, _selection, _selection$1, _tuple, _tuple$1, c, deadlineChan, item, item$1, now, observeDeadline, ok, ok$1, timer, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _selection = $f._selection; _selection$1 = $f._selection$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; c = $f.c; deadlineChan = $f.deadlineChan; item = $f.item; item$1 = $f.item$1; now = $f.now; observeDeadline = $f.observeDeadline; ok = $f.ok; ok$1 = $f.ok$1; timer = $f.timer; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
c = this;
|
|
deadlineChan = $chanNil;
|
|
/* */ if (observeDeadline && !$clone(c.readDeadline, time.Time).IsZero()) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (observeDeadline && !$clone(c.readDeadline, time.Time).IsZero()) { */ case 1:
|
|
now = $clone(time.Now(), time.Time);
|
|
if ($clone(now, time.Time).After($clone(c.readDeadline, time.Time))) {
|
|
_selection = $select([[c.ch], []]);
|
|
if (_selection[0] === 0) {
|
|
_tuple = _selection[1];
|
|
item = _tuple[0];
|
|
ok = _tuple[1];
|
|
$s = -1; return c.handleFrame(item, ok);
|
|
} else if (_selection[0] === 1) {
|
|
$s = -1; return [ptrType$3.nil, errDeadlineReached];
|
|
}
|
|
}
|
|
timer = time.NewTimer($clone(c.readDeadline, time.Time).Sub($clone(now, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadlineChan = timer.C;
|
|
/* } */ case 2:
|
|
_r = $select([[c.ch], [deadlineChan]]); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection$1 = _r;
|
|
if (_selection$1[0] === 0) {
|
|
_tuple$1 = _selection$1[1];
|
|
item$1 = _tuple$1[0];
|
|
ok$1 = _tuple$1[1];
|
|
$s = -1; return c.handleFrame(item$1, ok$1);
|
|
} else if (_selection$1[0] === 1) {
|
|
$s = -1; return [ptrType$3.nil, errDeadlineReached];
|
|
}
|
|
$s = -1; return [ptrType$3.nil, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [ptrType$3.nil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: conn.ptr.prototype.receiveFrame }; } $f._r = _r; $f._selection = _selection; $f._selection$1 = _selection$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.c = c; $f.deadlineChan = deadlineChan; $f.item = item; $f.item$1 = item$1; $f.now = now; $f.observeDeadline = observeDeadline; $f.ok = ok; $f.ok$1 = ok$1; $f.timer = timer; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
conn.prototype.receiveFrame = function(observeDeadline) { return this.$val.receiveFrame(observeDeadline); };
|
|
getFrameData = function(obj) {
|
|
var constructor, obj, uint8Array;
|
|
constructor = obj.constructor;
|
|
if (constructor === $global.ArrayBuffer) {
|
|
uint8Array = new ($global.Uint8Array)(obj);
|
|
return $assertType($internalize(uint8Array, $emptyInterface), sliceType$1);
|
|
}
|
|
return (new sliceType$1($stringToBytes($internalize(obj, $String))));
|
|
};
|
|
conn.ptr.prototype.Read = function(b) {
|
|
var _r, _tmp, _tmp$1, _tuple, _tuple$1, b, c, err, frame, n, receivedBytes, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; b = $f.b; c = $f.c; err = $f.err; frame = $f.frame; n = $f.n; receivedBytes = $f.receivedBytes; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
c = this;
|
|
if (!(c.readBuf === ptrType$1.nil)) {
|
|
_tuple = c.readBuf.Read(b);
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
if ($interfaceIsEqual(err, io.EOF)) {
|
|
c.readBuf = ptrType$1.nil;
|
|
err = $ifaceNil;
|
|
}
|
|
if (n > 0) {
|
|
$s = -1; return [n, err];
|
|
}
|
|
}
|
|
_r = c.receiveFrame(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
frame = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
receivedBytes = getFrameData(frame.Object.data);
|
|
n = $copySlice(b, receivedBytes);
|
|
if (n >= receivedBytes.$length) {
|
|
$s = -1; return [n, err];
|
|
}
|
|
c.readBuf = bytes.NewReader($subslice(receivedBytes, n));
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: conn.ptr.prototype.Read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.b = b; $f.c = c; $f.err = err; $f.frame = frame; $f.n = n; $f.receivedBytes = receivedBytes; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
conn.prototype.Read = function(b) { return this.$val.Read(b); };
|
|
conn.ptr.prototype.Write = function(b) {
|
|
var _tmp, _tmp$1, _tmp$2, _tmp$3, b, c, err, n;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
c = this;
|
|
err = c.WebSocket.Send(b);
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = err;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
return [n, err];
|
|
}
|
|
_tmp$2 = b.$length;
|
|
_tmp$3 = $ifaceNil;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
return [n, err];
|
|
};
|
|
conn.prototype.Write = function(b) { return this.$val.Write(b); };
|
|
conn.ptr.prototype.LocalAddr = function() {
|
|
var c;
|
|
c = this;
|
|
$panic(new $String("we are unable to implement websocket.conn.LocalAddr() due to limitations in the underlying JavaScript API"));
|
|
};
|
|
conn.prototype.LocalAddr = function() { return this.$val.LocalAddr(); };
|
|
conn.ptr.prototype.RemoteAddr = function() {
|
|
var _r, _tuple, c, err, wsURL, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; c = $f.c; err = $f.err; wsURL = $f.wsURL; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
c = this;
|
|
_r = url.Parse($internalize(c.WebSocket.Object.url, $String)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
wsURL = _tuple[0];
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$panic(err);
|
|
}
|
|
$s = -1; return new addr.ptr(wsURL);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: conn.ptr.prototype.RemoteAddr }; } $f._r = _r; $f._tuple = _tuple; $f.c = c; $f.err = err; $f.wsURL = wsURL; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
conn.prototype.RemoteAddr = function() { return this.$val.RemoteAddr(); };
|
|
conn.ptr.prototype.SetDeadline = function(t) {
|
|
var c, t;
|
|
c = this;
|
|
time.Time.copy(c.readDeadline, t);
|
|
return $ifaceNil;
|
|
};
|
|
conn.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
|
|
conn.ptr.prototype.SetReadDeadline = function(t) {
|
|
var c, t;
|
|
c = this;
|
|
time.Time.copy(c.readDeadline, t);
|
|
return $ifaceNil;
|
|
};
|
|
conn.prototype.SetReadDeadline = function(t) { return this.$val.SetReadDeadline(t); };
|
|
conn.ptr.prototype.SetWriteDeadline = function(t) {
|
|
var c, t;
|
|
c = this;
|
|
return $ifaceNil;
|
|
};
|
|
conn.prototype.SetWriteDeadline = function(t) { return this.$val.SetWriteDeadline(t); };
|
|
ptrType$5.methods = [{prop: "Network", name: "Network", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$6.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
|
|
ptrType$8.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
|
|
ptrType$9.methods = [{prop: "onMessage", name: "onMessage", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", typ: $funcType([ptrType$7], [], false)}, {prop: "onClose", name: "onClose", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", typ: $funcType([ptrType$7], [], false)}, {prop: "initialize", name: "initialize", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", typ: $funcType([], [], false)}, {prop: "handleFrame", name: "handleFrame", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", typ: $funcType([ptrType$3, $Bool], [ptrType$3, $error], false)}, {prop: "receiveFrame", name: "receiveFrame", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", typ: $funcType([$Bool], [ptrType$3, $error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "LocalAddr", name: "LocalAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "RemoteAddr", name: "RemoteAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetReadDeadline", name: "SetReadDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetWriteDeadline", name: "SetWriteDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}];
|
|
addr.init("", [{prop: "URL", name: "URL", embedded: true, exported: true, typ: ptrType$4, tag: ""}]);
|
|
closeError.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType$7, tag: ""}, {prop: "Code", name: "Code", embedded: false, exported: true, typ: $Int, tag: "js:\"code\""}, {prop: "Reason", name: "Reason", embedded: false, exported: true, typ: $String, tag: "js:\"reason\""}, {prop: "WasClean", name: "WasClean", embedded: false, exported: true, typ: $Bool, tag: "js:\"wasClean\""}]);
|
|
deadlineErr.init("", []);
|
|
conn.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket", [{prop: "WebSocket", name: "WebSocket", embedded: true, exported: true, typ: ptrType, tag: ""}, {prop: "ch", name: "ch", embedded: false, exported: false, typ: chanType, tag: ""}, {prop: "readBuf", name: "readBuf", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "readDeadline", name: "readDeadline", embedded: false, exported: false, typ: time.Time, tag: ""}]);
|
|
messageEvent.init("", [{prop: "Object", name: "Object", embedded: true, exported: true, typ: ptrType$7, tag: ""}, {prop: "Data", name: "Data", embedded: false, exported: true, typ: ptrType$7, tag: "js:\"data\""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = bytes.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmt.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = websocketjs.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = net.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = url.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
errDeadlineReached = new deadlineErr.ptr();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["container/heap"] = (function() {
|
|
var $pkg = {}, $init, sort, Push, Pop, up, down;
|
|
sort = $packages["sort"];
|
|
Push = function(h, x) {
|
|
var _arg, _arg$1, _r, h, x, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; h = $f.h; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = h.Push(x); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_arg = h;
|
|
_r = h.Len(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg$1 = _r - 1 >> 0;
|
|
$r = up(_arg, _arg$1); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Push }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f.h = h; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Push = Push;
|
|
Pop = function(h) {
|
|
var _r, _r$1, _r$2, h, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; h = $f.h; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = h.Len(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r - 1 >> 0;
|
|
$r = h.Swap(0, n); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r$1 = down(h, 0, n); /* */ $s = 3; case 3: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
_r$2 = h.Pop(); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$s = -1; return _r$2;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Pop }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.h = h; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Pop = Pop;
|
|
up = function(h, j) {
|
|
var _q, _r, _v, h, i, j, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _v = $f._v; h = $f.h; i = $f.i; j = $f.j; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
/* while (true) { */ case 1:
|
|
i = (_q = ((j - 1 >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
if (i === j) { _v = true; $s = 5; continue s; }
|
|
_r = h.Less(j, i); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = !_r; case 5:
|
|
/* */ if (_v) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (_v) { */ case 3:
|
|
/* break; */ $s = 2; continue;
|
|
/* } */ case 4:
|
|
$r = h.Swap(i, j); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
j = i;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: up }; } $f._q = _q; $f._r = _r; $f._v = _v; $f.h = h; $f.i = i; $f.j = j; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
down = function(h, i0, n) {
|
|
var _r, _r$1, _v, h, i, i0, j, j1, j2, n, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _v = $f._v; h = $f.h; i = $f.i; i0 = $f.i0; j = $f.j; j1 = $f.j1; j2 = $f.j2; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
i = i0;
|
|
/* while (true) { */ case 1:
|
|
j1 = ($imul(2, i)) + 1 >> 0;
|
|
if (j1 >= n || j1 < 0) {
|
|
/* break; */ $s = 2; continue;
|
|
}
|
|
j = j1;
|
|
j2 = j1 + 1 >> 0;
|
|
if (!(j2 < n)) { _v = false; $s = 5; continue s; }
|
|
_r = h.Less(j2, j1); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_v = _r; case 5:
|
|
/* */ if (_v) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (_v) { */ case 3:
|
|
j = j2;
|
|
/* } */ case 4:
|
|
_r$1 = h.Less(j, i); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
/* */ if (!_r$1) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (!_r$1) { */ case 7:
|
|
/* break; */ $s = 2; continue;
|
|
/* } */ case 8:
|
|
$r = h.Swap(i, j); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
i = j;
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return i > i0;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: down }; } $f._r = _r; $f._r$1 = _r$1; $f._v = _v; $f.h = h; $f.i = i; $f.i0 = i0; $f.j = j; $f.j1 = j1; $f.j2 = j2; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = sort.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux"] = (function() {
|
|
var $pkg = {}, $init, heap, binary, errors, fmt, io, math, net, sync, atomic, time, Allocator, Frame, rawHeader, updHeader, Config, writeRequest, writeResult, buffersWriter, Session, shaperHeap, Stream, ptrType, sliceType, sliceType$1, sliceType$2, ptrType$1, ptrType$2, structType, ptrType$3, interfaceType, interfaceType$1, ptrType$4, arrayType, ptrType$5, sliceType$3, ptrType$6, ptrType$7, chanType, chanType$1, chanType$2, mapType, chanType$3, chanType$4, chanType$5, defaultAllocator, debruijinPos, init, NewAllocator, msb, newFrame, DefaultConfig, VerifyConfig, Client, newSession, newStream;
|
|
heap = $packages["container/heap"];
|
|
binary = $packages["encoding/binary"];
|
|
errors = $packages["errors"];
|
|
fmt = $packages["fmt"];
|
|
io = $packages["io"];
|
|
math = $packages["math"];
|
|
net = $packages["net"];
|
|
sync = $packages["sync"];
|
|
atomic = $packages["sync/atomic"];
|
|
time = $packages["time"];
|
|
Allocator = $pkg.Allocator = $newType(0, $kindStruct, "smux.Allocator", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", true, function(buffers_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.buffers = sliceType.nil;
|
|
return;
|
|
}
|
|
this.buffers = buffers_;
|
|
});
|
|
Frame = $pkg.Frame = $newType(0, $kindStruct, "smux.Frame", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", true, function(ver_, cmd_, sid_, data_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.ver = 0;
|
|
this.cmd = 0;
|
|
this.sid = 0;
|
|
this.data = sliceType$1.nil;
|
|
return;
|
|
}
|
|
this.ver = ver_;
|
|
this.cmd = cmd_;
|
|
this.sid = sid_;
|
|
this.data = data_;
|
|
});
|
|
rawHeader = $pkg.rawHeader = $newType(8, $kindArray, "smux.rawHeader", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, null);
|
|
updHeader = $pkg.updHeader = $newType(8, $kindArray, "smux.updHeader", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, null);
|
|
Config = $pkg.Config = $newType(0, $kindStruct, "smux.Config", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", true, function(Version_, KeepAliveInterval_, KeepAliveTimeout_, MaxFrameSize_, MaxReceiveBuffer_, MaxStreamBuffer_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.Version = 0;
|
|
this.KeepAliveInterval = new time.Duration(0, 0);
|
|
this.KeepAliveTimeout = new time.Duration(0, 0);
|
|
this.MaxFrameSize = 0;
|
|
this.MaxReceiveBuffer = 0;
|
|
this.MaxStreamBuffer = 0;
|
|
return;
|
|
}
|
|
this.Version = Version_;
|
|
this.KeepAliveInterval = KeepAliveInterval_;
|
|
this.KeepAliveTimeout = KeepAliveTimeout_;
|
|
this.MaxFrameSize = MaxFrameSize_;
|
|
this.MaxReceiveBuffer = MaxReceiveBuffer_;
|
|
this.MaxStreamBuffer = MaxStreamBuffer_;
|
|
});
|
|
writeRequest = $pkg.writeRequest = $newType(0, $kindStruct, "smux.writeRequest", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, function(prio_, frame_, result_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.prio = new $Uint64(0, 0);
|
|
this.frame = new Frame.ptr(0, 0, 0, sliceType$1.nil);
|
|
this.result = $chanNil;
|
|
return;
|
|
}
|
|
this.prio = prio_;
|
|
this.frame = frame_;
|
|
this.result = result_;
|
|
});
|
|
writeResult = $pkg.writeResult = $newType(0, $kindStruct, "smux.writeResult", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, function(n_, err_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.n = 0;
|
|
this.err = $ifaceNil;
|
|
return;
|
|
}
|
|
this.n = n_;
|
|
this.err = err_;
|
|
});
|
|
buffersWriter = $pkg.buffersWriter = $newType(8, $kindInterface, "smux.buffersWriter", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, null);
|
|
Session = $pkg.Session = $newType(0, $kindStruct, "smux.Session", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", true, function(conn_, config_, nextStreamID_, nextStreamIDLock_, bucket_, bucketNotify_, streams_, streamLock_, die_, dieOnce_, socketReadError_, socketWriteError_, chSocketReadError_, chSocketWriteError_, socketReadErrorOnce_, socketWriteErrorOnce_, protoError_, chProtoError_, protoErrorOnce_, chAccepts_, dataReady_, goAway_, deadline_, shaper_, writes_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.conn = $ifaceNil;
|
|
this.config = ptrType$1.nil;
|
|
this.nextStreamID = 0;
|
|
this.nextStreamIDLock = new sync.Mutex.ptr(0, 0);
|
|
this.bucket = 0;
|
|
this.bucketNotify = $chanNil;
|
|
this.streams = false;
|
|
this.streamLock = new sync.Mutex.ptr(0, 0);
|
|
this.die = $chanNil;
|
|
this.dieOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.socketReadError = new atomic.Value.ptr($ifaceNil);
|
|
this.socketWriteError = new atomic.Value.ptr($ifaceNil);
|
|
this.chSocketReadError = $chanNil;
|
|
this.chSocketWriteError = $chanNil;
|
|
this.socketReadErrorOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.socketWriteErrorOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.protoError = new atomic.Value.ptr($ifaceNil);
|
|
this.chProtoError = $chanNil;
|
|
this.protoErrorOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.chAccepts = $chanNil;
|
|
this.dataReady = 0;
|
|
this.goAway = 0;
|
|
this.deadline = new atomic.Value.ptr($ifaceNil);
|
|
this.shaper = $chanNil;
|
|
this.writes = $chanNil;
|
|
return;
|
|
}
|
|
this.conn = conn_;
|
|
this.config = config_;
|
|
this.nextStreamID = nextStreamID_;
|
|
this.nextStreamIDLock = nextStreamIDLock_;
|
|
this.bucket = bucket_;
|
|
this.bucketNotify = bucketNotify_;
|
|
this.streams = streams_;
|
|
this.streamLock = streamLock_;
|
|
this.die = die_;
|
|
this.dieOnce = dieOnce_;
|
|
this.socketReadError = socketReadError_;
|
|
this.socketWriteError = socketWriteError_;
|
|
this.chSocketReadError = chSocketReadError_;
|
|
this.chSocketWriteError = chSocketWriteError_;
|
|
this.socketReadErrorOnce = socketReadErrorOnce_;
|
|
this.socketWriteErrorOnce = socketWriteErrorOnce_;
|
|
this.protoError = protoError_;
|
|
this.chProtoError = chProtoError_;
|
|
this.protoErrorOnce = protoErrorOnce_;
|
|
this.chAccepts = chAccepts_;
|
|
this.dataReady = dataReady_;
|
|
this.goAway = goAway_;
|
|
this.deadline = deadline_;
|
|
this.shaper = shaper_;
|
|
this.writes = writes_;
|
|
});
|
|
shaperHeap = $pkg.shaperHeap = $newType(12, $kindSlice, "smux.shaperHeap", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", false, null);
|
|
Stream = $pkg.Stream = $newType(0, $kindStruct, "smux.Stream", true, "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", true, function(id_, sess_, buffers_, heads_, bufferLock_, frameSize_, chReadEvent_, die_, dieOnce_, chFinEvent_, finEventOnce_, readDeadline_, writeDeadline_, numRead_, numWritten_, incr_, peerConsumed_, peerWindow_, chUpdate_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.id = 0;
|
|
this.sess = ptrType$2.nil;
|
|
this.buffers = sliceType$3.nil;
|
|
this.heads = sliceType$3.nil;
|
|
this.bufferLock = new sync.Mutex.ptr(0, 0);
|
|
this.frameSize = 0;
|
|
this.chReadEvent = $chanNil;
|
|
this.die = $chanNil;
|
|
this.dieOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.chFinEvent = $chanNil;
|
|
this.finEventOnce = new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0);
|
|
this.readDeadline = new atomic.Value.ptr($ifaceNil);
|
|
this.writeDeadline = new atomic.Value.ptr($ifaceNil);
|
|
this.numRead = 0;
|
|
this.numWritten = 0;
|
|
this.incr = 0;
|
|
this.peerConsumed = 0;
|
|
this.peerWindow = 0;
|
|
this.chUpdate = $chanNil;
|
|
return;
|
|
}
|
|
this.id = id_;
|
|
this.sess = sess_;
|
|
this.buffers = buffers_;
|
|
this.heads = heads_;
|
|
this.bufferLock = bufferLock_;
|
|
this.frameSize = frameSize_;
|
|
this.chReadEvent = chReadEvent_;
|
|
this.die = die_;
|
|
this.dieOnce = dieOnce_;
|
|
this.chFinEvent = chFinEvent_;
|
|
this.finEventOnce = finEventOnce_;
|
|
this.readDeadline = readDeadline_;
|
|
this.writeDeadline = writeDeadline_;
|
|
this.numRead = numRead_;
|
|
this.numWritten = numWritten_;
|
|
this.incr = incr_;
|
|
this.peerConsumed = peerConsumed_;
|
|
this.peerWindow = peerWindow_;
|
|
this.chUpdate = chUpdate_;
|
|
});
|
|
ptrType = $ptrType(Allocator);
|
|
sliceType = $sliceType(sync.Pool);
|
|
sliceType$1 = $sliceType($Uint8);
|
|
sliceType$2 = $sliceType($emptyInterface);
|
|
ptrType$1 = $ptrType(Config);
|
|
ptrType$2 = $ptrType(Session);
|
|
structType = $structType("", []);
|
|
ptrType$3 = $ptrType(Stream);
|
|
interfaceType = $interfaceType([{prop: "LocalAddr", name: "LocalAddr", pkg: "", typ: $funcType([], [net.Addr], false)}]);
|
|
interfaceType$1 = $interfaceType([{prop: "RemoteAddr", name: "RemoteAddr", pkg: "", typ: $funcType([], [net.Addr], false)}]);
|
|
ptrType$4 = $ptrType($Int32);
|
|
arrayType = $arrayType($Uint8, 8);
|
|
ptrType$5 = $ptrType(shaperHeap);
|
|
sliceType$3 = $sliceType(sliceType$1);
|
|
ptrType$6 = $ptrType(time.Timer);
|
|
ptrType$7 = $ptrType($Uint32);
|
|
chanType = $chanType(writeResult, false, false);
|
|
chanType$1 = $chanType(time.Time, false, true);
|
|
chanType$2 = $chanType(structType, false, false);
|
|
mapType = $mapType($Uint32, ptrType$3);
|
|
chanType$3 = $chanType(ptrType$3, false, false);
|
|
chanType$4 = $chanType(writeRequest, false, false);
|
|
chanType$5 = $chanType(structType, false, true);
|
|
init = function() {
|
|
defaultAllocator = NewAllocator();
|
|
};
|
|
NewAllocator = function() {
|
|
var _i, _ref, alloc, i, k, x;
|
|
alloc = new Allocator.ptr(sliceType.nil);
|
|
alloc.buffers = $makeSlice(sliceType, 17);
|
|
_ref = alloc.buffers;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
i = [i];
|
|
k = _i;
|
|
i[0] = k;
|
|
(x = alloc.buffers, ((k < 0 || k >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + k])).New = (function(i) { return function() {
|
|
var y;
|
|
return $makeSlice(sliceType$1, ((y = ((i[0] >>> 0)), y < 32 ? (1 << y) : 0) >> 0));
|
|
}; })(i);
|
|
_i++;
|
|
}
|
|
return alloc;
|
|
};
|
|
$pkg.NewAllocator = NewAllocator;
|
|
Allocator.ptr.prototype.Get = function(size) {
|
|
var _r, _r$1, alloc, bits, size, x, x$1, x$2, y, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; alloc = $f.alloc; bits = $f.bits; size = $f.size; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
alloc = this;
|
|
if (size <= 0 || size > 65536) {
|
|
$s = -1; return sliceType$1.nil;
|
|
}
|
|
bits = msb(size);
|
|
/* */ if (size === ((y = bits, y < 32 ? (1 << y) : 0) >> 0)) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (size === ((y = bits, y < 32 ? (1 << y) : 0) >> 0)) { */ case 1:
|
|
_r = (x = alloc.buffers, ((bits < 0 || bits >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + bits])).Get(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return $subslice($assertType(_r, sliceType$1), 0, size);
|
|
/* } else { */ case 2:
|
|
_r$1 = (x$1 = alloc.buffers, x$2 = bits + 1 << 24 >>> 24, ((x$2 < 0 || x$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + x$2])).Get(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
$s = -1; return $subslice($assertType(_r$1, sliceType$1), 0, size);
|
|
/* } */ case 3:
|
|
$s = -1; return sliceType$1.nil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Allocator.ptr.prototype.Get }; } $f._r = _r; $f._r$1 = _r$1; $f.alloc = alloc; $f.bits = bits; $f.size = size; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Allocator.prototype.Get = function(size) { return this.$val.Get(size); };
|
|
Allocator.ptr.prototype.Put = function(buf) {
|
|
var alloc, bits, buf, x, y;
|
|
alloc = this;
|
|
bits = msb(buf.$capacity);
|
|
if ((buf.$capacity === 0) || buf.$capacity > 65536 || !((buf.$capacity === ((y = bits, y < 32 ? (1 << y) : 0) >> 0)))) {
|
|
return errors.New("allocator Put() incorrect buffer size");
|
|
}
|
|
(x = alloc.buffers, ((bits < 0 || bits >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + bits])).Put(buf);
|
|
return $ifaceNil;
|
|
};
|
|
Allocator.prototype.Put = function(buf) { return this.$val.Put(buf); };
|
|
msb = function(size) {
|
|
var size, v, x;
|
|
v = ((size >>> 0));
|
|
v = (v | ((v >>> 1 >>> 0))) >>> 0;
|
|
v = (v | ((v >>> 2 >>> 0))) >>> 0;
|
|
v = (v | ((v >>> 4 >>> 0))) >>> 0;
|
|
v = (v | ((v >>> 8 >>> 0))) >>> 0;
|
|
v = (v | ((v >>> 16 >>> 0))) >>> 0;
|
|
return (x = (($imul(v, 130329821) >>> 0)) >>> 27 >>> 0, ((x < 0 || x >= debruijinPos.length) ? ($throwRuntimeError("index out of range"), undefined) : debruijinPos[x]));
|
|
};
|
|
newFrame = function(version, cmd, sid) {
|
|
var cmd, sid, version;
|
|
return new Frame.ptr(version, cmd, sid, sliceType$1.nil);
|
|
};
|
|
rawHeader.prototype.Version = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return h[0];
|
|
};
|
|
$ptrType(rawHeader).prototype.Version = function() { return new rawHeader(this.$get()).Version(); };
|
|
rawHeader.prototype.Cmd = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return h[1];
|
|
};
|
|
$ptrType(rawHeader).prototype.Cmd = function() { return new rawHeader(this.$get()).Cmd(); };
|
|
rawHeader.prototype.Length = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return $clone(binary.LittleEndian, binary.littleEndian).Uint16($subslice(new sliceType$1(h), 2));
|
|
};
|
|
$ptrType(rawHeader).prototype.Length = function() { return new rawHeader(this.$get()).Length(); };
|
|
rawHeader.prototype.StreamID = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return $clone(binary.LittleEndian, binary.littleEndian).Uint32($subslice(new sliceType$1(h), 4));
|
|
};
|
|
$ptrType(rawHeader).prototype.StreamID = function() { return new rawHeader(this.$get()).StreamID(); };
|
|
rawHeader.prototype.String = function() {
|
|
var _r, h, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; h = $f.h; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
h = this.$val;
|
|
_r = fmt.Sprintf("Version:%d Cmd:%d StreamID:%d Length:%d", new sliceType$2([new $Uint8(new rawHeader($clone(h, rawHeader)).Version()), new $Uint8(new rawHeader($clone(h, rawHeader)).Cmd()), new $Uint32(new rawHeader($clone(h, rawHeader)).StreamID()), new $Uint16(new rawHeader($clone(h, rawHeader)).Length())])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: rawHeader.prototype.String }; } $f._r = _r; $f.h = h; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$ptrType(rawHeader).prototype.String = function() { return new rawHeader(this.$get()).String(); };
|
|
updHeader.prototype.Consumed = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return $clone(binary.LittleEndian, binary.littleEndian).Uint32(new sliceType$1(h));
|
|
};
|
|
$ptrType(updHeader).prototype.Consumed = function() { return new updHeader(this.$get()).Consumed(); };
|
|
updHeader.prototype.Window = function() {
|
|
var h;
|
|
h = this.$val;
|
|
return $clone(binary.LittleEndian, binary.littleEndian).Uint32($subslice(new sliceType$1(h), 4));
|
|
};
|
|
$ptrType(updHeader).prototype.Window = function() { return new updHeader(this.$get()).Window(); };
|
|
DefaultConfig = function() {
|
|
return new Config.ptr(1, new time.Duration(2, 1410065408), new time.Duration(6, 4230196224), 32768, 4194304, 65536);
|
|
};
|
|
$pkg.DefaultConfig = DefaultConfig;
|
|
VerifyConfig = function(config) {
|
|
var _r, config, x, x$1, x$2, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; config = $f.config; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (!((config.Version === 1) || (config.Version === 2))) {
|
|
$s = -1; return errors.New("unsupported protocol version");
|
|
}
|
|
if ((x = config.KeepAliveInterval, (x.$high === 0 && x.$low === 0))) {
|
|
$s = -1; return errors.New("keep-alive interval must be positive");
|
|
}
|
|
/* */ if ((x$1 = config.KeepAliveTimeout, x$2 = config.KeepAliveInterval, (x$1.$high < x$2.$high || (x$1.$high === x$2.$high && x$1.$low < x$2.$low)))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if ((x$1 = config.KeepAliveTimeout, x$2 = config.KeepAliveInterval, (x$1.$high < x$2.$high || (x$1.$high === x$2.$high && x$1.$low < x$2.$low)))) { */ case 1:
|
|
_r = fmt.Errorf("keep-alive timeout must be larger than keep-alive interval", new sliceType$2([])); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
if (config.MaxFrameSize <= 0) {
|
|
$s = -1; return errors.New("max frame size must be positive");
|
|
}
|
|
if (config.MaxFrameSize > 65535) {
|
|
$s = -1; return errors.New("max frame size must not be larger than 65535");
|
|
}
|
|
if (config.MaxReceiveBuffer <= 0) {
|
|
$s = -1; return errors.New("max receive buffer must be positive");
|
|
}
|
|
if (config.MaxStreamBuffer <= 0) {
|
|
$s = -1; return errors.New("max stream buffer must be positive");
|
|
}
|
|
if (config.MaxStreamBuffer > config.MaxReceiveBuffer) {
|
|
$s = -1; return errors.New("max stream buffer must not be larger than max receive buffer");
|
|
}
|
|
if (config.MaxStreamBuffer > 2147483647) {
|
|
$s = -1; return errors.New("max stream buffer cannot be larger than 2147483647");
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: VerifyConfig }; } $f._r = _r; $f.config = config; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.VerifyConfig = VerifyConfig;
|
|
Client = function(conn, config) {
|
|
var _r, config, conn, err, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; config = $f.config; conn = $f.conn; err = $f.err; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
if (config === ptrType$1.nil) {
|
|
config = DefaultConfig();
|
|
}
|
|
_r = VerifyConfig(config); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err = _r;
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$2.nil, err];
|
|
}
|
|
$s = -1; return [newSession(config, conn, true), $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Client }; } $f._r = _r; $f.config = config; $f.conn = conn; $f.err = err; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Client = Client;
|
|
newSession = function(config, conn, client) {
|
|
var client, config, conn, s;
|
|
s = new Session.ptr($ifaceNil, ptrType$1.nil, 0, new sync.Mutex.ptr(0, 0), 0, $chanNil, false, new sync.Mutex.ptr(0, 0), $chanNil, new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), new atomic.Value.ptr($ifaceNil), new atomic.Value.ptr($ifaceNil), $chanNil, $chanNil, new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), new atomic.Value.ptr($ifaceNil), $chanNil, new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), $chanNil, 0, 0, new atomic.Value.ptr($ifaceNil), $chanNil, $chanNil);
|
|
s.die = new $Chan(structType, 0);
|
|
s.conn = conn;
|
|
s.config = config;
|
|
s.streams = {};
|
|
s.chAccepts = new $Chan(ptrType$3, 1024);
|
|
s.bucket = ((config.MaxReceiveBuffer >> 0));
|
|
s.bucketNotify = new $Chan(structType, 1);
|
|
s.shaper = new $Chan(writeRequest, 0);
|
|
s.writes = new $Chan(writeRequest, 0);
|
|
s.chSocketReadError = new $Chan(structType, 0);
|
|
s.chSocketWriteError = new $Chan(structType, 0);
|
|
s.chProtoError = new $Chan(structType, 0);
|
|
if (client) {
|
|
s.nextStreamID = 1;
|
|
} else {
|
|
s.nextStreamID = 0;
|
|
}
|
|
$go($methodVal(s, "shaperLoop"), []);
|
|
$go($methodVal(s, "recvLoop"), []);
|
|
$go($methodVal(s, "sendLoop"), []);
|
|
$go($methodVal(s, "keepalive"), []);
|
|
return s;
|
|
};
|
|
Session.ptr.prototype.OpenStream = function() {
|
|
var _key, _r, _r$1, _selection, _tuple, err, s, sid, stream, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _key = $f._key; _r = $f._r; _r$1 = $f._r$1; _selection = $f._selection; _tuple = $f._tuple; err = $f.err; s = $f.s; sid = $f.sid; stream = $f.stream; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
if (s.IsClosed()) {
|
|
$s = -1; return [ptrType$3.nil, io.ErrClosedPipe];
|
|
}
|
|
$r = s.nextStreamIDLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (s.goAway > 0) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (s.goAway > 0) { */ case 2:
|
|
$r = s.nextStreamIDLock.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return [ptrType$3.nil, $pkg.ErrGoAway];
|
|
/* } */ case 3:
|
|
s.nextStreamID = s.nextStreamID + (2) >>> 0;
|
|
sid = s.nextStreamID;
|
|
/* */ if (sid === (_r = sid % 2, _r === _r ? _r : $throwRuntimeError("integer divide by zero"))) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (sid === (_r = sid % 2, _r === _r ? _r : $throwRuntimeError("integer divide by zero"))) { */ case 5:
|
|
s.goAway = 1;
|
|
$r = s.nextStreamIDLock.Unlock(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return [ptrType$3.nil, $pkg.ErrGoAway];
|
|
/* } */ case 6:
|
|
$r = s.nextStreamIDLock.Unlock(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
stream = newStream(sid, s.config.MaxFrameSize, s);
|
|
_r$1 = s.writeFrame($clone(newFrame(((s.config.Version << 24 >>> 24)), 0, sid), Frame)); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
err = _tuple[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return [ptrType$3.nil, err];
|
|
}
|
|
$r = s.streamLock.Lock(); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(s.streamLock, "Unlock"), []]);
|
|
_selection = $select([[s.chSocketReadError], [s.chSocketWriteError], [s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
$s = -1; return [ptrType$3.nil, $assertType(s.socketReadError.Load(), $error)];
|
|
} else if (_selection[0] === 1) {
|
|
$s = -1; return [ptrType$3.nil, $assertType(s.socketWriteError.Load(), $error)];
|
|
} else if (_selection[0] === 2) {
|
|
$s = -1; return [ptrType$3.nil, io.ErrClosedPipe];
|
|
} else if (_selection[0] === 3) {
|
|
_key = sid; (s.streams || $throwRuntimeError("assignment to entry in nil map"))[$Uint32.keyFor(_key)] = { k: _key, v: stream };
|
|
$s = -1; return [stream, $ifaceNil];
|
|
}
|
|
$s = -1; return [ptrType$3.nil, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [ptrType$3.nil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Session.ptr.prototype.OpenStream }; } $f._key = _key; $f._r = _r; $f._r$1 = _r$1; $f._selection = _selection; $f._tuple = _tuple; $f.err = err; $f.s = s; $f.sid = sid; $f.stream = stream; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Session.prototype.OpenStream = function() { return this.$val.OpenStream(); };
|
|
Session.ptr.prototype.Open = function() {
|
|
var _r, _returncast, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _returncast = $f._returncast; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_r = s.OpenStream(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_returncast = _r;
|
|
$s = -1; return [_returncast[0], _returncast[1]];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.Open }; } $f._r = _r; $f._returncast = _returncast; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.Open = function() { return this.$val.Open(); };
|
|
Session.ptr.prototype.AcceptStream = function() {
|
|
var _r, _selection, _tuple, d, deadline, ok, s, stream, timer, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _selection = $f._selection; _tuple = $f._tuple; d = $f.d; deadline = $f.deadline; ok = $f.ok; s = $f.s; stream = $f.stream; timer = $f.timer; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
deadline = $chanNil;
|
|
_tuple = $assertType(s.deadline.Load(), time.Time, true);
|
|
d = $clone(_tuple[0], time.Time);
|
|
ok = _tuple[1];
|
|
if (ok && !$clone(d, time.Time).IsZero()) {
|
|
timer = time.NewTimer(time.Until($clone(d, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadline = timer.C;
|
|
}
|
|
_r = $select([[s.chAccepts], [deadline], [s.chSocketReadError], [s.chProtoError], [s.die]]); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
if (_selection[0] === 0) {
|
|
stream = _selection[1][0];
|
|
$s = -1; return [stream, $ifaceNil];
|
|
} else if (_selection[0] === 1) {
|
|
$s = -1; return [ptrType$3.nil, $pkg.ErrTimeout];
|
|
} else if (_selection[0] === 2) {
|
|
$s = -1; return [ptrType$3.nil, $assertType(s.socketReadError.Load(), $error)];
|
|
} else if (_selection[0] === 3) {
|
|
$s = -1; return [ptrType$3.nil, $assertType(s.protoError.Load(), $error)];
|
|
} else if (_selection[0] === 4) {
|
|
$s = -1; return [ptrType$3.nil, io.ErrClosedPipe];
|
|
}
|
|
$s = -1; return [ptrType$3.nil, $ifaceNil];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return [ptrType$3.nil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Session.ptr.prototype.AcceptStream }; } $f._r = _r; $f._selection = _selection; $f._tuple = _tuple; $f.d = d; $f.deadline = deadline; $f.ok = ok; $f.s = s; $f.stream = stream; $f.timer = timer; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Session.prototype.AcceptStream = function() { return this.$val.AcceptStream(); };
|
|
Session.ptr.prototype.Accept = function() {
|
|
var _r, _returncast, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _returncast = $f._returncast; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_r = s.AcceptStream(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_returncast = _r;
|
|
$s = -1; return [_returncast[0], _returncast[1]];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.Accept }; } $f._r = _r; $f._returncast = _returncast; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.Accept = function() { return this.$val.Accept(); };
|
|
Session.ptr.prototype.Close = function() {
|
|
var _entry, _entry$1, _i, _keys, _r, _ref, k, once, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _i = $f._i; _keys = $f._keys; _r = $f._r; _ref = $f._ref; k = $f.k; once = $f.once; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
once = [once];
|
|
s = [s];
|
|
s[0] = this;
|
|
once[0] = false;
|
|
$r = s[0].dieOnce.Do((function(once, s) { return function() {
|
|
$close(s[0].die);
|
|
once[0] = true;
|
|
}; })(once, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (once[0]) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (once[0]) { */ case 2:
|
|
$r = s[0].streamLock.Lock(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_ref = s[0].streams;
|
|
_i = 0;
|
|
_keys = $keys(_ref);
|
|
/* while (true) { */ case 6:
|
|
/* if (!(_i < _keys.length)) { break; } */ if(!(_i < _keys.length)) { $s = 7; continue; }
|
|
_entry = _ref[_keys[_i]];
|
|
if (_entry === undefined) {
|
|
_i++;
|
|
/* continue; */ $s = 6; continue;
|
|
}
|
|
k = _entry.k;
|
|
$r = (_entry$1 = s[0].streams[$Uint32.keyFor(k)], _entry$1 !== undefined ? _entry$1.v : ptrType$3.nil).sessionClose(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_i++;
|
|
/* } */ $s = 6; continue; case 7:
|
|
$r = s[0].streamLock.Unlock(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r = s[0].conn.Close(); /* */ $s = 10; case 10: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } else { */ case 3:
|
|
$s = -1; return io.ErrClosedPipe;
|
|
/* } */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.Close }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._i = _i; $f._keys = _keys; $f._r = _r; $f._ref = _ref; $f.k = k; $f.once = once; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.Close = function() { return this.$val.Close(); };
|
|
Session.ptr.prototype.notifyBucket = function() {
|
|
var _selection, s, $r;
|
|
/* */ var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _selection = $f._selection; s = $f.s; $r = $f.$r; }
|
|
s = this;
|
|
_selection = $select([[s.bucketNotify, new structType.ptr()], []]);
|
|
if (_selection[0] === 0) {
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
/* */ if ($f === undefined) { $f = { $blk: Session.ptr.prototype.notifyBucket }; } $f._selection = _selection; $f.s = s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.notifyBucket = function() { return this.$val.notifyBucket(); };
|
|
Session.ptr.prototype.notifyReadError = function(err) {
|
|
var err, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
err = [err];
|
|
s = [s];
|
|
s[0] = this;
|
|
$r = s[0].socketReadErrorOnce.Do((function(err, s) { return function() {
|
|
s[0].socketReadError.Store(err[0]);
|
|
$close(s[0].chSocketReadError);
|
|
}; })(err, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.notifyReadError }; } $f.err = err; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.notifyReadError = function(err) { return this.$val.notifyReadError(err); };
|
|
Session.ptr.prototype.notifyWriteError = function(err) {
|
|
var err, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
err = [err];
|
|
s = [s];
|
|
s[0] = this;
|
|
$r = s[0].socketWriteErrorOnce.Do((function(err, s) { return function() {
|
|
s[0].socketWriteError.Store(err[0]);
|
|
$close(s[0].chSocketWriteError);
|
|
}; })(err, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.notifyWriteError }; } $f.err = err; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.notifyWriteError = function(err) { return this.$val.notifyWriteError(err); };
|
|
Session.ptr.prototype.notifyProtoError = function(err) {
|
|
var err, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
err = [err];
|
|
s = [s];
|
|
s[0] = this;
|
|
$r = s[0].protoErrorOnce.Do((function(err, s) { return function() {
|
|
s[0].protoError.Store(err[0]);
|
|
$close(s[0].chProtoError);
|
|
}; })(err, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.notifyProtoError }; } $f.err = err; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.notifyProtoError = function(err) { return this.$val.notifyProtoError(err); };
|
|
Session.ptr.prototype.IsClosed = function() {
|
|
var _selection, s, $r;
|
|
/* */ var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _selection = $f._selection; s = $f.s; $r = $f.$r; }
|
|
s = this;
|
|
_selection = $select([[s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
return true;
|
|
} else if (_selection[0] === 1) {
|
|
return false;
|
|
}
|
|
/* */ if ($f === undefined) { $f = { $blk: Session.ptr.prototype.IsClosed }; } $f._selection = _selection; $f.s = s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.IsClosed = function() { return this.$val.IsClosed(); };
|
|
Session.ptr.prototype.NumStreams = function() {
|
|
var s, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
if (s.IsClosed()) {
|
|
$s = -1; return 0;
|
|
}
|
|
$r = s.streamLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$deferred.push([$methodVal(s.streamLock, "Unlock"), []]);
|
|
$s = -1; return $keys(s.streams).length;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return 0; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Session.ptr.prototype.NumStreams }; } $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Session.prototype.NumStreams = function() { return this.$val.NumStreams(); };
|
|
Session.ptr.prototype.SetDeadline = function(t) {
|
|
var s, t;
|
|
s = this;
|
|
s.deadline.Store(new t.constructor.elem(t));
|
|
return $ifaceNil;
|
|
};
|
|
Session.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
|
|
Session.ptr.prototype.LocalAddr = function() {
|
|
var _r, _tuple, ok, s, ts, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; s = $f.s; ts = $f.ts; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_tuple = $assertType(s.conn, interfaceType, true);
|
|
ts = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = ts.LocalAddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.LocalAddr }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.s = s; $f.ts = ts; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.LocalAddr = function() { return this.$val.LocalAddr(); };
|
|
Session.ptr.prototype.RemoteAddr = function() {
|
|
var _r, _tuple, ok, s, ts, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; s = $f.s; ts = $f.ts; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_tuple = $assertType(s.conn, interfaceType$1, true);
|
|
ts = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = ts.RemoteAddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.RemoteAddr }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.s = s; $f.ts = ts; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.RemoteAddr = function() { return this.$val.RemoteAddr(); };
|
|
Session.ptr.prototype.streamClosed = function(sid) {
|
|
var _entry, _r, n, s, sid, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _r = $f._r; n = $f.n; s = $f.s; sid = $f.sid; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
$r = s.streamLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r = (_entry = s.streams[$Uint32.keyFor(sid)], _entry !== undefined ? _entry.v : ptrType$3.nil).recycleTokens(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
n = _r;
|
|
if (n > 0) {
|
|
if (atomic.AddInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s))), ((n >> 0))) > 0) {
|
|
s.notifyBucket();
|
|
}
|
|
}
|
|
delete s.streams[$Uint32.keyFor(sid)];
|
|
$r = s.streamLock.Unlock(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.streamClosed }; } $f._entry = _entry; $f._r = _r; $f.n = n; $f.s = s; $f.sid = sid; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.streamClosed = function(sid) { return this.$val.streamClosed(sid); };
|
|
Session.ptr.prototype.returnTokens = function(n) {
|
|
var n, s;
|
|
s = this;
|
|
if (atomic.AddInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s))), ((n >> 0))) > 0) {
|
|
s.notifyBucket();
|
|
}
|
|
};
|
|
Session.prototype.returnTokens = function(n) { return this.$val.returnTokens(n); };
|
|
Session.ptr.prototype.recvLoop = function() {
|
|
var _1, _entry, _entry$1, _entry$2, _entry$3, _key, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _selection, _selection$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, err, err$1, err$2, hdr, newbuf, ok, ok$1, ok$2, ok$3, s, sid, stream, stream$1, stream$2, stream$3, updHdr, written, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _entry$3 = $f._entry$3; _key = $f._key; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _selection = $f._selection; _selection$1 = $f._selection$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; hdr = $f.hdr; newbuf = $f.newbuf; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; ok$3 = $f.ok$3; s = $f.s; sid = $f.sid; stream = $f.stream; stream$1 = $f.stream$1; stream$2 = $f.stream$2; stream$3 = $f.stream$3; updHdr = $f.updHdr; written = $f.written; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
hdr = arrayType.zero();
|
|
updHdr = arrayType.zero();
|
|
/* while (true) { */ case 1:
|
|
/* while (true) { */ case 3:
|
|
/* if (!(atomic.LoadInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s)))) <= 0 && !s.IsClosed())) { break; } */ if(!(atomic.LoadInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s)))) <= 0 && !s.IsClosed())) { $s = 4; continue; }
|
|
_r = $select([[s.bucketNotify], [s.die]]); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
if (_selection[0] === 0) {
|
|
} else if (_selection[0] === 1) {
|
|
$s = -1; return;
|
|
}
|
|
/* } */ $s = 3; continue; case 4:
|
|
_r$1 = io.ReadFull(s.conn, new sliceType$1(hdr)); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
err = _tuple[1];
|
|
/* */ if ($interfaceIsEqual(err, $ifaceNil)) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if ($interfaceIsEqual(err, $ifaceNil)) { */ case 7:
|
|
atomic.StoreInt32((s.$ptr_dataReady || (s.$ptr_dataReady = new ptrType$4(function() { return this.$target.dataReady; }, function($v) { this.$target.dataReady = $v; }, s))), 1);
|
|
/* */ if (!((new rawHeader($clone(hdr, rawHeader)).Version() === ((s.config.Version << 24 >>> 24))))) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (!((new rawHeader($clone(hdr, rawHeader)).Version() === ((s.config.Version << 24 >>> 24))))) { */ case 10:
|
|
$r = s.notifyProtoError($pkg.ErrInvalidProtocol); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 11:
|
|
sid = new rawHeader($clone(hdr, rawHeader)).StreamID();
|
|
_1 = new rawHeader($clone(hdr, rawHeader)).Cmd();
|
|
/* */ if (_1 === (3)) { $s = 14; continue; }
|
|
/* */ if (_1 === (0)) { $s = 15; continue; }
|
|
/* */ if (_1 === (1)) { $s = 16; continue; }
|
|
/* */ if (_1 === (2)) { $s = 17; continue; }
|
|
/* */ if (_1 === (4)) { $s = 18; continue; }
|
|
/* */ $s = 19; continue;
|
|
/* if (_1 === (3)) { */ case 14:
|
|
$s = 20; continue;
|
|
/* } else if (_1 === (0)) { */ case 15:
|
|
$r = s.streamLock.Lock(); /* */ $s = 21; case 21: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_tuple$1 = (_entry = s.streams[$Uint32.keyFor(sid)], _entry !== undefined ? [_entry.v, true] : [ptrType$3.nil, false]);
|
|
ok = _tuple$1[1];
|
|
/* */ if (!ok) { $s = 22; continue; }
|
|
/* */ $s = 23; continue;
|
|
/* if (!ok) { */ case 22:
|
|
stream = newStream(sid, s.config.MaxFrameSize, s);
|
|
_key = sid; (s.streams || $throwRuntimeError("assignment to entry in nil map"))[$Uint32.keyFor(_key)] = { k: _key, v: stream };
|
|
_r$2 = $select([[s.chAccepts, stream], [s.die]]); /* */ $s = 24; case 24: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_selection$1 = _r$2;
|
|
if (_selection$1[0] === 0) {
|
|
} else if (_selection$1[0] === 1) {
|
|
}
|
|
/* } */ case 23:
|
|
$r = s.streamLock.Unlock(); /* */ $s = 25; case 25: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 20; continue;
|
|
/* } else if (_1 === (1)) { */ case 16:
|
|
$r = s.streamLock.Lock(); /* */ $s = 26; case 26: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_tuple$2 = (_entry$1 = s.streams[$Uint32.keyFor(sid)], _entry$1 !== undefined ? [_entry$1.v, true] : [ptrType$3.nil, false]);
|
|
stream$1 = _tuple$2[0];
|
|
ok$1 = _tuple$2[1];
|
|
/* */ if (ok$1) { $s = 27; continue; }
|
|
/* */ $s = 28; continue;
|
|
/* if (ok$1) { */ case 27:
|
|
$r = stream$1.fin(); /* */ $s = 29; case 29: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
stream$1.notifyReadEvent();
|
|
/* } */ case 28:
|
|
$r = s.streamLock.Unlock(); /* */ $s = 30; case 30: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 20; continue;
|
|
/* } else if (_1 === (2)) { */ case 17:
|
|
/* */ if (new rawHeader($clone(hdr, rawHeader)).Length() > 0) { $s = 31; continue; }
|
|
/* */ $s = 32; continue;
|
|
/* if (new rawHeader($clone(hdr, rawHeader)).Length() > 0) { */ case 31:
|
|
_r$3 = defaultAllocator.Get(((new rawHeader($clone(hdr, rawHeader)).Length() >> 0))); /* */ $s = 33; case 33: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
newbuf = _r$3;
|
|
_r$4 = io.ReadFull(s.conn, newbuf); /* */ $s = 34; case 34: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$4;
|
|
written = _tuple$3[0];
|
|
err$1 = _tuple$3[1];
|
|
/* */ if ($interfaceIsEqual(err$1, $ifaceNil)) { $s = 35; continue; }
|
|
/* */ $s = 36; continue;
|
|
/* if ($interfaceIsEqual(err$1, $ifaceNil)) { */ case 35:
|
|
$r = s.streamLock.Lock(); /* */ $s = 38; case 38: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_tuple$4 = (_entry$2 = s.streams[$Uint32.keyFor(sid)], _entry$2 !== undefined ? [_entry$2.v, true] : [ptrType$3.nil, false]);
|
|
stream$2 = _tuple$4[0];
|
|
ok$2 = _tuple$4[1];
|
|
/* */ if (ok$2) { $s = 39; continue; }
|
|
/* */ $s = 40; continue;
|
|
/* if (ok$2) { */ case 39:
|
|
_r$5 = stream$2.pushBytes(newbuf); /* */ $s = 41; case 41: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_r$5;
|
|
atomic.AddInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s))), -((written >> 0)));
|
|
stream$2.notifyReadEvent();
|
|
/* } */ case 40:
|
|
$r = s.streamLock.Unlock(); /* */ $s = 42; case 42: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 37; continue;
|
|
/* } else { */ case 36:
|
|
$r = s.notifyReadError(err$1); /* */ $s = 43; case 43: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 37:
|
|
/* } */ case 32:
|
|
$s = 20; continue;
|
|
/* } else if (_1 === (4)) { */ case 18:
|
|
_r$6 = io.ReadFull(s.conn, new sliceType$1(updHdr)); /* */ $s = 44; case 44: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_tuple$5 = _r$6;
|
|
err$2 = _tuple$5[1];
|
|
/* */ if ($interfaceIsEqual(err$2, $ifaceNil)) { $s = 45; continue; }
|
|
/* */ $s = 46; continue;
|
|
/* if ($interfaceIsEqual(err$2, $ifaceNil)) { */ case 45:
|
|
$r = s.streamLock.Lock(); /* */ $s = 48; case 48: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_tuple$6 = (_entry$3 = s.streams[$Uint32.keyFor(sid)], _entry$3 !== undefined ? [_entry$3.v, true] : [ptrType$3.nil, false]);
|
|
stream$3 = _tuple$6[0];
|
|
ok$3 = _tuple$6[1];
|
|
if (ok$3) {
|
|
stream$3.update(new updHeader($clone(updHdr, updHeader)).Consumed(), new updHeader($clone(updHdr, updHeader)).Window());
|
|
}
|
|
$r = s.streamLock.Unlock(); /* */ $s = 49; case 49: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 47; continue;
|
|
/* } else { */ case 46:
|
|
$r = s.notifyReadError(err$2); /* */ $s = 50; case 50: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 47:
|
|
$s = 20; continue;
|
|
/* } else { */ case 19:
|
|
$r = s.notifyProtoError($pkg.ErrInvalidProtocol); /* */ $s = 51; case 51: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 20:
|
|
case 13:
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
$r = s.notifyReadError(err); /* */ $s = 52; case 52: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 9:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.recvLoop }; } $f._1 = _1; $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._entry$3 = _entry$3; $f._key = _key; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._selection = _selection; $f._selection$1 = _selection$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.hdr = hdr; $f.newbuf = newbuf; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.ok$3 = ok$3; $f.s = s; $f.sid = sid; $f.stream = stream; $f.stream$1 = stream$1; $f.stream$2 = stream$2; $f.stream$3 = stream$3; $f.updHdr = updHdr; $f.written = written; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.recvLoop = function() { return this.$val.recvLoop(); };
|
|
Session.ptr.prototype.keepalive = function() {
|
|
var _r, _r$1, _r$2, _selection, s, tickerPing, tickerTimeout, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _selection = $f._selection; s = $f.s; tickerPing = $f.tickerPing; tickerTimeout = $f.tickerTimeout; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
tickerPing = time.NewTicker(s.config.KeepAliveInterval);
|
|
tickerTimeout = time.NewTicker(s.config.KeepAliveTimeout);
|
|
$deferred.push([$methodVal(tickerPing, "Stop"), []]);
|
|
$deferred.push([$methodVal(tickerTimeout, "Stop"), []]);
|
|
/* while (true) { */ case 1:
|
|
_r = $select([[tickerPing.C], [tickerTimeout.C], [s.die]]); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
/* */ if (_selection[0] === 0) { $s = 4; continue; }
|
|
/* */ if (_selection[0] === 1) { $s = 5; continue; }
|
|
/* */ if (_selection[0] === 2) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (_selection[0] === 0) { */ case 4:
|
|
_r$1 = s.writeFrameInternal($clone(newFrame(((s.config.Version << 24 >>> 24)), 3, 0), Frame), tickerPing.C, new $Uint64(0, 0)); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
s.notifyBucket();
|
|
$s = 7; continue;
|
|
/* } else if (_selection[0] === 1) { */ case 5:
|
|
/* */ if (!atomic.CompareAndSwapInt32((s.$ptr_dataReady || (s.$ptr_dataReady = new ptrType$4(function() { return this.$target.dataReady; }, function($v) { this.$target.dataReady = $v; }, s))), 1, 0)) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!atomic.CompareAndSwapInt32((s.$ptr_dataReady || (s.$ptr_dataReady = new ptrType$4(function() { return this.$target.dataReady; }, function($v) { this.$target.dataReady = $v; }, s))), 1, 0)) { */ case 9:
|
|
/* */ if (atomic.LoadInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s)))) > 0) { $s = 11; continue; }
|
|
/* */ $s = 12; continue;
|
|
/* if (atomic.LoadInt32((s.$ptr_bucket || (s.$ptr_bucket = new ptrType$4(function() { return this.$target.bucket; }, function($v) { this.$target.bucket = $v; }, s)))) > 0) { */ case 11:
|
|
_r$2 = s.Close(); /* */ $s = 13; case 13: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_r$2;
|
|
$s = -1; return;
|
|
/* } */ case 12:
|
|
/* } */ case 10:
|
|
$s = 7; continue;
|
|
/* } else if (_selection[0] === 2) { */ case 6:
|
|
$s = -1; return;
|
|
/* } */ case 7:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Session.ptr.prototype.keepalive }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._selection = _selection; $f.s = s; $f.tickerPing = tickerPing; $f.tickerTimeout = tickerTimeout; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Session.prototype.keepalive = function() { return this.$val.keepalive(); };
|
|
Session.ptr.prototype.shaperLoop = function() {
|
|
var _r, _r$1, _selection, chWrite, next, r, reqs, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _selection = $f._selection; chWrite = $f.chWrite; next = $f.next; r = $f.r; reqs = $f.reqs; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
reqs = [reqs];
|
|
s = this;
|
|
reqs[0] = shaperHeap.nil;
|
|
next = new writeRequest.ptr(new $Uint64(0, 0), new Frame.ptr(0, 0, 0, sliceType$1.nil), $chanNil);
|
|
chWrite = $chanNil;
|
|
/* while (true) { */ case 1:
|
|
/* */ if (reqs[0].$length > 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (reqs[0].$length > 0) { */ case 3:
|
|
chWrite = s.writes;
|
|
_r = heap.Pop((reqs.$ptr || (reqs.$ptr = new ptrType$5(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, reqs)))); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
writeRequest.copy(next, $assertType(_r, writeRequest));
|
|
$s = 5; continue;
|
|
/* } else { */ case 4:
|
|
chWrite = $chanNil;
|
|
/* } */ case 5:
|
|
_r$1 = $select([[s.die], [s.shaper], [chWrite, $clone(next, writeRequest)]]); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_selection = _r$1;
|
|
/* */ if (_selection[0] === 0) { $s = 8; continue; }
|
|
/* */ if (_selection[0] === 1) { $s = 9; continue; }
|
|
/* */ if (_selection[0] === 2) { $s = 10; continue; }
|
|
/* */ $s = 11; continue;
|
|
/* if (_selection[0] === 0) { */ case 8:
|
|
$s = -1; return;
|
|
/* } else if (_selection[0] === 1) { */ case 9:
|
|
r = $clone(_selection[1][0], writeRequest);
|
|
/* */ if (!(chWrite === $chanNil)) { $s = 12; continue; }
|
|
/* */ $s = 13; continue;
|
|
/* if (!(chWrite === $chanNil)) { */ case 12:
|
|
$r = heap.Push((reqs.$ptr || (reqs.$ptr = new ptrType$5(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, reqs))), new next.constructor.elem(next)); /* */ $s = 14; case 14: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 13:
|
|
$r = heap.Push((reqs.$ptr || (reqs.$ptr = new ptrType$5(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, reqs))), new r.constructor.elem(r)); /* */ $s = 15; case 15: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = 11; continue;
|
|
/* } else if (_selection[0] === 2) { */ case 10:
|
|
/* } */ case 11:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.shaperLoop }; } $f._r = _r; $f._r$1 = _r$1; $f._selection = _selection; $f.chWrite = chWrite; $f.next = next; $f.r = r; $f.reqs = reqs; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.shaperLoop = function() { return this.$val.shaperLoop(); };
|
|
Session.ptr.prototype.sendLoop = function() {
|
|
var _r, _r$1, _r$2, _selection, _tuple, _tuple$1, _tuple$2, buf, bw, err, n, ok, request, result, s, vec, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _selection = $f._selection; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; buf = $f.buf; bw = $f.bw; err = $f.err; n = $f.n; ok = $f.ok; request = $f.request; result = $f.result; s = $f.s; vec = $f.vec; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
buf = sliceType$1.nil;
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
vec = sliceType$3.nil;
|
|
_tuple = $assertType(s.conn, buffersWriter, true);
|
|
bw = _tuple[0];
|
|
ok = _tuple[1];
|
|
if (ok) {
|
|
buf = $makeSlice(sliceType$1, 8);
|
|
vec = $makeSlice(sliceType$3, 2);
|
|
} else {
|
|
buf = $makeSlice(sliceType$1, 65544);
|
|
}
|
|
/* while (true) { */ case 1:
|
|
_r = $select([[s.die], [s.writes]]); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
/* */ if (_selection[0] === 0) { $s = 4; continue; }
|
|
/* */ if (_selection[0] === 1) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_selection[0] === 0) { */ case 4:
|
|
$s = -1; return;
|
|
/* } else if (_selection[0] === 1) { */ case 5:
|
|
request = $clone(_selection[1][0], writeRequest);
|
|
(0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0] = request.frame.ver);
|
|
(1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1] = request.frame.cmd);
|
|
$clone(binary.LittleEndian, binary.littleEndian).PutUint16($subslice(buf, 2), ((request.frame.data.$length << 16 >>> 16)));
|
|
$clone(binary.LittleEndian, binary.littleEndian).PutUint32($subslice(buf, 4), request.frame.sid);
|
|
/* */ if (vec.$length > 0) { $s = 7; continue; }
|
|
/* */ $s = 8; continue;
|
|
/* if (vec.$length > 0) { */ case 7:
|
|
(0 >= vec.$length ? ($throwRuntimeError("index out of range"), undefined) : vec.$array[vec.$offset + 0] = $subslice(buf, 0, 8));
|
|
(1 >= vec.$length ? ($throwRuntimeError("index out of range"), undefined) : vec.$array[vec.$offset + 1] = request.frame.data);
|
|
_r$1 = bw.WriteBuffers(vec); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
n = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
$s = 9; continue;
|
|
/* } else { */ case 8:
|
|
$copySlice($subslice(buf, 8), request.frame.data);
|
|
_r$2 = s.conn.Write($subslice(buf, 0, (8 + request.frame.data.$length >> 0))); /* */ $s = 11; case 11: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$2;
|
|
n = _tuple$2[0];
|
|
err = _tuple$2[1];
|
|
/* } */ case 9:
|
|
n = n - (8) >> 0;
|
|
if (n < 0) {
|
|
n = 0;
|
|
}
|
|
result = new writeResult.ptr(n, err);
|
|
$r = $send(request.result, $clone($clone(result, writeResult), writeResult)); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$close(request.result);
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 13; continue; }
|
|
/* */ $s = 14; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 13:
|
|
$r = s.notifyWriteError(err); /* */ $s = 15; case 15: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* } */ case 14:
|
|
/* } */ case 6:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.sendLoop }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._selection = _selection; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.buf = buf; $f.bw = bw; $f.err = err; $f.n = n; $f.ok = ok; $f.request = request; $f.result = result; $f.s = s; $f.vec = vec; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.sendLoop = function() { return this.$val.sendLoop(); };
|
|
Session.ptr.prototype.writeFrame = function(f) {
|
|
var _r, _tuple, err, f, n, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; f = $f.f; n = $f.n; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
_r = s.writeFrameInternal($clone(f, Frame), $chanNil, new $Uint64(0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.writeFrame }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.n = n; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.writeFrame = function(f) { return this.$val.writeFrame(f); };
|
|
Session.ptr.prototype.writeFrameInternal = function(f, deadline, prio) {
|
|
var _r, _r$1, _selection, _selection$1, deadline, f, prio, req, result, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _selection = $f._selection; _selection$1 = $f._selection$1; deadline = $f.deadline; f = $f.f; prio = $f.prio; req = $f.req; result = $f.result; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
req = new writeRequest.ptr(prio, $clone(f, Frame), new $Chan(writeResult, 1));
|
|
_r = $select([[s.shaper, $clone(req, writeRequest)], [s.die], [s.chSocketWriteError], [deadline]]); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
/* */ if (_selection[0] === 0) { $s = 2; continue; }
|
|
/* */ if (_selection[0] === 1) { $s = 3; continue; }
|
|
/* */ if (_selection[0] === 2) { $s = 4; continue; }
|
|
/* */ if (_selection[0] === 3) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (_selection[0] === 0) { */ case 2:
|
|
$s = 6; continue;
|
|
/* } else if (_selection[0] === 1) { */ case 3:
|
|
$s = -1; return [0, io.ErrClosedPipe];
|
|
/* } else if (_selection[0] === 2) { */ case 4:
|
|
$s = -1; return [0, $assertType(s.socketWriteError.Load(), $error)];
|
|
/* } else if (_selection[0] === 3) { */ case 5:
|
|
$s = -1; return [0, $pkg.ErrTimeout];
|
|
/* } */ case 6:
|
|
_r$1 = $select([[req.result], [s.die], [s.chSocketWriteError], [deadline]]); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_selection$1 = _r$1;
|
|
if (_selection$1[0] === 0) {
|
|
result = $clone(_selection$1[1][0], writeResult);
|
|
$s = -1; return [result.n, result.err];
|
|
} else if (_selection$1[0] === 1) {
|
|
$s = -1; return [0, io.ErrClosedPipe];
|
|
} else if (_selection$1[0] === 2) {
|
|
$s = -1; return [0, $assertType(s.socketWriteError.Load(), $error)];
|
|
} else if (_selection$1[0] === 3) {
|
|
$s = -1; return [0, $pkg.ErrTimeout];
|
|
}
|
|
$s = -1; return [0, $ifaceNil];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Session.ptr.prototype.writeFrameInternal }; } $f._r = _r; $f._r$1 = _r$1; $f._selection = _selection; $f._selection$1 = _selection$1; $f.deadline = deadline; $f.f = f; $f.prio = prio; $f.req = req; $f.result = result; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Session.prototype.writeFrameInternal = function(f, deadline, prio) { return this.$val.writeFrameInternal(f, deadline, prio); };
|
|
shaperHeap.prototype.Len = function() {
|
|
var h;
|
|
h = this;
|
|
return h.$length;
|
|
};
|
|
$ptrType(shaperHeap).prototype.Len = function() { return this.$get().Len(); };
|
|
shaperHeap.prototype.Less = function(i, j) {
|
|
var h, i, j, x, x$1;
|
|
h = this;
|
|
return (x = ((i < 0 || i >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + i]).prio, x$1 = ((j < 0 || j >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + j]).prio, (x.$high < x$1.$high || (x.$high === x$1.$high && x.$low < x$1.$low)));
|
|
};
|
|
$ptrType(shaperHeap).prototype.Less = function(i, j) { return this.$get().Less(i, j); };
|
|
shaperHeap.prototype.Swap = function(i, j) {
|
|
var _tmp, _tmp$1, h, i, j;
|
|
h = this;
|
|
_tmp = $clone(((j < 0 || j >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + j]), writeRequest);
|
|
_tmp$1 = $clone(((i < 0 || i >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + i]), writeRequest);
|
|
writeRequest.copy(((i < 0 || i >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + i]), _tmp);
|
|
writeRequest.copy(((j < 0 || j >= h.$length) ? ($throwRuntimeError("index out of range"), undefined) : h.$array[h.$offset + j]), _tmp$1);
|
|
};
|
|
$ptrType(shaperHeap).prototype.Swap = function(i, j) { return this.$get().Swap(i, j); };
|
|
$ptrType(shaperHeap).prototype.Push = function(x) {
|
|
var h, x;
|
|
h = this;
|
|
h.$set($append(h.$get(), $assertType(x, writeRequest)));
|
|
};
|
|
$ptrType(shaperHeap).prototype.Pop = function() {
|
|
var h, n, old, x, x$1;
|
|
h = this;
|
|
old = h.$get();
|
|
n = old.$length;
|
|
x$1 = $clone((x = n - 1 >> 0, ((x < 0 || x >= old.$length) ? ($throwRuntimeError("index out of range"), undefined) : old.$array[old.$offset + x])), writeRequest);
|
|
h.$set($subslice(old, 0, (n - 1 >> 0)));
|
|
return new x$1.constructor.elem(x$1);
|
|
};
|
|
newStream = function(id, frameSize, sess) {
|
|
var frameSize, id, s, sess;
|
|
s = new Stream.ptr(0, ptrType$2.nil, sliceType$3.nil, sliceType$3.nil, new sync.Mutex.ptr(0, 0), 0, $chanNil, $chanNil, new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), $chanNil, new sync.Once.ptr(new sync.Mutex.ptr(0, 0), 0), new atomic.Value.ptr($ifaceNil), new atomic.Value.ptr($ifaceNil), 0, 0, 0, 0, 0, $chanNil);
|
|
s.id = id;
|
|
s.chReadEvent = new $Chan(structType, 1);
|
|
s.chUpdate = new $Chan(structType, 1);
|
|
s.frameSize = frameSize;
|
|
s.sess = sess;
|
|
s.die = new $Chan(structType, 0);
|
|
s.chFinEvent = new $Chan(structType, 0);
|
|
s.peerWindow = 262144;
|
|
return s;
|
|
};
|
|
Stream.ptr.prototype.ID = function() {
|
|
var s;
|
|
s = this;
|
|
return s.id;
|
|
};
|
|
Stream.prototype.ID = function() { return this.$val.ID(); };
|
|
Stream.ptr.prototype.Read = function(b) {
|
|
var _r, _r$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, err, ew, n, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; err = $f.err; ew = $f.ew; n = $f.n; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
/* while (true) { */ case 1:
|
|
_r = s.tryRead(b); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
/* */ if ($interfaceIsEqual(err, $pkg.ErrWouldBlock)) { $s = 4; continue; }
|
|
/* */ $s = 5; continue;
|
|
/* if ($interfaceIsEqual(err, $pkg.ErrWouldBlock)) { */ case 4:
|
|
_r$1 = s.waitRead(); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
ew = _r$1;
|
|
if (!($interfaceIsEqual(ew, $ifaceNil))) {
|
|
_tmp = 0;
|
|
_tmp$1 = ew;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
$s = 6; continue;
|
|
/* } else { */ case 5:
|
|
_tmp$2 = n;
|
|
_tmp$3 = err;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
/* } */ case 6:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.Read }; } $f._r = _r; $f._r$1 = _r$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.ew = ew; $f.n = n; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.Read = function(b) { return this.$val.Read(b); };
|
|
Stream.ptr.prototype.tryRead = function(b) {
|
|
var _r, _selection, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, b, err, n, s, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _selection = $f._selection; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tuple = $f._tuple; b = $f.b; err = $f.err; n = $f.n; s = $f.s; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
/* */ if (s.sess.config.Version === 2) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (s.sess.config.Version === 2) { */ case 1:
|
|
_r = s.tryReadv2(b); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* } */ case 2:
|
|
if (b.$length === 0) {
|
|
_tmp = 0;
|
|
_tmp$1 = $ifaceNil;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
$r = s.bufferLock.Lock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (s.buffers.$length > 0) {
|
|
n = $copySlice(b, (x = s.buffers, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])));
|
|
(x$2 = s.buffers, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0] = $subslice((x$1 = s.buffers, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])), n)));
|
|
if ((x$3 = s.buffers, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).$length === 0) {
|
|
(x$4 = s.buffers, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0] = sliceType$1.nil));
|
|
s.buffers = $subslice(s.buffers, 1);
|
|
defaultAllocator.Put((x$5 = s.heads, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0])));
|
|
s.heads = $subslice(s.heads, 1);
|
|
}
|
|
}
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (n > 0) {
|
|
s.sess.returnTokens(n);
|
|
_tmp$2 = n;
|
|
_tmp$3 = $ifaceNil;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
_selection = $select([[s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
_tmp$4 = 0;
|
|
_tmp$5 = io.EOF;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection[0] === 1) {
|
|
_tmp$6 = 0;
|
|
_tmp$7 = $pkg.ErrWouldBlock;
|
|
n = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [n, err];
|
|
}
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.tryRead }; } $f._r = _r; $f._selection = _selection; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.n = n; $f.s = s; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.tryRead = function(b) { return this.$val.tryRead(b); };
|
|
Stream.ptr.prototype.tryReadv2 = function(b) {
|
|
var _q, _r, _selection, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, b, err, err$1, n, notifyConsumed, s, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _selection = $f._selection; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; b = $f.b; err = $f.err; err$1 = $f.err$1; n = $f.n; notifyConsumed = $f.notifyConsumed; s = $f.s; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
if (b.$length === 0) {
|
|
_tmp = 0;
|
|
_tmp$1 = $ifaceNil;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
notifyConsumed = 0;
|
|
$r = s.bufferLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (s.buffers.$length > 0) {
|
|
n = $copySlice(b, (x = s.buffers, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])));
|
|
(x$2 = s.buffers, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0] = $subslice((x$1 = s.buffers, (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])), n)));
|
|
if ((x$3 = s.buffers, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).$length === 0) {
|
|
(x$4 = s.buffers, (0 >= x$4.$length ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + 0] = sliceType$1.nil));
|
|
s.buffers = $subslice(s.buffers, 1);
|
|
defaultAllocator.Put((x$5 = s.heads, (0 >= x$5.$length ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + 0])));
|
|
s.heads = $subslice(s.heads, 1);
|
|
}
|
|
}
|
|
s.numRead = s.numRead + (((n >>> 0))) >>> 0;
|
|
s.incr = s.incr + (((n >>> 0))) >>> 0;
|
|
if (s.incr >= (((_q = s.sess.config.MaxStreamBuffer / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >>> 0)) || (s.numRead === ((n >>> 0)))) {
|
|
notifyConsumed = s.numRead;
|
|
s.incr = 0;
|
|
}
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (n > 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (n > 0) { */ case 3:
|
|
s.sess.returnTokens(n);
|
|
/* */ if (notifyConsumed > 0) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (notifyConsumed > 0) { */ case 5:
|
|
_r = s.sendWindowUpdate(notifyConsumed); /* */ $s = 8; case 8: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
err$1 = _r;
|
|
_tmp$2 = n;
|
|
_tmp$3 = err$1;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
/* } else { */ case 6:
|
|
_tmp$4 = n;
|
|
_tmp$5 = $ifaceNil;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
/* } */ case 7:
|
|
/* } */ case 4:
|
|
_selection = $select([[s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
_tmp$6 = 0;
|
|
_tmp$7 = io.EOF;
|
|
n = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection[0] === 1) {
|
|
_tmp$8 = 0;
|
|
_tmp$9 = $pkg.ErrWouldBlock;
|
|
n = _tmp$8;
|
|
err = _tmp$9;
|
|
$s = -1; return [n, err];
|
|
}
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.tryReadv2 }; } $f._q = _q; $f._r = _r; $f._selection = _selection; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f.b = b; $f.err = err; $f.err$1 = err$1; $f.n = n; $f.notifyConsumed = notifyConsumed; $f.s = s; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.tryReadv2 = function(b) { return this.$val.tryReadv2(b); };
|
|
Stream.ptr.prototype.WriteTo = function(w) {
|
|
var _r, _r$1, _r$2, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, _tuple$1, buf, err, ew, ew$1, n, nw, s, w, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; buf = $f.buf; err = $f.err; ew = $f.ew; ew$1 = $f.ew$1; n = $f.n; nw = $f.nw; s = $f.s; w = $f.w; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
s = this;
|
|
/* */ if (s.sess.config.Version === 2) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (s.sess.config.Version === 2) { */ case 1:
|
|
_r = s.writeTov2(w); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* } */ case 2:
|
|
/* while (true) { */ case 4:
|
|
buf = sliceType$1.nil;
|
|
$r = s.bufferLock.Lock(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (s.buffers.$length > 0) {
|
|
buf = (x = s.buffers, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
s.buffers = $subslice(s.buffers, 1);
|
|
s.heads = $subslice(s.heads, 1);
|
|
}
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (!(buf === sliceType$1.nil)) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (!(buf === sliceType$1.nil)) { */ case 8:
|
|
_r$1 = w.Write(buf); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
nw = _tuple$1[0];
|
|
ew = _tuple$1[1];
|
|
s.sess.returnTokens(buf.$length);
|
|
defaultAllocator.Put(buf);
|
|
if (nw > 0) {
|
|
n = (x$1 = (new $Int64(0, nw)), new $Int64(n.$high + x$1.$high, n.$low + x$1.$low));
|
|
}
|
|
if (!($interfaceIsEqual(ew, $ifaceNil))) {
|
|
_tmp = n;
|
|
_tmp$1 = ew;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
$s = 10; continue;
|
|
/* } else { */ case 9:
|
|
_r$2 = s.waitRead(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
ew$1 = _r$2;
|
|
if (!($interfaceIsEqual(ew$1, $ifaceNil))) {
|
|
_tmp$2 = n;
|
|
_tmp$3 = ew$1;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ case 10:
|
|
/* } */ $s = 4; continue; case 5:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.WriteTo }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.buf = buf; $f.err = err; $f.ew = ew; $f.ew$1 = ew$1; $f.n = n; $f.nw = nw; $f.s = s; $f.w = w; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.WriteTo = function(w) { return this.$val.WriteTo(w); };
|
|
Stream.ptr.prototype.writeTov2 = function(w) {
|
|
var _q, _r, _r$1, _r$2, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, buf, err, err$1, ew, ew$1, n, notifyConsumed, nw, s, w, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; buf = $f.buf; err = $f.err; err$1 = $f.err$1; ew = $f.ew; ew$1 = $f.ew$1; n = $f.n; notifyConsumed = $f.notifyConsumed; nw = $f.nw; s = $f.s; w = $f.w; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = new $Int64(0, 0);
|
|
err = $ifaceNil;
|
|
s = this;
|
|
/* while (true) { */ case 1:
|
|
notifyConsumed = 0;
|
|
buf = sliceType$1.nil;
|
|
$r = s.bufferLock.Lock(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
if (s.buffers.$length > 0) {
|
|
buf = (x = s.buffers, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
|
|
s.buffers = $subslice(s.buffers, 1);
|
|
s.heads = $subslice(s.heads, 1);
|
|
}
|
|
s.numRead = s.numRead + (((buf.$length >>> 0))) >>> 0;
|
|
s.incr = s.incr + (((buf.$length >>> 0))) >>> 0;
|
|
if (s.incr >= (((_q = s.sess.config.MaxStreamBuffer / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >>> 0)) || (s.numRead === ((buf.$length >>> 0)))) {
|
|
notifyConsumed = s.numRead;
|
|
s.incr = 0;
|
|
}
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (!(buf === sliceType$1.nil)) { $s = 5; continue; }
|
|
/* */ $s = 6; continue;
|
|
/* if (!(buf === sliceType$1.nil)) { */ case 5:
|
|
_r = w.Write(buf); /* */ $s = 8; case 8: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
nw = _tuple[0];
|
|
ew = _tuple[1];
|
|
s.sess.returnTokens(buf.$length);
|
|
defaultAllocator.Put(buf);
|
|
if (nw > 0) {
|
|
n = (x$1 = (new $Int64(0, nw)), new $Int64(n.$high + x$1.$high, n.$low + x$1.$low));
|
|
}
|
|
if (!($interfaceIsEqual(ew, $ifaceNil))) {
|
|
_tmp = n;
|
|
_tmp$1 = ew;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* */ if (notifyConsumed > 0) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (notifyConsumed > 0) { */ case 9:
|
|
_r$1 = s.sendWindowUpdate(notifyConsumed); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
err$1 = _r$1;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp$2 = n;
|
|
_tmp$3 = err$1;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ case 10:
|
|
$s = 7; continue;
|
|
/* } else { */ case 6:
|
|
_r$2 = s.waitRead(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
ew$1 = _r$2;
|
|
if (!($interfaceIsEqual(ew$1, $ifaceNil))) {
|
|
_tmp$4 = n;
|
|
_tmp$5 = ew$1;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ case 7:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.writeTov2 }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.err$1 = err$1; $f.ew = ew; $f.ew$1 = ew$1; $f.n = n; $f.notifyConsumed = notifyConsumed; $f.nw = nw; $f.s = s; $f.w = w; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.writeTov2 = function(w) { return this.$val.writeTov2(w); };
|
|
Stream.ptr.prototype.sendWindowUpdate = function(consumed) {
|
|
var _r, _tuple, _tuple$1, consumed, d, deadline, err, frame, hdr, ok, s, timer, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; consumed = $f.consumed; d = $f.d; deadline = $f.deadline; err = $f.err; frame = $f.frame; hdr = $f.hdr; ok = $f.ok; s = $f.s; timer = $f.timer; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
timer = ptrType$6.nil;
|
|
deadline = $chanNil;
|
|
_tuple = $assertType(s.readDeadline.Load(), time.Time, true);
|
|
d = $clone(_tuple[0], time.Time);
|
|
ok = _tuple[1];
|
|
if (ok && !$clone(d, time.Time).IsZero()) {
|
|
timer = time.NewTimer(time.Until($clone(d, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadline = timer.C;
|
|
}
|
|
frame = $clone(newFrame(((s.sess.config.Version << 24 >>> 24)), 4, s.id), Frame);
|
|
hdr = arrayType.zero();
|
|
$clone(binary.LittleEndian, binary.littleEndian).PutUint32(new sliceType$1(hdr), consumed);
|
|
$clone(binary.LittleEndian, binary.littleEndian).PutUint32($subslice(new sliceType$1(hdr), 4), ((s.sess.config.MaxStreamBuffer >>> 0)));
|
|
frame.data = new sliceType$1(hdr);
|
|
_r = s.sess.writeFrameInternal($clone(frame, Frame), deadline, new $Uint64(0, 0)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
err = _tuple$1[1];
|
|
$s = -1; return err;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.sendWindowUpdate }; } $f._r = _r; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.consumed = consumed; $f.d = d; $f.deadline = deadline; $f.err = err; $f.frame = frame; $f.hdr = hdr; $f.ok = ok; $f.s = s; $f.timer = timer; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Stream.prototype.sendWindowUpdate = function(consumed) { return this.$val.sendWindowUpdate(consumed); };
|
|
Stream.ptr.prototype.waitRead = function() {
|
|
var _r, _selection, _tuple, d, deadline, ok, s, timer, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _selection = $f._selection; _tuple = $f._tuple; d = $f.d; deadline = $f.deadline; ok = $f.ok; s = $f.s; timer = $f.timer; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
s = this;
|
|
timer = ptrType$6.nil;
|
|
deadline = $chanNil;
|
|
_tuple = $assertType(s.readDeadline.Load(), time.Time, true);
|
|
d = $clone(_tuple[0], time.Time);
|
|
ok = _tuple[1];
|
|
if (ok && !$clone(d, time.Time).IsZero()) {
|
|
timer = time.NewTimer(time.Until($clone(d, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadline = timer.C;
|
|
}
|
|
_r = $select([[s.chReadEvent], [s.chFinEvent], [s.sess.chSocketReadError], [s.sess.chProtoError], [deadline], [s.die]]); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_selection = _r;
|
|
if (_selection[0] === 0) {
|
|
$s = -1; return $ifaceNil;
|
|
} else if (_selection[0] === 1) {
|
|
$s = -1; return io.EOF;
|
|
} else if (_selection[0] === 2) {
|
|
$s = -1; return $assertType(s.sess.socketReadError.Load(), $error);
|
|
} else if (_selection[0] === 3) {
|
|
$s = -1; return $assertType(s.sess.protoError.Load(), $error);
|
|
} else if (_selection[0] === 4) {
|
|
$s = -1; return $pkg.ErrTimeout;
|
|
} else if (_selection[0] === 5) {
|
|
$s = -1; return io.ErrClosedPipe;
|
|
}
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.waitRead }; } $f._r = _r; $f._selection = _selection; $f._tuple = _tuple; $f.d = d; $f.deadline = deadline; $f.ok = ok; $f.s = s; $f.timer = timer; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Stream.prototype.waitRead = function() { return this.$val.waitRead(); };
|
|
Stream.ptr.prototype.Write = function(b) {
|
|
var _r, _r$1, _selection, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, _tuple$2, b, bts, d, deadline, err, err$1, frame, n, n$1, ok, s, sent, sz, timer, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _selection = $f._selection; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; b = $f.b; bts = $f.bts; d = $f.d; deadline = $f.deadline; err = $f.err; err$1 = $f.err$1; frame = $f.frame; n = $f.n; n$1 = $f.n$1; ok = $f.ok; s = $f.s; sent = $f.sent; sz = $f.sz; timer = $f.timer; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
/* */ if (s.sess.config.Version === 2) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (s.sess.config.Version === 2) { */ case 1:
|
|
_r = s.writeV2(b); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
n = _tuple[0];
|
|
err = _tuple[1];
|
|
$s = -1; return [n, err];
|
|
/* } */ case 2:
|
|
deadline = $chanNil;
|
|
_tuple$1 = $assertType(s.writeDeadline.Load(), time.Time, true);
|
|
d = $clone(_tuple$1[0], time.Time);
|
|
ok = _tuple$1[1];
|
|
if (ok && !$clone(d, time.Time).IsZero()) {
|
|
timer = time.NewTimer(time.Until($clone(d, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadline = timer.C;
|
|
}
|
|
_selection = $select([[s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
_tmp = 0;
|
|
_tmp$1 = io.ErrClosedPipe;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
sent = 0;
|
|
frame = $clone(newFrame(((s.sess.config.Version << 24 >>> 24)), 2, s.id), Frame);
|
|
bts = b;
|
|
/* while (true) { */ case 4:
|
|
/* if (!(bts.$length > 0)) { break; } */ if(!(bts.$length > 0)) { $s = 5; continue; }
|
|
sz = bts.$length;
|
|
if (sz > s.frameSize) {
|
|
sz = s.frameSize;
|
|
}
|
|
frame.data = $subslice(bts, 0, sz);
|
|
bts = $subslice(bts, sz);
|
|
_r$1 = s.sess.writeFrameInternal($clone(frame, Frame), deadline, (new $Uint64(0, s.numWritten))); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$1;
|
|
n$1 = _tuple$2[0];
|
|
err$1 = _tuple$2[1];
|
|
s.numWritten = s.numWritten + (1) >>> 0;
|
|
sent = sent + (n$1) >> 0;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp$2 = sent;
|
|
_tmp$3 = err$1;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ $s = 4; continue; case 5:
|
|
_tmp$4 = sent;
|
|
_tmp$5 = $ifaceNil;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [n, err]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.Write }; } $f._r = _r; $f._r$1 = _r$1; $f._selection = _selection; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.b = b; $f.bts = bts; $f.d = d; $f.deadline = deadline; $f.err = err; $f.err$1 = err$1; $f.frame = frame; $f.n = n; $f.n$1 = n$1; $f.ok = ok; $f.s = s; $f.sent = sent; $f.sz = sz; $f.timer = timer; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Stream.prototype.Write = function(b) { return this.$val.Write(b); };
|
|
Stream.ptr.prototype.writeV2 = function(b) {
|
|
var _r, _r$1, _selection, _selection$1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, b, bts, d, deadline, err, err$1, frame, inflight, n, n$1, ok, s, sent, sz, timer, win, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _selection = $f._selection; _selection$1 = $f._selection$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$16 = $f._tmp$16; _tmp$17 = $f._tmp$17; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; b = $f.b; bts = $f.bts; d = $f.d; deadline = $f.deadline; err = $f.err; err$1 = $f.err$1; frame = $f.frame; inflight = $f.inflight; n = $f.n; n$1 = $f.n$1; ok = $f.ok; s = $f.s; sent = $f.sent; sz = $f.sz; timer = $f.timer; win = $f.win; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
n = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
if (b.$length === 0) {
|
|
_tmp = 0;
|
|
_tmp$1 = $ifaceNil;
|
|
n = _tmp;
|
|
err = _tmp$1;
|
|
$s = -1; return [n, err];
|
|
}
|
|
_selection = $select([[s.die], []]);
|
|
if (_selection[0] === 0) {
|
|
_tmp$2 = 0;
|
|
_tmp$3 = io.ErrClosedPipe;
|
|
n = _tmp$2;
|
|
err = _tmp$3;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
deadline = $chanNil;
|
|
_tuple = $assertType(s.writeDeadline.Load(), time.Time, true);
|
|
d = $clone(_tuple[0], time.Time);
|
|
ok = _tuple[1];
|
|
if (ok && !$clone(d, time.Time).IsZero()) {
|
|
timer = time.NewTimer(time.Until($clone(d, time.Time)));
|
|
$deferred.push([$methodVal(timer, "Stop"), []]);
|
|
deadline = timer.C;
|
|
}
|
|
sent = 0;
|
|
frame = $clone(newFrame(((s.sess.config.Version << 24 >>> 24)), 2, s.id), Frame);
|
|
/* while (true) { */ case 1:
|
|
bts = sliceType$1.nil;
|
|
inflight = (((atomic.LoadUint32((s.$ptr_numWritten || (s.$ptr_numWritten = new ptrType$7(function() { return this.$target.numWritten; }, function($v) { this.$target.numWritten = $v; }, s)))) - atomic.LoadUint32((s.$ptr_peerConsumed || (s.$ptr_peerConsumed = new ptrType$7(function() { return this.$target.peerConsumed; }, function($v) { this.$target.peerConsumed = $v; }, s)))) >>> 0) >> 0));
|
|
if (inflight < 0) {
|
|
_tmp$4 = 0;
|
|
_tmp$5 = $pkg.ErrConsumed;
|
|
n = _tmp$4;
|
|
err = _tmp$5;
|
|
$s = -1; return [n, err];
|
|
}
|
|
win = ((atomic.LoadUint32((s.$ptr_peerWindow || (s.$ptr_peerWindow = new ptrType$7(function() { return this.$target.peerWindow; }, function($v) { this.$target.peerWindow = $v; }, s)))) >> 0)) - inflight >> 0;
|
|
/* */ if (win > 0) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (win > 0) { */ case 3:
|
|
if (win > ((b.$length >> 0))) {
|
|
bts = b;
|
|
b = sliceType$1.nil;
|
|
} else {
|
|
bts = $subslice(b, 0, win);
|
|
b = $subslice(b, win);
|
|
}
|
|
/* while (true) { */ case 5:
|
|
/* if (!(bts.$length > 0)) { break; } */ if(!(bts.$length > 0)) { $s = 6; continue; }
|
|
sz = bts.$length;
|
|
if (sz > s.frameSize) {
|
|
sz = s.frameSize;
|
|
}
|
|
frame.data = $subslice(bts, 0, sz);
|
|
bts = $subslice(bts, sz);
|
|
_r = s.sess.writeFrameInternal($clone(frame, Frame), deadline, (new $Uint64(0, atomic.LoadUint32((s.$ptr_numWritten || (s.$ptr_numWritten = new ptrType$7(function() { return this.$target.numWritten; }, function($v) { this.$target.numWritten = $v; }, s))))))); /* */ $s = 7; case 7: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
n$1 = _tuple$1[0];
|
|
err$1 = _tuple$1[1];
|
|
atomic.AddUint32((s.$ptr_numWritten || (s.$ptr_numWritten = new ptrType$7(function() { return this.$target.numWritten; }, function($v) { this.$target.numWritten = $v; }, s))), ((sz >>> 0)));
|
|
sent = sent + (n$1) >> 0;
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
_tmp$6 = sent;
|
|
_tmp$7 = err$1;
|
|
n = _tmp$6;
|
|
err = _tmp$7;
|
|
$s = -1; return [n, err];
|
|
}
|
|
/* } */ $s = 5; continue; case 6:
|
|
/* } */ case 4:
|
|
/* */ if (b.$length > 0) { $s = 8; continue; }
|
|
/* */ $s = 9; continue;
|
|
/* if (b.$length > 0) { */ case 8:
|
|
_r$1 = $select([[s.chFinEvent], [s.die], [deadline], [s.sess.chSocketWriteError], [s.chUpdate]]); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_selection$1 = _r$1;
|
|
if (_selection$1[0] === 0) {
|
|
_tmp$8 = 0;
|
|
_tmp$9 = io.EOF;
|
|
n = _tmp$8;
|
|
err = _tmp$9;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection$1[0] === 1) {
|
|
_tmp$10 = sent;
|
|
_tmp$11 = io.ErrClosedPipe;
|
|
n = _tmp$10;
|
|
err = _tmp$11;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection$1[0] === 2) {
|
|
_tmp$12 = sent;
|
|
_tmp$13 = $pkg.ErrTimeout;
|
|
n = _tmp$12;
|
|
err = _tmp$13;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection$1[0] === 3) {
|
|
_tmp$14 = sent;
|
|
_tmp$15 = $assertType(s.sess.socketWriteError.Load(), $error);
|
|
n = _tmp$14;
|
|
err = _tmp$15;
|
|
$s = -1; return [n, err];
|
|
} else if (_selection$1[0] === 4) {
|
|
/* continue; */ $s = 1; continue;
|
|
}
|
|
$s = 10; continue;
|
|
/* } else { */ case 9:
|
|
_tmp$16 = sent;
|
|
_tmp$17 = $ifaceNil;
|
|
n = _tmp$16;
|
|
err = _tmp$17;
|
|
$s = -1; return [n, err];
|
|
/* } */ case 10:
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return [n, err];
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [n, err]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.writeV2 }; } $f._r = _r; $f._r$1 = _r$1; $f._selection = _selection; $f._selection$1 = _selection$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$16 = _tmp$16; $f._tmp$17 = _tmp$17; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.b = b; $f.bts = bts; $f.d = d; $f.deadline = deadline; $f.err = err; $f.err$1 = err$1; $f.frame = frame; $f.inflight = inflight; $f.n = n; $f.n$1 = n$1; $f.ok = ok; $f.s = s; $f.sent = sent; $f.sz = sz; $f.timer = timer; $f.win = win; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Stream.prototype.writeV2 = function(b) { return this.$val.writeV2(b); };
|
|
Stream.ptr.prototype.Close = function() {
|
|
var _r, _tuple, err, once, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; once = $f.once; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
once = [once];
|
|
s = [s];
|
|
s[0] = this;
|
|
once[0] = false;
|
|
err = $ifaceNil;
|
|
$r = s[0].dieOnce.Do((function(once, s) { return function() {
|
|
$close(s[0].die);
|
|
once[0] = true;
|
|
}; })(once, s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if (once[0]) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (once[0]) { */ case 2:
|
|
_r = s[0].sess.writeFrame($clone(newFrame(((s[0].sess.config.Version << 24 >>> 24)), 1, s[0].id), Frame)); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
err = _tuple[1];
|
|
$r = s[0].sess.streamClosed(s[0].id); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return err;
|
|
/* } else { */ case 3:
|
|
$s = -1; return io.ErrClosedPipe;
|
|
/* } */ case 4:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.Close }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.once = once; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.Close = function() { return this.$val.Close(); };
|
|
Stream.ptr.prototype.GetDieCh = function() {
|
|
var s;
|
|
s = this;
|
|
return s.die;
|
|
};
|
|
Stream.prototype.GetDieCh = function() { return this.$val.GetDieCh(); };
|
|
Stream.ptr.prototype.SetReadDeadline = function(t) {
|
|
var s, t;
|
|
s = this;
|
|
s.readDeadline.Store(new t.constructor.elem(t));
|
|
s.notifyReadEvent();
|
|
return $ifaceNil;
|
|
};
|
|
Stream.prototype.SetReadDeadline = function(t) { return this.$val.SetReadDeadline(t); };
|
|
Stream.ptr.prototype.SetWriteDeadline = function(t) {
|
|
var s, t;
|
|
s = this;
|
|
s.writeDeadline.Store(new t.constructor.elem(t));
|
|
return $ifaceNil;
|
|
};
|
|
Stream.prototype.SetWriteDeadline = function(t) { return this.$val.SetWriteDeadline(t); };
|
|
Stream.ptr.prototype.SetDeadline = function(t) {
|
|
var err, err$1, s, t;
|
|
s = this;
|
|
err = s.SetReadDeadline($clone(t, time.Time));
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
return err;
|
|
}
|
|
err$1 = s.SetWriteDeadline($clone(t, time.Time));
|
|
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
|
|
return err$1;
|
|
}
|
|
return $ifaceNil;
|
|
};
|
|
Stream.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
|
|
Stream.ptr.prototype.sessionClose = function() {
|
|
var s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = [s];
|
|
s[0] = this;
|
|
$r = s[0].dieOnce.Do((function(s) { return function() {
|
|
$close(s[0].die);
|
|
}; })(s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.sessionClose }; } $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.sessionClose = function() { return this.$val.sessionClose(); };
|
|
Stream.ptr.prototype.LocalAddr = function() {
|
|
var _r, _tuple, ok, s, ts, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; s = $f.s; ts = $f.ts; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_tuple = $assertType(s.sess.conn, interfaceType, true);
|
|
ts = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = ts.LocalAddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.LocalAddr }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.s = s; $f.ts = ts; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.LocalAddr = function() { return this.$val.LocalAddr(); };
|
|
Stream.ptr.prototype.RemoteAddr = function() {
|
|
var _r, _tuple, ok, s, ts, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; s = $f.s; ts = $f.ts; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = this;
|
|
_tuple = $assertType(s.sess.conn, interfaceType$1, true);
|
|
ts = _tuple[0];
|
|
ok = _tuple[1];
|
|
/* */ if (ok) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (ok) { */ case 1:
|
|
_r = ts.RemoteAddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
$s = -1; return _r;
|
|
/* } */ case 2:
|
|
$s = -1; return $ifaceNil;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.RemoteAddr }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.s = s; $f.ts = ts; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.RemoteAddr = function() { return this.$val.RemoteAddr(); };
|
|
Stream.ptr.prototype.pushBytes = function(buf) {
|
|
var buf, err, s, written, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; buf = $f.buf; err = $f.err; s = $f.s; written = $f.written; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
written = 0;
|
|
err = $ifaceNil;
|
|
s = this;
|
|
$r = s.bufferLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
s.buffers = $append(s.buffers, buf);
|
|
s.heads = $append(s.heads, buf);
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return [written, err];
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.pushBytes }; } $f.buf = buf; $f.err = err; $f.s = s; $f.written = written; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.pushBytes = function(buf) { return this.$val.pushBytes(buf); };
|
|
Stream.ptr.prototype.recycleTokens = function() {
|
|
var _i, _ref, k, n, s, x, x$1, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _ref = $f._ref; k = $f.k; n = $f.n; s = $f.s; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
n = 0;
|
|
s = this;
|
|
$r = s.bufferLock.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_ref = s.buffers;
|
|
_i = 0;
|
|
while (true) {
|
|
if (!(_i < _ref.$length)) { break; }
|
|
k = _i;
|
|
n = n + ((x = s.buffers, ((k < 0 || k >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + k])).$length) >> 0;
|
|
defaultAllocator.Put((x$1 = s.heads, ((k < 0 || k >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + k])));
|
|
_i++;
|
|
}
|
|
s.buffers = sliceType$3.nil;
|
|
s.heads = sliceType$3.nil;
|
|
$r = s.bufferLock.Unlock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return n;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.recycleTokens }; } $f._i = _i; $f._ref = _ref; $f.k = k; $f.n = n; $f.s = s; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.recycleTokens = function() { return this.$val.recycleTokens(); };
|
|
Stream.ptr.prototype.notifyReadEvent = function() {
|
|
var _selection, s, $r;
|
|
/* */ var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _selection = $f._selection; s = $f.s; $r = $f.$r; }
|
|
s = this;
|
|
_selection = $select([[s.chReadEvent, new structType.ptr()], []]);
|
|
if (_selection[0] === 0) {
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
/* */ if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.notifyReadEvent }; } $f._selection = _selection; $f.s = s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.notifyReadEvent = function() { return this.$val.notifyReadEvent(); };
|
|
Stream.ptr.prototype.update = function(consumed, window) {
|
|
var _selection, consumed, s, window, $r;
|
|
/* */ var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _selection = $f._selection; consumed = $f.consumed; s = $f.s; window = $f.window; $r = $f.$r; }
|
|
s = this;
|
|
atomic.StoreUint32((s.$ptr_peerConsumed || (s.$ptr_peerConsumed = new ptrType$7(function() { return this.$target.peerConsumed; }, function($v) { this.$target.peerConsumed = $v; }, s))), consumed);
|
|
atomic.StoreUint32((s.$ptr_peerWindow || (s.$ptr_peerWindow = new ptrType$7(function() { return this.$target.peerWindow; }, function($v) { this.$target.peerWindow = $v; }, s))), window);
|
|
_selection = $select([[s.chUpdate, new structType.ptr()], []]);
|
|
if (_selection[0] === 0) {
|
|
} else if (_selection[0] === 1) {
|
|
}
|
|
/* */ if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.update }; } $f._selection = _selection; $f.consumed = consumed; $f.s = s; $f.window = window; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.update = function(consumed, window) { return this.$val.update(consumed, window); };
|
|
Stream.ptr.prototype.fin = function() {
|
|
var s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = [s];
|
|
s[0] = this;
|
|
$r = s[0].finEventOnce.Do((function(s) { return function() {
|
|
$close(s[0].chFinEvent);
|
|
}; })(s)); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Stream.ptr.prototype.fin }; } $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Stream.prototype.fin = function() { return this.$val.fin(); };
|
|
ptrType.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$Int], [sliceType$1], false)}, {prop: "Put", name: "Put", pkg: "", typ: $funcType([sliceType$1], [$error], false)}];
|
|
rawHeader.methods = [{prop: "Version", name: "Version", pkg: "", typ: $funcType([], [$Uint8], false)}, {prop: "Cmd", name: "Cmd", pkg: "", typ: $funcType([], [$Uint8], false)}, {prop: "Length", name: "Length", pkg: "", typ: $funcType([], [$Uint16], false)}, {prop: "StreamID", name: "StreamID", pkg: "", typ: $funcType([], [$Uint32], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
|
|
updHeader.methods = [{prop: "Consumed", name: "Consumed", pkg: "", typ: $funcType([], [$Uint32], false)}, {prop: "Window", name: "Window", pkg: "", typ: $funcType([], [$Uint32], false)}];
|
|
ptrType$2.methods = [{prop: "OpenStream", name: "OpenStream", pkg: "", typ: $funcType([], [ptrType$3, $error], false)}, {prop: "Open", name: "Open", pkg: "", typ: $funcType([], [io.ReadWriteCloser, $error], false)}, {prop: "AcceptStream", name: "AcceptStream", pkg: "", typ: $funcType([], [ptrType$3, $error], false)}, {prop: "Accept", name: "Accept", pkg: "", typ: $funcType([], [io.ReadWriteCloser, $error], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "notifyBucket", name: "notifyBucket", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "notifyReadError", name: "notifyReadError", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$error], [], false)}, {prop: "notifyWriteError", name: "notifyWriteError", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$error], [], false)}, {prop: "notifyProtoError", name: "notifyProtoError", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$error], [], false)}, {prop: "IsClosed", name: "IsClosed", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "NumStreams", name: "NumStreams", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "LocalAddr", name: "LocalAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "RemoteAddr", name: "RemoteAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "streamClosed", name: "streamClosed", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$Uint32], [], false)}, {prop: "returnTokens", name: "returnTokens", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$Int], [], false)}, {prop: "recvLoop", name: "recvLoop", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "keepalive", name: "keepalive", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "shaperLoop", name: "shaperLoop", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "sendLoop", name: "sendLoop", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "writeFrame", name: "writeFrame", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([Frame], [$Int, $error], false)}, {prop: "writeFrameInternal", name: "writeFrameInternal", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([Frame, chanType$1, $Uint64], [$Int, $error], false)}];
|
|
shaperHeap.methods = [{prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Less", name: "Less", pkg: "", typ: $funcType([$Int, $Int], [$Bool], false)}, {prop: "Swap", name: "Swap", pkg: "", typ: $funcType([$Int, $Int], [], false)}];
|
|
ptrType$5.methods = [{prop: "Push", name: "Push", pkg: "", typ: $funcType([$emptyInterface], [], false)}, {prop: "Pop", name: "Pop", pkg: "", typ: $funcType([], [$emptyInterface], false)}];
|
|
ptrType$3.methods = [{prop: "ID", name: "ID", pkg: "", typ: $funcType([], [$Uint32], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "tryRead", name: "tryRead", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "tryReadv2", name: "tryReadv2", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "WriteTo", name: "WriteTo", pkg: "", typ: $funcType([io.Writer], [$Int64, $error], false)}, {prop: "writeTov2", name: "writeTov2", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([io.Writer], [$Int64, $error], false)}, {prop: "sendWindowUpdate", name: "sendWindowUpdate", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$Uint32], [$error], false)}, {prop: "waitRead", name: "waitRead", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [$error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "writeV2", name: "writeV2", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "GetDieCh", name: "GetDieCh", pkg: "", typ: $funcType([], [chanType$5], false)}, {prop: "SetReadDeadline", name: "SetReadDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetWriteDeadline", name: "SetWriteDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "sessionClose", name: "sessionClose", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "LocalAddr", name: "LocalAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "RemoteAddr", name: "RemoteAddr", pkg: "", typ: $funcType([], [net.Addr], false)}, {prop: "pushBytes", name: "pushBytes", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "recycleTokens", name: "recycleTokens", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [$Int], false)}, {prop: "notifyReadEvent", name: "notifyReadEvent", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}, {prop: "update", name: "update", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([$Uint32, $Uint32], [], false)}, {prop: "fin", name: "fin", pkg: "github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", typ: $funcType([], [], false)}];
|
|
Allocator.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "buffers", name: "buffers", embedded: false, exported: false, typ: sliceType, tag: ""}]);
|
|
Frame.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "ver", name: "ver", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "cmd", name: "cmd", embedded: false, exported: false, typ: $Uint8, tag: ""}, {prop: "sid", name: "sid", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "data", name: "data", embedded: false, exported: false, typ: sliceType$1, tag: ""}]);
|
|
rawHeader.init($Uint8, 8);
|
|
updHeader.init($Uint8, 8);
|
|
Config.init("", [{prop: "Version", name: "Version", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "KeepAliveInterval", name: "KeepAliveInterval", embedded: false, exported: true, typ: time.Duration, tag: ""}, {prop: "KeepAliveTimeout", name: "KeepAliveTimeout", embedded: false, exported: true, typ: time.Duration, tag: ""}, {prop: "MaxFrameSize", name: "MaxFrameSize", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "MaxReceiveBuffer", name: "MaxReceiveBuffer", embedded: false, exported: true, typ: $Int, tag: ""}, {prop: "MaxStreamBuffer", name: "MaxStreamBuffer", embedded: false, exported: true, typ: $Int, tag: ""}]);
|
|
writeRequest.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "prio", name: "prio", embedded: false, exported: false, typ: $Uint64, tag: ""}, {prop: "frame", name: "frame", embedded: false, exported: false, typ: Frame, tag: ""}, {prop: "result", name: "result", embedded: false, exported: false, typ: chanType, tag: ""}]);
|
|
writeResult.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "n", name: "n", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "err", name: "err", embedded: false, exported: false, typ: $error, tag: ""}]);
|
|
buffersWriter.init([{prop: "WriteBuffers", name: "WriteBuffers", pkg: "", typ: $funcType([sliceType$3], [$Int, $error], false)}]);
|
|
Session.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "conn", name: "conn", embedded: false, exported: false, typ: io.ReadWriteCloser, tag: ""}, {prop: "config", name: "config", embedded: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "nextStreamID", name: "nextStreamID", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "nextStreamIDLock", name: "nextStreamIDLock", embedded: false, exported: false, typ: sync.Mutex, tag: ""}, {prop: "bucket", name: "bucket", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "bucketNotify", name: "bucketNotify", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "streams", name: "streams", embedded: false, exported: false, typ: mapType, tag: ""}, {prop: "streamLock", name: "streamLock", embedded: false, exported: false, typ: sync.Mutex, tag: ""}, {prop: "die", name: "die", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "dieOnce", name: "dieOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "socketReadError", name: "socketReadError", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "socketWriteError", name: "socketWriteError", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "chSocketReadError", name: "chSocketReadError", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "chSocketWriteError", name: "chSocketWriteError", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "socketReadErrorOnce", name: "socketReadErrorOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "socketWriteErrorOnce", name: "socketWriteErrorOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "protoError", name: "protoError", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "chProtoError", name: "chProtoError", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "protoErrorOnce", name: "protoErrorOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "chAccepts", name: "chAccepts", embedded: false, exported: false, typ: chanType$3, tag: ""}, {prop: "dataReady", name: "dataReady", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "goAway", name: "goAway", embedded: false, exported: false, typ: $Int32, tag: ""}, {prop: "deadline", name: "deadline", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "shaper", name: "shaper", embedded: false, exported: false, typ: chanType$4, tag: ""}, {prop: "writes", name: "writes", embedded: false, exported: false, typ: chanType$4, tag: ""}]);
|
|
shaperHeap.init(writeRequest);
|
|
Stream.init("github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux", [{prop: "id", name: "id", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "sess", name: "sess", embedded: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "buffers", name: "buffers", embedded: false, exported: false, typ: sliceType$3, tag: ""}, {prop: "heads", name: "heads", embedded: false, exported: false, typ: sliceType$3, tag: ""}, {prop: "bufferLock", name: "bufferLock", embedded: false, exported: false, typ: sync.Mutex, tag: ""}, {prop: "frameSize", name: "frameSize", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "chReadEvent", name: "chReadEvent", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "die", name: "die", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "dieOnce", name: "dieOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "chFinEvent", name: "chFinEvent", embedded: false, exported: false, typ: chanType$2, tag: ""}, {prop: "finEventOnce", name: "finEventOnce", embedded: false, exported: false, typ: sync.Once, tag: ""}, {prop: "readDeadline", name: "readDeadline", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "writeDeadline", name: "writeDeadline", embedded: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "numRead", name: "numRead", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "numWritten", name: "numWritten", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "incr", name: "incr", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "peerConsumed", name: "peerConsumed", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "peerWindow", name: "peerWindow", embedded: false, exported: false, typ: $Uint32, tag: ""}, {prop: "chUpdate", name: "chUpdate", embedded: false, exported: false, typ: chanType$2, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = heap.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = binary.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = errors.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = fmt.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = math.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = net.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = sync.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = atomic.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
defaultAllocator = ptrType.nil;
|
|
debruijinPos = $toNativeArray($kindUint8, [0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31]);
|
|
$pkg.ErrInvalidProtocol = errors.New("invalid protocol");
|
|
$pkg.ErrConsumed = errors.New("peer consumed more than sent");
|
|
$pkg.ErrGoAway = errors.New("stream id overflows, should start a new connection");
|
|
$pkg.ErrTimeout = errors.New("timeout");
|
|
$pkg.ErrWouldBlock = errors.New("operation would block on IO");
|
|
init();
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/bridge"] = (function() {
|
|
var $pkg = {}, $init, fmt, proto, websocket, smux, io, time, Settings, sliceType, ptrType, Bridge;
|
|
fmt = $packages["fmt"];
|
|
proto = $packages["github.com/xiaokangwang/BrowserBridge/proto"];
|
|
websocket = $packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/gopherjs/websocket"];
|
|
smux = $packages["github.com/xiaokangwang/BrowserBridge/vendor/github.com/xtaci/smux"];
|
|
io = $packages["io"];
|
|
time = $packages["time"];
|
|
Settings = $pkg.Settings = $newType(0, $kindStruct, "bridge.Settings", true, "github.com/xiaokangwang/BrowserBridge/bridge", true, function(DialAddr_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.DialAddr = "";
|
|
return;
|
|
}
|
|
this.DialAddr = DialAddr_;
|
|
});
|
|
sliceType = $sliceType($emptyInterface);
|
|
ptrType = $ptrType(smux.Config);
|
|
Bridge = function(s) {
|
|
var DoConnect, _r, delay, s, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; DoConnect = $f.DoConnect; _r = $f._r; delay = $f.delay; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
s = [s];
|
|
/* while (true) { */ case 1:
|
|
delay = time.NewTimer(new time.Duration(0, 1000000000));
|
|
DoConnect = (function(s) { return function $b() {
|
|
var _r, _r$1, _r$2, _r$3, _r$4, _tuple, _tuple$1, _tuple$2, conn, err, err$1, smuxc, stream, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; conn = $f.conn; err = $f.err; err$1 = $f.err$1; smuxc = $f.smuxc; stream = $f.stream; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = websocket.Dial(s[0].DialAddr); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
conn = _tuple[0];
|
|
err = _tuple[1];
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 2:
|
|
_r$1 = fmt.Println(new sliceType([err, new $String(s[0].DialAddr)])); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* } */ case 3:
|
|
_r$2 = smux.Client(conn, ptrType.nil); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$2;
|
|
smuxc = _tuple$1[0];
|
|
err = _tuple$1[1];
|
|
if (!($interfaceIsEqual(err, $ifaceNil))) {
|
|
$s = -1; return;
|
|
}
|
|
/* while (true) { */ case 6:
|
|
stream = [stream];
|
|
_r$3 = smuxc.Accept(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
_tuple$2 = _r$3;
|
|
stream[0] = _tuple$2[0];
|
|
err$1 = _tuple$2[1];
|
|
/* */ if (!($interfaceIsEqual(err$1, $ifaceNil))) { $s = 9; continue; }
|
|
/* */ $s = 10; continue;
|
|
/* if (!($interfaceIsEqual(err$1, $ifaceNil))) { */ case 9:
|
|
_r$4 = fmt.Println(new sliceType([err$1])); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
|
|
_r$4;
|
|
$s = -1; return;
|
|
/* } */ case 10:
|
|
$go((function(s, stream) { return function $b() {
|
|
var _r$10, _r$11, _r$5, _r$6, _r$7, _r$8, _r$9, _tuple$3, _tuple$4, conn2, err$2, req, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; conn2 = $f.conn2; err$2 = $f.err$2; req = $f.req; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r$5 = proto.ReadRequest(stream[0]); /* */ $s = 1; case 1: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
|
|
_tuple$3 = _r$5;
|
|
err$2 = _tuple$3[0];
|
|
req = _tuple$3[1];
|
|
/* */ if (!($interfaceIsEqual(err$2, $ifaceNil))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!($interfaceIsEqual(err$2, $ifaceNil))) { */ case 2:
|
|
_r$6 = fmt.Println(new sliceType([err$2])); /* */ $s = 4; case 4: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
|
|
_r$6;
|
|
$s = -1; return;
|
|
/* } */ case 3:
|
|
_r$7 = websocket.Dial(req.Destination); /* */ $s = 5; case 5: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
|
|
_tuple$4 = _r$7;
|
|
conn2 = _tuple$4[0];
|
|
err$2 = _tuple$4[1];
|
|
/* */ if (!($interfaceIsEqual(err$2, $ifaceNil))) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (!($interfaceIsEqual(err$2, $ifaceNil))) { */ case 6:
|
|
_r$8 = fmt.Println(new sliceType([err$2])); /* */ $s = 8; case 8: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
|
|
_r$8;
|
|
_r$9 = stream[0].Close(); /* */ $s = 9; case 9: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
|
|
_r$9;
|
|
$s = -1; return;
|
|
/* } */ case 7:
|
|
$go(io.Copy, [stream[0], conn2]);
|
|
_r$10 = io.Copy(conn2, stream[0]); /* */ $s = 10; case 10: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
|
|
_r$10;
|
|
_r$11 = stream[0].Close(); /* */ $s = 11; case 11: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
|
|
_r$11;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.conn2 = conn2; $f.err$2 = err$2; $f.req = req; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(s, stream), []);
|
|
/* } */ $s = 6; continue; case 7:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.conn = conn; $f.err = err; $f.err$1 = err$1; $f.smuxc = smuxc; $f.stream = stream; $f.$s = $s; $f.$r = $r; return $f;
|
|
}; })(s);
|
|
$r = DoConnect(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r = $recv(delay.C); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r[0];
|
|
/* } */ $s = 1; continue; case 2:
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Bridge }; } $f.DoConnect = DoConnect; $f._r = _r; $f.delay = delay; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Bridge = Bridge;
|
|
Settings.init("", [{prop: "DialAddr", name: "DialAddr", embedded: false, exported: true, typ: $String, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = fmt.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = proto.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = websocket.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = smux.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["log"] = (function() {
|
|
var $pkg = {}, $init, fmt, nosync, io, os, runtime, time, Logger, sliceType, arrayType, ptrType, sliceType$1, ptrType$1, std, New, itoa, Println;
|
|
fmt = $packages["fmt"];
|
|
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
|
|
io = $packages["io"];
|
|
os = $packages["os"];
|
|
runtime = $packages["runtime"];
|
|
time = $packages["time"];
|
|
Logger = $pkg.Logger = $newType(0, $kindStruct, "log.Logger", true, "log", true, function(mu_, prefix_, flag_, out_, buf_) {
|
|
this.$val = this;
|
|
if (arguments.length === 0) {
|
|
this.mu = new nosync.Mutex.ptr(false);
|
|
this.prefix = "";
|
|
this.flag = 0;
|
|
this.out = $ifaceNil;
|
|
this.buf = sliceType.nil;
|
|
return;
|
|
}
|
|
this.mu = mu_;
|
|
this.prefix = prefix_;
|
|
this.flag = flag_;
|
|
this.out = out_;
|
|
this.buf = buf_;
|
|
});
|
|
sliceType = $sliceType($Uint8);
|
|
arrayType = $arrayType($Uint8, 20);
|
|
ptrType = $ptrType(sliceType);
|
|
sliceType$1 = $sliceType($emptyInterface);
|
|
ptrType$1 = $ptrType(Logger);
|
|
New = function(out, prefix, flag) {
|
|
var flag, out, prefix;
|
|
return new Logger.ptr(new nosync.Mutex.ptr(false), prefix, flag, out, sliceType.nil);
|
|
};
|
|
$pkg.New = New;
|
|
Logger.ptr.prototype.SetOutput = function(w) {
|
|
var l, w, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
l.out = w;
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.SetOutput = function(w) { return this.$val.SetOutput(w); };
|
|
itoa = function(buf, i, wid) {
|
|
var _q, b, bp, buf, i, q, wid;
|
|
b = arrayType.zero();
|
|
bp = 19;
|
|
while (true) {
|
|
if (!(i >= 10 || wid > 1)) { break; }
|
|
wid = wid - (1) >> 0;
|
|
q = (_q = i / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
|
|
((bp < 0 || bp >= b.length) ? ($throwRuntimeError("index out of range"), undefined) : b[bp] = ((((48 + i >> 0) - ($imul(q, 10)) >> 0) << 24 >>> 24)));
|
|
bp = bp - (1) >> 0;
|
|
i = q;
|
|
}
|
|
((bp < 0 || bp >= b.length) ? ($throwRuntimeError("index out of range"), undefined) : b[bp] = (((48 + i >> 0) << 24 >>> 24)));
|
|
buf.$set($appendSlice(buf.$get(), $subslice(new sliceType(b), bp)));
|
|
};
|
|
Logger.ptr.prototype.formatHeader = function(buf, t, file, line) {
|
|
var _q, _r, _r$1, _tuple, _tuple$1, buf, day, file, hour, i, l, line, min, month, sec, short$1, t, year, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; buf = $f.buf; day = $f.day; file = $f.file; hour = $f.hour; i = $f.i; l = $f.l; line = $f.line; min = $f.min; month = $f.month; sec = $f.sec; short$1 = $f.short$1; t = $f.t; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
buf.$set($appendSlice(buf.$get(), l.prefix));
|
|
/* */ if (!(((l.flag & 7) === 0))) { $s = 1; continue; }
|
|
/* */ $s = 2; continue;
|
|
/* if (!(((l.flag & 7) === 0))) { */ case 1:
|
|
if (!(((l.flag & 32) === 0))) {
|
|
time.Time.copy(t, $clone(t, time.Time).UTC());
|
|
}
|
|
/* */ if (!(((l.flag & 1) === 0))) { $s = 3; continue; }
|
|
/* */ $s = 4; continue;
|
|
/* if (!(((l.flag & 1) === 0))) { */ case 3:
|
|
_r = $clone(t, time.Time).Date(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple = _r;
|
|
year = _tuple[0];
|
|
month = _tuple[1];
|
|
day = _tuple[2];
|
|
itoa(buf, year, 4);
|
|
buf.$set($append(buf.$get(), 47));
|
|
itoa(buf, ((month >> 0)), 2);
|
|
buf.$set($append(buf.$get(), 47));
|
|
itoa(buf, day, 2);
|
|
buf.$set($append(buf.$get(), 32));
|
|
/* } */ case 4:
|
|
/* */ if (!(((l.flag & 6) === 0))) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if (!(((l.flag & 6) === 0))) { */ case 6:
|
|
_r$1 = $clone(t, time.Time).Clock(); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r$1;
|
|
hour = _tuple$1[0];
|
|
min = _tuple$1[1];
|
|
sec = _tuple$1[2];
|
|
itoa(buf, hour, 2);
|
|
buf.$set($append(buf.$get(), 58));
|
|
itoa(buf, min, 2);
|
|
buf.$set($append(buf.$get(), 58));
|
|
itoa(buf, sec, 2);
|
|
if (!(((l.flag & 4) === 0))) {
|
|
buf.$set($append(buf.$get(), 46));
|
|
itoa(buf, (_q = $clone(t, time.Time).Nanosecond() / 1000, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")), 6);
|
|
}
|
|
buf.$set($append(buf.$get(), 32));
|
|
/* } */ case 7:
|
|
/* } */ case 2:
|
|
if (!(((l.flag & 24) === 0))) {
|
|
if (!(((l.flag & 16) === 0))) {
|
|
short$1 = file;
|
|
i = file.length - 1 >> 0;
|
|
while (true) {
|
|
if (!(i > 0)) { break; }
|
|
if (file.charCodeAt(i) === 47) {
|
|
short$1 = $substring(file, (i + 1 >> 0));
|
|
break;
|
|
}
|
|
i = i - (1) >> 0;
|
|
}
|
|
file = short$1;
|
|
}
|
|
buf.$set($appendSlice(buf.$get(), file));
|
|
buf.$set($append(buf.$get(), 58));
|
|
itoa(buf, line, -1);
|
|
buf.$set($appendSlice(buf.$get(), ": "));
|
|
}
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.formatHeader }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.buf = buf; $f.day = day; $f.file = file; $f.hour = hour; $f.i = i; $f.l = l; $f.line = line; $f.min = min; $f.month = month; $f.sec = sec; $f.short$1 = short$1; $f.t = t; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.formatHeader = function(buf, t, file, line) { return this.$val.formatHeader(buf, t, file, line); };
|
|
Logger.ptr.prototype.Output = function(calldepth, s) {
|
|
var _r, _tuple, _tuple$1, calldepth, err, file, l, line, now, ok, s, $s, $deferred, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; calldepth = $f.calldepth; err = $f.err; file = $f.file; l = $f.l; line = $f.line; now = $f.now; ok = $f.ok; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
now = $clone(time.Now(), time.Time);
|
|
file = "";
|
|
line = 0;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
if (!(((l.flag & 24) === 0))) {
|
|
l.mu.Unlock();
|
|
ok = false;
|
|
_tuple = runtime.Caller(calldepth);
|
|
file = _tuple[1];
|
|
line = _tuple[2];
|
|
ok = _tuple[3];
|
|
if (!ok) {
|
|
file = "???";
|
|
line = 0;
|
|
}
|
|
l.mu.Lock();
|
|
}
|
|
l.buf = $subslice(l.buf, 0, 0);
|
|
$r = l.formatHeader((l.$ptr_buf || (l.$ptr_buf = new ptrType(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, l))), $clone(now, time.Time), file, line); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
l.buf = $appendSlice(l.buf, s);
|
|
if ((s.length === 0) || !((s.charCodeAt((s.length - 1 >> 0)) === 10))) {
|
|
l.buf = $append(l.buf, 10);
|
|
}
|
|
_r = l.out.Write(l.buf); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_tuple$1 = _r;
|
|
err = _tuple$1[1];
|
|
$s = -1; return err;
|
|
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Output }; } $f._r = _r; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.calldepth = calldepth; $f.err = err; $f.file = file; $f.l = l; $f.line = line; $f.now = now; $f.ok = ok; $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
|
|
};
|
|
Logger.prototype.Output = function(calldepth, s) { return this.$val.Output(calldepth, s); };
|
|
Logger.ptr.prototype.Printf = function(format, v) {
|
|
var _arg, _r, _r$1, format, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; format = $f.format; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintf(format, v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Printf }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.format = format; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Printf = function(format, v) { return this.$val.Printf(format, v); };
|
|
Logger.ptr.prototype.Print = function(v) {
|
|
var _arg, _r, _r$1, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprint(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Print }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Print = function(v) { return this.$val.Print(v); };
|
|
Logger.ptr.prototype.Println = function(v) {
|
|
var _arg, _r, _r$1, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintln(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Println }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Println = function(v) { return this.$val.Println(v); };
|
|
Logger.ptr.prototype.Fatal = function(v) {
|
|
var _arg, _r, _r$1, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprint(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
os.Exit(1);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Fatal }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Fatal = function(v) { return this.$val.Fatal(v); };
|
|
Logger.ptr.prototype.Fatalf = function(format, v) {
|
|
var _arg, _r, _r$1, format, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; format = $f.format; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintf(format, v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
os.Exit(1);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Fatalf }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.format = format; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Fatalf = function(format, v) { return this.$val.Fatalf(format, v); };
|
|
Logger.ptr.prototype.Fatalln = function(v) {
|
|
var _arg, _r, _r$1, l, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; l = $f.l; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintln(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = l.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
os.Exit(1);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Fatalln }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Fatalln = function(v) { return this.$val.Fatalln(v); };
|
|
Logger.ptr.prototype.Panic = function(v) {
|
|
var _r, _r$1, l, s, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; l = $f.l; s = $f.s; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprint(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
s = _r;
|
|
_r$1 = l.Output(2, s); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$panic(new $String(s));
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Panic }; } $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.s = s; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Panic = function(v) { return this.$val.Panic(v); };
|
|
Logger.ptr.prototype.Panicf = function(format, v) {
|
|
var _r, _r$1, format, l, s, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; format = $f.format; l = $f.l; s = $f.s; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintf(format, v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
s = _r;
|
|
_r$1 = l.Output(2, s); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$panic(new $String(s));
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Panicf }; } $f._r = _r; $f._r$1 = _r$1; $f.format = format; $f.l = l; $f.s = s; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Panicf = function(format, v) { return this.$val.Panicf(format, v); };
|
|
Logger.ptr.prototype.Panicln = function(v) {
|
|
var _r, _r$1, l, s, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; l = $f.l; s = $f.s; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
l = this;
|
|
_r = fmt.Sprintln(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
s = _r;
|
|
_r$1 = l.Output(2, s); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$panic(new $String(s));
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Logger.ptr.prototype.Panicln }; } $f._r = _r; $f._r$1 = _r$1; $f.l = l; $f.s = s; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
Logger.prototype.Panicln = function(v) { return this.$val.Panicln(v); };
|
|
Logger.ptr.prototype.Flags = function() {
|
|
var l, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
return l.flag;
|
|
/* */ } catch(err) { $err = err; return 0; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.Flags = function() { return this.$val.Flags(); };
|
|
Logger.ptr.prototype.SetFlags = function(flag) {
|
|
var flag, l, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
l.flag = flag;
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.SetFlags = function(flag) { return this.$val.SetFlags(flag); };
|
|
Logger.ptr.prototype.Prefix = function() {
|
|
var l, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
return l.prefix;
|
|
/* */ } catch(err) { $err = err; return ""; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.Prefix = function() { return this.$val.Prefix(); };
|
|
Logger.ptr.prototype.SetPrefix = function(prefix) {
|
|
var l, prefix, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
l.prefix = prefix;
|
|
/* */ } catch(err) { $err = err; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.SetPrefix = function(prefix) { return this.$val.SetPrefix(prefix); };
|
|
Logger.ptr.prototype.Writer = function() {
|
|
var l, $deferred;
|
|
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
|
|
l = this;
|
|
l.mu.Lock();
|
|
$deferred.push([$methodVal(l.mu, "Unlock"), []]);
|
|
return l.out;
|
|
/* */ } catch(err) { $err = err; return $ifaceNil; } finally { $callDeferred($deferred, $err); }
|
|
};
|
|
Logger.prototype.Writer = function() { return this.$val.Writer(); };
|
|
Println = function(v) {
|
|
var _arg, _r, _r$1, v, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _r = $f._r; _r$1 = $f._r$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = fmt.Sprintln(v); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_arg = _r;
|
|
_r$1 = std.Output(2, _arg); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_r$1;
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: Println }; } $f._arg = _arg; $f._r = _r; $f._r$1 = _r$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.Println = Println;
|
|
ptrType$1.methods = [{prop: "SetOutput", name: "SetOutput", pkg: "", typ: $funcType([io.Writer], [], false)}, {prop: "formatHeader", name: "formatHeader", pkg: "log", typ: $funcType([ptrType, time.Time, $String, $Int], [], false)}, {prop: "Output", name: "Output", pkg: "", typ: $funcType([$Int, $String], [$error], false)}, {prop: "Printf", name: "Printf", pkg: "", typ: $funcType([$String, sliceType$1], [], true)}, {prop: "Print", name: "Print", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Println", name: "Println", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Fatal", name: "Fatal", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Fatalf", name: "Fatalf", pkg: "", typ: $funcType([$String, sliceType$1], [], true)}, {prop: "Fatalln", name: "Fatalln", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Panic", name: "Panic", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Panicf", name: "Panicf", pkg: "", typ: $funcType([$String, sliceType$1], [], true)}, {prop: "Panicln", name: "Panicln", pkg: "", typ: $funcType([sliceType$1], [], true)}, {prop: "Flags", name: "Flags", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "SetFlags", name: "SetFlags", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "Prefix", name: "Prefix", pkg: "", typ: $funcType([], [$String], false)}, {prop: "SetPrefix", name: "SetPrefix", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Writer", name: "Writer", pkg: "", typ: $funcType([], [io.Writer], false)}];
|
|
Logger.init("log", [{prop: "mu", name: "mu", embedded: false, exported: false, typ: nosync.Mutex, tag: ""}, {prop: "prefix", name: "prefix", embedded: false, exported: false, typ: $String, tag: ""}, {prop: "flag", name: "flag", embedded: false, exported: false, typ: $Int, tag: ""}, {prop: "out", name: "out", embedded: false, exported: false, typ: io.Writer, tag: ""}, {prop: "buf", name: "buf", embedded: false, exported: false, typ: sliceType, tag: ""}]);
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = fmt.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = nosync.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = io.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = os.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = runtime.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = time.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
std = New(os.Stderr, "", 3);
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$packages["github.com/xiaokangwang/BrowserBridge/bridge/bridgejs"] = (function() {
|
|
var $pkg = {}, $init, fmt, js, bridge, log, url, sliceType, main;
|
|
fmt = $packages["fmt"];
|
|
js = $packages["github.com/gopherjs/gopherjs/js"];
|
|
bridge = $packages["github.com/xiaokangwang/BrowserBridge/bridge"];
|
|
log = $packages["log"];
|
|
url = $packages["net/url"];
|
|
sliceType = $sliceType($emptyInterface);
|
|
main = function() {
|
|
var _r, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
_r = fmt.Println(new sliceType([new $String("V3")])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
|
|
_r;
|
|
$go((function $b() {
|
|
var _r$1, _r$2, _r$3, _tuple, err, host, link, urlw, $s, $r;
|
|
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _tuple = $f._tuple; err = $f.err; host = $f.host; link = $f.link; urlw = $f.urlw; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
link = $internalize($global.window.location.href, $String);
|
|
_r$1 = url.Parse(link); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
|
|
_tuple = _r$1;
|
|
urlw = _tuple[0];
|
|
err = _tuple[1];
|
|
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 2; continue; }
|
|
/* */ $s = 3; continue;
|
|
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 2:
|
|
$r = log.Println(new sliceType([err])); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* } */ case 3:
|
|
host = urlw.Host;
|
|
_r$2 = fmt.Sprintf("ws://%v/link", new sliceType([new $String(host)])); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
|
|
$r = log.Println(new sliceType([new $String(_r$2)])); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
_r$3 = fmt.Sprintf("ws://%v/link", new sliceType([new $String(host)])); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
|
|
$r = bridge.Bridge(new bridge.Settings.ptr(_r$3)); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$global.location.reload();
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._tuple = _tuple; $f.err = err; $f.host = host; $f.link = link; $f.urlw = urlw; $f.$s = $s; $f.$r = $r; return $f;
|
|
}), []);
|
|
$s = -1; return;
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: main }; } $f._r = _r; $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$init = function() {
|
|
$pkg.$init = function() {};
|
|
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
|
|
$r = fmt.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = bridge.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = log.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$r = url.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
/* */ if ($pkg === $mainPkg) { $s = 6; continue; }
|
|
/* */ $s = 7; continue;
|
|
/* if ($pkg === $mainPkg) { */ case 6:
|
|
$r = main(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
|
|
$mainFinished = true;
|
|
/* } */ case 7:
|
|
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
|
|
};
|
|
$pkg.$init = $init;
|
|
return $pkg;
|
|
})();
|
|
$synthesizeMethods();
|
|
var $mainPkg = $packages["github.com/xiaokangwang/BrowserBridge/bridge/bridgejs"];
|
|
$packages["runtime"].$init();
|
|
$go($mainPkg.$init, []);
|
|
$flushConsole();
|
|
|
|
}).call(this);
|
|
//# sourceMappingURL=bridgejs.js.map
|