30 lines
120 KiB
Plaintext
30 lines
120 KiB
Plaintext
|
{"version":3,
|
||
|
"file":"js/index.js",
|
||
|
"sourceRoot":"",
|
||
|
"names":[],
|
||
|
"mappings":
|
||
|
"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
|
||
|
"sources":
|
||
|
["/home/rbj/.opam/4.02.3/lib/js_of_ocaml/stdlib.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/mlString.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/ieee_754.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/int64.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/jslib_js_of_ocaml.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/jslib.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/lexing.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/md5.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/io.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/fs.js",
|
||
|
"/home/rbj/.opam/4.02.3/lib/js_of_ocaml/unix.js"],
|
||
|
"sourcesContent":
|
||
|
["// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n///////////// Core\n\n//Provides: raw_array_sub\nfunction raw_array_sub (a,i,l) {\n var b = new Array(l);\n for(var j = 0; j < l; j++) b[j] = a[i+j];\n return b\n}\n\n//Provides: raw_array_copy\nfunction raw_array_copy (a) {\n var l = a.length;\n var b = new Array(l);\n for(var i = 0; i < l; i++ ) b[i] = a[i];\n return b\n}\n\n//Provides: raw_array_cons\nfunction raw_array_cons (a,x) {\n var l = a.length;\n var b = new Array(l+1);\n b[0]=x;\n for(var i = 1; i <= l; i++ ) b[i] = a[i-1];\n return b\n}\n\n//Provides: raw_array_append_one\nfunction raw_array_append_one(a,x) {\n var l = a.length;\n var b = new Array(l+1);\n var i = 0;\n for(; i < l; i++ ) b[i] = a[i];\n b[i]=x;\n return b\n}\n\n//Provides: caml_call_gen (const, shallow)\n//Requires: raw_array_sub\n//Requires: raw_array_append_one\nfunction caml_call_gen(f, args) {\n if(f.fun)\n return caml_call_gen(f.fun, args);\n var n = f.length;\n var argsLen = args.length;\n var d = n - argsLen;\n if (d == 0)\n return f.apply(null, args);\n else if (d < 0)\n return caml_call_gen(f.apply(null,\n raw_array_sub(args,0,n)),\n raw_array_sub(args,n,argsLen - n));\n else\n return function (x){ return caml_call_gen(f, raw_array_append_one(args,x)); };\n}\n\n//Provides: caml_named_values\nvar caml_named_values = {};\n\n//Provides: caml_register_named_value (const,const)\n//Requires: caml_named_values, caml_bytes_of_string\nfunction caml_register_named_value(nm,v) {\n caml_named_values[caml_bytes_of_string(nm)] = v;\n return 0;\n}\n\n//Provides: caml_named_value\n//Requires: caml_named_values\nfunction caml_named_value(nm) {\n return caml_named_values[nm]\n}\n\n//Provides: caml_global_data\nvar caml_global_data = [0];\n\n//Provides: caml_register_global (const, shallow, const)\n//Requires: caml_global_data\nfunction caml_register_global (n, v, name_opt) {\n caml_global_data[n + 1] = v;\n if(name_opt) caml_global_data[name_opt] = v;\n}\n\n//Provides: caml_get_global_data mutable\n//Requires: caml_global_data\nfunction caml_get_global_data () { return caml_global_data; }\n\n//Raise exception\n\n\n//Provides: caml_raise_constant (const)\n//Version: < 4.02\nfunction caml_raise_constant (tag) { throw [0, tag]; }\n\n//Provides: caml_raise_constant (const)\n//Version: >= 4.02\nfunction caml_raise_constant (tag) { throw tag; }\n\n//Provides: caml_return_exn_constant (const)\n//Version: < 4.02\nfunction caml_return_exn_constant (tag) { return [0, tag]; }\n\n//Provides: caml_return_exn_constant (const)\n//Version: >= 4.02\nfunction caml_return_exn_constant (tag) { return tag; }\n\n//Provides: caml_raise_with_arg (const, const)\nfunction caml_raise_with_arg (tag, arg) { throw [0, tag, arg]; }\n\n//Provides: caml_raise_with_string (const, const)\n//Requires: caml_raise_with_arg,caml_new_string\nfunction caml_raise_with_string (tag, msg) {\n caml_raise_with_arg (tag, caml_new_string (msg));\n}\n\n//Provides: caml_raise_sys_error (const)\n//Requires: caml_raise_with_string, caml_global_data\nfunction caml_raise_sys_error (msg) {\n caml_raise_with_string(caml_global_
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010-2014 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n// An OCaml string is an object with three fields:\n// - tag 't'\n// - length 'l'\n// - contents 'c'\n//\n// The contents of the string can be either a JavaScript array or\n// a JavaScript string. The length of this string can be less than the\n// length of the OCaml string. In this case, remaining bytes are\n// assumed to be zeroes. Arrays are mutable but consumes more memory\n// than strings. A common pattern is to start from an empty string and\n// progressively fill it from the start. Partial strings makes it\n// possible to implement this efficiently.\n//\n// When converting to and from UTF-16, we keep track of whether the\n// string is composed only of ASCII characters (in which case, no\n// conversion needs to be performed) or not.\n//\n// The string tag can thus take the following values:\n// full string BYTE | UNKNOWN: 0\n// BYTE | ASCII: 9\n// BYTE | NOT_ASCII: 8\n// string prefix PARTIAL: 2\n// array ARRAY: 4\n//\n// One can use bit masking to discriminate these different cases:\n// known_encoding(x) = x&8\n// is_ascii(x) = x&1\n// kind(x) = x&6\n\n//Provides: caml_str_repeat\nfunction caml_str_repeat(n, s) {\n if (s.repeat) return s.repeat(n); // ECMAscript 6 and Firefox 24+\n var r = \"\", l = 0;\n if (n == 0) return r;\n for(;;) {\n if (n & 1) r += s;\n n >>= 1;\n if (n == 0) return r;\n s += s;\n l++;\n if (l == 9) {\n s.slice(0,1); // flatten the string\n // then, the flattening of the whole string will be faster,\n // as it will be composed of larger pieces\n }\n }\n}\n\n//Provides: caml_subarray_to_string\n//Requires: raw_array_sub\nfunction caml_subarray_to_string (a, i, len) {\n var f = String.fromCharCode;\n if (i == 0 && len <= 4096 && len == a.length) return f.apply (null, a);\n var s = \"\";\n for (; 0 < len; i += 1024,len-=1024)\n s += f.apply (null, raw_array_sub(a,i, Math.min(len, 1024)));\n return s;\n}\n\n//Provides: caml_utf8_of_utf16\nfunction caml_utf8_of_utf16(s) {\n for (var b = \"\", t = b, c, d, i = 0, l = s.length; i < l; i++) {\n c = s.charCodeAt(i);\n if (c < 0x80) {\n for (var j = i + 1; (j < l) && (c = s.charCodeAt(j)) < 0x80; j++);\n if (j - i > 512) { t.substr(0, 1); b += t; t = \"\"; b += s.slice(i, j) }\n else t += s.slice(i, j);\n if (j == l) break;\n i = j;\n }\n if (c < 0x800) {\n t += String.fromCharCode(0xc0 | (c >> 6));\n t += String.fromCharCode(0x80 | (c & 0x3f));\n } else if (c < 0xd800 || c >= 0xdfff) {\n t += String.fromCharCode(0xe0 | (c >> 12),\n 0x80 | ((c >> 6) & 0x3f),\n 0x80 | (c & 0x3f));\n } else if (c >= 0xdbff || i + 1 == l ||\n (d = s.charCodeAt(i + 1)) < 0xdc00 || d > 0xdfff) {\n // Unmatched surrogate pair, replaced by \\ufffd (replacement character)\n t += \"\\xef\\xbf\\xbd\";\n } else {\n i++;\n c = (c << 10) + d - 0x35fdc00;\n t += String.fromCharCode(0xf0 | (c >> 18),\n
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n//Provides: caml_int64_bits_of_float const\nfunction caml_int64_bits_of_float (x) {\n if (!isFinite(x)) {\n if (isNaN(x)) return [255, 1, 0, 0xfff0];\n return (x > 0)?[255,0,0,0x7ff0]:[255,0,0,0xfff0];\n }\n var sign = (x>=0)?0:0x8000;\n if (sign) x = -x;\n var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1023;\n if (exp <= 0) {\n exp = 0;\n x /= Math.pow(2,-1026);\n } else {\n x /= Math.pow(2,exp-1027);\n if (x < 16) { x *= 2; exp -=1; }\n if (exp == 0) { x /= 2; }\n }\n var k = Math.pow(2,24);\n var r3 = x|0;\n x = (x - r3) * k;\n var r2 = x|0;\n x = (x - r2) * k;\n var r1 = x|0;\n r3 = (r3 &0xf) | sign | exp << 4;\n return [255, r1, r2, r3];\n}\n//Provides: caml_int64_float_of_bits const\nfunction caml_int64_float_of_bits (x) {\n var exp = (x[3] & 0x7fff) >> 4;\n if (exp == 2047) {\n if ((x[1]|x[2]|(x[3]&0xf)) == 0)\n return (x[3] & 0x8000)?(-Infinity):Infinity;\n else\n return NaN;\n }\n var k = Math.pow(2,-24);\n var res = (x[1]*k+x[2])*k+(x[3]&0xf);\n if (exp > 0) {\n res += 16;\n res *= Math.pow(2,exp-1027);\n } else\n res *= Math.pow(2,-1026);\n if (x[3] & 0x8000) res = - res;\n return res;\n}\n//Provides: caml_classify_float const\nfunction caml_classify_float (x) {\n if (isFinite (x)) {\n if (Math.abs(x) >= 2.2250738585072014e-308) return 0;\n if (x != 0) return 1;\n return 2;\n }\n return isNaN(x)?4:3;\n}\n//Provides: caml_modf_float const\nfunction caml_modf_float (x) {\n if (isFinite (x)) {\n var neg = (1/x) < 0;\n x = Math.abs(x);\n var i = Math.floor (x);\n var f = x - i;\n if (neg) { i = -i; f = -f; }\n return [0, f, i];\n }\n if (isNaN (x)) return [0, NaN, NaN];\n return [0, 1/x, x];\n}\n//Provides: caml_ldexp_float const\nfunction caml_ldexp_float (x,exp) {\n exp |= 0;\n if (exp > 1023) {\n exp -= 1023;\n x *= Math.pow(2, 1023);\n if (exp > 1023) { // in case x is subnormal\n exp -= 1023;\n x *= Math.pow(2, 1023);\n }\n }\n if (exp < -1023) {\n exp += 1023;\n x *= Math.pow(2, -1023);\n }\n x *= Math.pow(2, exp);\n return x;\n}\n//Provides: caml_frexp_float const\nfunction caml_frexp_float (x) {\n if ((x == 0) || !isFinite(x)) return [0, x, 0];\n var neg = x < 0;\n if (neg) x = - x;\n var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1;\n x *= Math.pow(2,-exp);\n if (x < 0.5) { x *= 2; exp -= 1; }\n if (neg) x = - x;\n return [0, x, exp];\n}\n\n//Provides: caml_float_compare const\nfunction caml_float_compare (x, y) {\n if (x === y) return 0;\n if (x < y) return -1;\n if (x > y) return 1;\n if (x === x) return 1;\n if (y === y) return -1;\n return 0;\n}\n\n//Provides: caml_copysign_float const\nfunction caml_copysign_float (x, y) {\n if (y == 0) y = 1 / y;\n x = Math.abs(x);\n return (y < 0)?(-x):x;\n}\n\n//Provides: caml_expm1_float const\nfunction caml_expm1_float (x) {\n var y = Math.exp(x), z = y - 1;\n return (Math.abs(x)>1?z:(z==0?x:x*z/Math.log(y)));\n}\n\n//Provides: caml_log1p_float const\nfunction caml_log1p_float (x) {\n var y = 1 + x, z = y - 1;\n return (z==0?x:x*Math.log(y)/z);\n}\n\n//Provides: c
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n//Provides: caml_int64_offset\nvar caml_int64_offset = Math.pow(2, -24);\n\n//Provides: caml_int64_ucompare const\nfunction caml_int64_ucompare(x,y) {\n if (x[3] > y[3]) return 1;\n if (x[3] < y[3]) return -1;\n if (x[2] > y[2]) return 1;\n if (x[2] < y[2]) return -1;\n if (x[1] > y[1]) return 1;\n if (x[1] < y[1]) return -1;\n return 0;\n}\n\n//Provides: caml_int64_ult const\n//Requires: caml_int64_ucompare\nfunction caml_int64_ult(x,y) { return caml_int64_ucompare(x,y) < 0; }\n\n//Provides: caml_int64_compare const\nfunction caml_int64_compare(x,y) {\n var x3 = x[3] << 16;\n var y3 = y[3] << 16;\n if (x3 > y3) return 1;\n if (x3 < y3) return -1;\n if (x[2] > y[2]) return 1;\n if (x[2] < y[2]) return -1;\n if (x[1] > y[1]) return 1;\n if (x[1] < y[1]) return -1;\n return 0;\n}\n\n//Provides: caml_int64_neg const\nfunction caml_int64_neg (x) {\n var y1 = - x[1];\n var y2 = - x[2] + (y1 >> 24);\n var y3 = - x[3] + (y2 >> 24);\n return [255, y1 & 0xffffff, y2 & 0xffffff, y3 & 0xffff];\n}\n\n//Provides: caml_int64_add const\nfunction caml_int64_add (x, y) {\n var z1 = x[1] + y[1];\n var z2 = x[2] + y[2] + (z1 >> 24);\n var z3 = x[3] + y[3] + (z2 >> 24);\n return [255, z1 & 0xffffff, z2 & 0xffffff, z3 & 0xffff];\n}\n\n//Provides: caml_int64_sub const\nfunction caml_int64_sub (x, y) {\n var z1 = x[1] - y[1];\n var z2 = x[2] - y[2] + (z1 >> 24);\n var z3 = x[3] - y[3] + (z2 >> 24);\n return [255, z1 & 0xffffff, z2 & 0xffffff, z3 & 0xffff];\n}\n\n//Provides: caml_int64_mul const\n//Requires: caml_int64_offset\nfunction caml_int64_mul(x,y) {\n var z1 = x[1] * y[1];\n var z2 = ((z1 * caml_int64_offset) | 0) + x[2] * y[1] + x[1] * y[2];\n var z3 = ((z2 * caml_int64_offset) | 0) + x[3] * y[1] + x[2] * y[2] + x[1] * y[3];\n return [255, z1 & 0xffffff, z2 & 0xffffff, z3 & 0xffff];\n}\n\n//Provides: caml_int64_is_zero const\nfunction caml_int64_is_zero(x) {\n return (x[3]|x[2]|x[1]) == 0;\n}\n\n//Provides: caml_int64_is_negative const\nfunction caml_int64_is_negative(x) {\n return (x[3] << 16) < 0;\n}\n\n//Provides: caml_int64_is_min_int const\nfunction caml_int64_is_min_int(x) {\n return x[3] == 0x8000 && (x[1]|x[2]) == 0;\n}\n\n//Provides: caml_int64_is_minus_one const\nfunction caml_int64_is_minus_one(x) {\n return x[3] == 0xffff && (x[1]&x[2]) == 0xffffff;\n}\n\n//Provides: caml_int64_and const\nfunction caml_int64_and (x, y) {\n return [255, x[1]&y[1], x[2]&y[2], x[3]&y[3]];\n}\n\n//Provides: caml_int64_or const\nfunction caml_int64_or (x, y) {\n return [255, x[1]|y[1], x[2]|y[2], x[3]|y[3]];\n}\n\n//Provides: caml_int64_xor const\nfunction caml_int64_xor (x, y) {\n return [255, x[1]^y[1], x[2]^y[2], x[3]^y[3]];\n}\n\n//Provides: caml_int64_shift_left const\nfunction caml_int64_shift_left (x, s) {\n s = s & 63;\n if (s == 0) return x;\n if (s < 24)\n return [255,\n (x[1] << s) & 0xffffff,\n ((x[2] << s) | (x[1] >> (24 - s))) & 0xffffff,\n ((x[3] << s) | (x[2] >> (24 - s))) & 0xffff];\n if (s < 48)\n return [255, 0,\n (x[1] << (s - 24)) & 0xffffff,\n ((x[2] << (s - 24)) | (x[1] >> (48 - s))) & 0xf
|
||
|
"// Js_of_ocaml library\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n///////////// Jslib: code specific to Js_of_ocaml\n\n//Provides: caml_js_from_bool const (const)\nfunction caml_js_from_bool(x) { return !!x; }\n//Provides: caml_js_to_bool const (const)\nfunction caml_js_to_bool(x) { return +x; }\n//Provides: caml_js_from_float const (const)\nfunction caml_js_from_float(x) { return x; }\n//Provides: caml_js_to_float const (const)\nfunction caml_js_to_float(x) { return x; }\n//Provides: caml_js_from_string mutable (const)\n//Requires: MlString\nfunction caml_js_from_string(s) { return s.toString(); }\n//Provides: caml_js_from_array mutable (shallow)\n//Requires: raw_array_sub\nfunction caml_js_from_array(a) { return raw_array_sub(a,1,a.length-1); }\n//Provides: caml_js_to_array mutable (shallow)\n//Requires: raw_array_cons\nfunction caml_js_to_array(a) { return raw_array_cons(a,0); }\n\n//Provides: caml_js_var mutable (const)\n//Requires: js_print_stderr\n//Requires: MlString\nfunction caml_js_var(x) {\n var x = x.toString();\n //Checks that x has the form ident[.ident]*\n if(!x.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*(\\.[a-zA-Z_$][a-zA-Z_$0-9]*)*$/)){\n js_print_stderr(\"caml_js_var: \\\"\" + x + \"\\\" is not a valid JavaScript variable. continuing ..\");\n //joo_global_object.console.error(\"Js.Unsafe.eval_string\")\n }\n return eval(x);\n}\n//Provides: caml_js_call (const, mutable, shallow)\n//Requires: caml_js_from_array\nfunction caml_js_call(f, o, args) { return f.apply(o, caml_js_from_array(args)); }\n//Provides: caml_js_fun_call (const, shallow)\n//Requires: caml_js_from_array\nfunction caml_js_fun_call(f, args) { return f.apply(null, caml_js_from_array(args)); }\n//Provides: caml_js_meth_call (mutable, const, shallow)\n//Requires: MlString\n//Requires: caml_js_from_array\nfunction caml_js_meth_call(o, f, args) {\n return o[f.toString()].apply(o, caml_js_from_array(args));\n}\n//Provides: caml_js_new (const, shallow)\n//Requires: caml_js_from_array\nfunction caml_js_new(c, a) {\n switch (a.length) {\n case 1: return new c;\n case 2: return new c (a[1]);\n case 3: return new c (a[1],a[2]);\n case 4: return new c (a[1],a[2],a[3]);\n case 5: return new c (a[1],a[2],a[3],a[4]);\n case 6: return new c (a[1],a[2],a[3],a[4],a[5]);\n case 7: return new c (a[1],a[2],a[3],a[4],a[5],a[6]);\n case 8: return new c (a[1],a[2],a[3],a[4],a[5],a[6], a[7]);\n }\n function F() { return c.apply(this, caml_js_from_array(a)); }\n F.prototype = c.prototype;\n return new F;\n}\n//Provides: caml_js_wrap_callback const (const)\n//Requires: caml_call_gen,raw_array_copy\nfunction caml_js_wrap_callback(f) {\n return function () {\n if(arguments.length > 0){\n return caml_call_gen(f, raw_array_copy(arguments));\n } else {\n return caml_call_gen(f, [undefined]);\n }\n }\n}\n//Provides: caml_js_wrap_meth_callback const (const)\n//Requires: caml_call_gen,raw_array_cons\nfunction caml_js_wrap_meth_callback(f) {\n return function () {\n return caml_call_gen(f,raw_array_cons(arguments,this));\n }\n}\n//Provides: caml_js_wrap_meth_callback_unsafe const (const)\n//Requires: caml_call_gen,raw_array_cons\nfunction caml_js_wrap_meth_callback_unsafe(f)
|
||
|
"// Js_of_ocaml library\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n///////////// Jslib\n\n//Provides: caml_js_pure_expr const\nfunction caml_js_pure_expr (f) { return f(); }\n\n//Provides: caml_js_set (mutable, const, const)\nfunction caml_js_set(o,f,v) { o[f]=v;return 0}\n//Provides: caml_js_get mutable (const, const)\nfunction caml_js_get(o,f) { return o[f]; }\n//Provides: caml_js_delete (mutable, const)\nfunction caml_js_delete(o,f) { delete o[f]; return 0}\n\n//Provides: caml_js_instanceof (const, const)\nfunction caml_js_instanceof(o,c) { return o instanceof c; }\n\n//Provides: caml_js_typeof (const)\nfunction caml_js_typeof(o) { return typeof o; }\n\n//Provides: caml_js_on_ie const\nfunction caml_js_on_ie () {\n var ua =\n joo_global_object.navigator?joo_global_object.navigator.userAgent:\"\";\n return ua.indexOf(\"MSIE\") != -1 && ua.indexOf(\"Opera\") != 0;\n}\n\n//Provides: caml_js_html_escape const (const)\nvar caml_js_regexps = { amp:/&/g, lt:/</g, quot:/\\\"/g, all:/[&<\\\"]/ };\nfunction caml_js_html_escape (s) {\n if (!caml_js_regexps.all.test(s)) return s;\n return s.replace(caml_js_regexps.amp, \"&\")\n .replace(caml_js_regexps.lt, \"<\")\n .replace(caml_js_regexps.quot, \""\");\n}\n\n//Provides: caml_js_html_entities const (const)\nfunction caml_js_html_entities(s) {\n var str, temp = document.createElement('p');\n temp.innerHTML= s;\n str= temp.textContent || temp.innerText;\n temp=null;\n return str;\n}\n\n/////////// Debugging console\n//Provides: caml_js_get_console const\nfunction caml_js_get_console () {\n var c = joo_global_object.console?joo_global_object.console:{};\n var m = [\"log\", \"debug\", \"info\", \"warn\", \"error\", \"assert\", \"dir\", \"dirxml\",\n \"trace\", \"group\", \"groupCollapsed\", \"groupEnd\", \"time\", \"timeEnd\"];\n function f () {}\n for (var i = 0; i < m.length; i++) if (!c[m[i]]) c[m[i]]=f;\n return c;\n}\n\n//Provides:caml_trampoline\nfunction caml_trampoline(res) {\n var c = 1;\n while(res && res.joo_tramp){\n res = res.joo_tramp.apply(null, res.joo_args);\n c++;\n }\n //if(c>10) joo_global_object.console.log(\"trampoline \", c, \"times\")\n return res;\n}\n\n//Provides:caml_trampoline_return\nfunction caml_trampoline_return(f,args) {\n return {joo_tramp:f,joo_args:args};\n}\n\n//Provides: js_print_stdout (const)\nfunction js_print_stdout(s) {\n // Do not output the last \\n if present\n // as console logging display a newline at the end\n if(s.charCodeAt(s.length - 1) == 10)\n s = s.substr(0,s.length - 1 );\n var v = joo_global_object.console;\n v && v.log && v.log(s);\n}\n//Provides: js_print_stderr (const)\nfunction js_print_stderr(s) {\n // Do not output the last \\n if present\n // as console logging display a newline at the end\n if(s.charCodeAt(s.length - 1) == 10)\n s = s.substr(0,s.length - 1 );\n var v = joo_global_object.console;\n v && v.error && v.error(s);\n}\n",
|
||
|
"/***********************************************************************/\n/* */\n/* Objective Caml */\n/* */\n/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */\n/* */\n/* Copyright 1996 Institut National de Recherche en Informatique et */\n/* en Automatique. All rights reserved. This file is distributed */\n/* under the terms of the GNU Library General Public License, with */\n/* the special exception on linking described in file ../LICENSE. */\n/* */\n/***********************************************************************/\n\n/* $Id: lexing.c 6045 2004-01-01 16:42:43Z doligez $ */\n\n/* The table-driven automaton for lexers generated by camllex. */\n\n//Provides: caml_lex_array\n//Requires: caml_bytes_of_string\nfunction caml_lex_array(s) {\n s = caml_bytes_of_string(s);\n var l = s.length / 2;\n var a = new Array(l);\n for (var i = 0; i < l; i++)\n a[i] = (s.charCodeAt(2 * i) | (s.charCodeAt(2 * i + 1) << 8)) << 16 >> 16;\n return a;\n}\n\n//Provides: caml_lex_engine\n//Requires: caml_failwith, caml_lex_array, caml_array_of_string\nfunction caml_lex_engine(tbl, start_state, lexbuf) {\n var lex_buffer = 2;\n var lex_buffer_len = 3;\n var lex_start_pos = 5;\n var lex_curr_pos = 6;\n var lex_last_pos = 7;\n var lex_last_action = 8;\n var lex_eof_reached = 9;\n var lex_base = 1;\n var lex_backtrk = 2;\n var lex_default = 3;\n var lex_trans = 4;\n var lex_check = 5;\n\n if (!tbl.lex_default) {\n tbl.lex_base = caml_lex_array (tbl[lex_base]);\n tbl.lex_backtrk = caml_lex_array (tbl[lex_backtrk]);\n tbl.lex_check = caml_lex_array (tbl[lex_check]);\n tbl.lex_trans = caml_lex_array (tbl[lex_trans]);\n tbl.lex_default = caml_lex_array (tbl[lex_default]);\n }\n\n var c, state = start_state;\n\n var buffer = caml_array_of_string(lexbuf[lex_buffer]);\n\n if (state >= 0) {\n /* First entry */\n lexbuf[lex_last_pos] = lexbuf[lex_start_pos] = lexbuf[lex_curr_pos];\n lexbuf[lex_last_action] = -1;\n } else {\n /* Reentry after refill */\n state = -state - 1;\n }\n for(;;) {\n /* Lookup base address or action number for current state */\n var base = tbl.lex_base[state];\n if (base < 0) return -base-1;\n /* See if it's a backtrack point */\n var backtrk = tbl.lex_backtrk[state];\n if (backtrk >= 0) {\n lexbuf[lex_last_pos] = lexbuf[lex_curr_pos];\n lexbuf[lex_last_action] = backtrk;\n }\n /* See if we need a refill */\n if (lexbuf[lex_curr_pos] >= lexbuf[lex_buffer_len]){\n if (lexbuf[lex_eof_reached] == 0)\n return -state - 1;\n else\n c = 256;\n }else{\n /* Read next input char */\n c = buffer[lexbuf[lex_curr_pos]];\n lexbuf[lex_curr_pos] ++;\n }\n /* Determine next state */\n if (tbl.lex_check[base + c] == state)\n state = tbl.lex_trans[base + c];\n else\n state = tbl.lex_default[state];\n /* If no transition on this char, return to last backtrack point */\n if (state < 0) {\n lexbuf[lex_curr_pos] = lexbuf[lex_last_pos];\n if (lexbuf[lex_last_action] == -1)\n caml_failwith(\"lexing: empty token\");\n else\n return lexbuf[lex_last_action];\n }else{\n /* Erase the EOF condition only if the EOF pseudo-character was\n consumed by the automaton (i.e. there was no backtrack above)\n */\n if (c == 256) lexbuf[lex_eof_reached] = 0;\n }\n }\n}\n\n/***********************************************/\n/* New lexer engine, with memory of positions */\n/***********************************************/\n\n//Provides: caml_new_lex_engine\n//Requires: caml_failwith, caml_lex_array\n//Requires: caml_bytes_of_string, caml_array_of_string\nfunction caml_lex_run_m
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2010 Jérôme Vouillon\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n\n//Provides: caml_md5_chan\n//Requires: caml_md5_string, caml_string_of_array,caml_ml_string_length\nfunction caml_md5_chan(chan,len){\n if(len<0){\n len=caml_ml_string_length(chan.file.data) - chan.offset;\n }\n return caml_md5_string(chan.file.data,chan.offset,len);\n}\n\n//Provides: caml_md5_string\n//Requires: caml_string_of_array, caml_convert_string_to_bytes\nvar caml_md5_string =\nfunction () {\n function add (x, y) { return (x + y) | 0; }\n function xx(q,a,b,x,s,t) {\n a = add(add(a, q), add(x, t));\n return add((a << s) | (a >>> (32 - s)), b);\n }\n function ff(a,b,c,d,x,s,t) {\n return xx((b & c) | ((~b) & d), a, b, x, s, t);\n }\n function gg(a,b,c,d,x,s,t) {\n return xx((b & d) | (c & (~d)), a, b, x, s, t);\n }\n function hh(a,b,c,d,x,s,t) { return xx(b ^ c ^ d, a, b, x, s, t); }\n function ii(a,b,c,d,x,s,t) { return xx(c ^ (b | (~d)), a, b, x, s, t); }\n\n function md5(buffer, length) {\n var i = length;\n buffer[i >> 2] |= 0x80 << (8 * (i & 3));\n for (i = (i & ~0x3) + 8;(i & 0x3F) < 60 ;i += 4)\n buffer[(i >> 2) - 1] = 0;\n buffer[(i >> 2) -1] = length << 3;\n buffer[i >> 2] = (length >> 29) & 0x1FFFFFFF;\n\n var w = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476];\n\n for(i = 0; i < buffer.length; i += 16) {\n var a = w[0], b = w[1], c = w[2], d = w[3];\n\n a = ff(a, b, c, d, buffer[i+ 0], 7, 0xD76AA478);\n d = ff(d, a, b, c, buffer[i+ 1], 12, 0xE8C7B756);\n c = ff(c, d, a, b, buffer[i+ 2], 17, 0x242070DB);\n b = ff(b, c, d, a, buffer[i+ 3], 22, 0xC1BDCEEE);\n a = ff(a, b, c, d, buffer[i+ 4], 7, 0xF57C0FAF);\n d = ff(d, a, b, c, buffer[i+ 5], 12, 0x4787C62A);\n c = ff(c, d, a, b, buffer[i+ 6], 17, 0xA8304613);\n b = ff(b, c, d, a, buffer[i+ 7], 22, 0xFD469501);\n a = ff(a, b, c, d, buffer[i+ 8], 7, 0x698098D8);\n d = ff(d, a, b, c, buffer[i+ 9], 12, 0x8B44F7AF);\n c = ff(c, d, a, b, buffer[i+10], 17, 0xFFFF5BB1);\n b = ff(b, c, d, a, buffer[i+11], 22, 0x895CD7BE);\n a = ff(a, b, c, d, buffer[i+12], 7, 0x6B901122);\n d = ff(d, a, b, c, buffer[i+13], 12, 0xFD987193);\n c = ff(c, d, a, b, buffer[i+14], 17, 0xA679438E);\n b = ff(b, c, d, a, buffer[i+15], 22, 0x49B40821);\n\n a = gg(a, b, c, d, buffer[i+ 1], 5, 0xF61E2562);\n d = gg(d, a, b, c, buffer[i+ 6], 9, 0xC040B340);\n c = gg(c, d, a, b, buffer[i+11], 14, 0x265E5A51);\n b = gg(b, c, d, a, buffer[i+ 0], 20, 0xE9B6C7AA);\n a = gg(a, b, c, d, buffer[i+ 5], 5, 0xD62F105D);\n d = gg(d, a, b, c, buffer[i+10], 9, 0x02441453);\n c = gg(c, d, a, b, buffer[i+15], 14, 0xD8A1E681);\n b = gg(b, c, d, a, buffer[i+ 4], 20, 0xE7D3FBC8);\n a = gg(a, b, c, d, buffer[i+ 9], 5, 0x21E1CDE6);\n d = gg(d, a, b, c, buffer[i+14], 9, 0xC33707D6);\n c = gg(c, d, a, b, buffer[i+ 3], 14, 0xF4D50D87);\n b = gg(b, c, d, a, buffer[i+ 8], 20, 0x455A14ED);\n a = gg(a, b, c, d, buffer[i+13], 5, 0xA9E3E905);\n d = gg(d, a, b, c, buffer[i+ 2], 9, 0xFCEFA3F8);\n c = gg(c, d, a, b, buffer[i+ 7], 14, 0x676F02D9);\n b = gg(b, c, d, a, buffer[i+1
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2014 Jérôme Vouillon, Hugo Heuzard\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n///////////// Io\n\n//Provides: caml_sys_close\n//Requires: caml_global_data\nfunction caml_sys_close(fd) {\n delete caml_global_data.fds[fd];\n return 0;\n}\n\n//Provides: caml_sys_open\n//Requires: MlString, caml_raise_sys_error, caml_global_data,caml_sys_file_exists\n//Requires: caml_fs_register,caml_make_path,caml_fs_content\n//Requires: caml_raise_no_such_file,caml_sys_is_directory\n//Requires: caml_create_string,MlFile,caml_ml_string_length\nfunction caml_sys_open_internal(idx,file,flags) {\n if(caml_global_data.fds === undefined) caml_global_data.fds = new Array();\n flags=flags?flags:{};\n var info = {};\n info.file = file;\n info.offset = flags.append?caml_ml_string_length(file.data):0;\n info.flags = flags;\n caml_global_data.fds[idx] = info;\n caml_global_data.fd_last_idx = idx;\n return idx;\n}\nfunction caml_sys_open (name, flags, _perms) {\n var f = {};\n while(flags){\n switch(flags[1]){\n case 0: f.rdonly = 1;break;\n case 1: f.wronly = 1;break;\n case 2: f.append = 1;break;\n case 3: f.create = 1;break;\n case 4: f.truncate = 1;break;\n case 5: f.excl = 1; break;\n case 6: f.binary = 1;break;\n case 7: f.text = 1;break;\n case 8: f.nonblock = 1;break;\n }\n flags=flags[2];\n }\n var name2 = name.toString();\n var path = caml_make_path(name);\n if(f.rdonly && f.wronly)\n caml_raise_sys_error(name2 + \" : flags Open_rdonly and Open_wronly are not compatible\");\n if(f.text && f.binary)\n caml_raise_sys_error(name2 + \" : flags Open_text and Open_binary are not compatible\");\n if (caml_sys_file_exists(name)) {\n if (caml_sys_is_directory(name)) caml_raise_sys_error(name2 + \" : is a directory\");\n if (f.create && f.excl) caml_raise_sys_error(name2 + \" : file already exists\");\n var idx = caml_global_data.fd_last_idx?caml_global_data.fd_last_idx:0;\n var file = caml_fs_content(path);\n if(f.truncate) file.truncate();\n return caml_sys_open_internal (idx+1,file,f);\n } else if (f.create) {\n var idx = caml_global_data.fd_last_idx?caml_global_data.fd_last_idx:0;\n caml_fs_register(name,caml_create_string(0));\n var file = caml_fs_content(path);\n return caml_sys_open_internal (idx+1,file,f);\n }\n else caml_raise_no_such_file (name);\n}\ncaml_sys_open_internal(0,new MlFile(caml_create_string(0))); //stdin\ncaml_sys_open_internal(1,new MlFile(caml_create_string(0))); //stdout\ncaml_sys_open_internal(2,new MlFile(caml_create_string(0))); //stderr\n\n\n// ocaml Channels\n\n//Provides: caml_ml_set_channel_name\nfunction caml_ml_set_channel_name() {\n return 0\n}\n\n//Provides: caml_ml_out_channels\nvar caml_ml_out_channels = new Array();\n\n//Provides: caml_ml_out_channels_list\n//Requires: caml_ml_out_channels\nfunction caml_ml_out_channels_list () {\n var l = 0;\n for(var c in caml_ml_out_channels){\n if(caml_ml_out_channels[c].opened)\n l=[0,caml_ml_out_channels[c],l];\n }\n return l;\n}\n\n\n//Provides: caml_ml_open_descriptor_out\n//Requires: js_print_stderr, js_print_stdout, caml_ml_out_channels, caml_global_data,caml_sys_open\n//Requires: caml_raise_sys
|
||
|
"// Js_of_ocaml runtime support\n// http://www.ocsigen.org/js_of_ocaml/\n// Copyright (C) 2014 Jérôme Vouillon, Hugo Heuzard\n// Laboratoire PPS - CNRS Université Paris Diderot\n//\n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU Lesser General Public License as published by\n// the Free Software Foundation, with linking exception;\n// either version 2.1 of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\n///////////// Dummy filesystem\n\n//Provides: caml_current_dir\nvar caml_current_dir = \"/\";\n//Provides: file_inode\nvar file_inode = 0\n\n//Provides: MlDir\n//Requires: file_inode, unix_time\nfunction MlDir(){ this.content={};\n this.inode = file_inode++;\n var now = unix_time();\n this.atime = now;\n this.mtime = now;\n this.ctime = now;\n }\nMlDir.prototype = {\n exists:function(name){return this.content[name]?1:0;},\n mk:function(name,c){this.content[name]=c},\n get:function(name){return this.content[name]},\n list:function(){\n var a = [];\n for(var n in this.content)\n a.push(n);\n return a;\n },\n remove:function(name){delete this.content[name];}\n}\n\n//Provides: MlFile\n//Requires: caml_create_string, file_inode, unix_time\nfunction MlFile(content){ this.data = content;\n this.inode = file_inode++;\n var now = unix_time();\n this.atime = now;\n this.mtime = now;\n this.ctime = now;\n}\nMlFile.prototype = {\n truncate:function(){\n this.data = caml_create_string(0);\n this.modified();\n },\n modified:function() {\n var now = unix_time();\n this.atime = now;\n this.mtime = now;\n }\n}\n\n//Provides: caml_root_dir\n//Requires: MlDir\nvar caml_root_dir = new MlDir();\ncaml_root_dir.mk(\"\",new MlDir());\n\n//Provides: caml_sys_getcwd\n//Requires: caml_current_dir, caml_new_string\nfunction caml_sys_getcwd() { return caml_new_string(caml_current_dir); }\n//Provides: caml_sys_chdir\n//Requires: caml_current_dir, caml_make_path\n//Requires: caml_sys_file_exists, caml_sys_is_directory,caml_raise_no_such_file\nfunction caml_sys_chdir(dir) {\n if(caml_sys_file_exists(dir) && caml_sys_is_directory(dir)){\n var name = caml_make_path(dir);\n name.push(\"\"); // we want the slash a the end\n caml_current_dir = name.join(\"/\");\n return 0;\n }\n else\n caml_raise_no_such_file(dir);\n}\n//Provides: caml_raise_no_such_file\n//Requires: MlString, caml_raise_sys_error\nfunction caml_raise_no_such_file(name){\n name = (name instanceof MlString)?name.toString():name;\n caml_raise_sys_error (name + \": No such file or directory\");\n}\n\n//Provides: caml_raise_not_a_dir\n//Requires: MlString, caml_raise_sys_error\nfunction caml_raise_not_a_dir(name){\n name = (name instanceof MlString)?name.toString():name;\n caml_raise_sys_error (name + \": Not a directory\");\n}\n\n//Provides: caml_make_path\n//Requires: caml_current_dir,MlString\nfunction caml_make_path (name) {\n name=(name instanceof MlString)?name.toString():name;\n if(name.charCodeAt(0) != 47)\n name = caml_current_dir + name;\n var comp = name.split(\"/\");\n var ncomp = []\n for(var i = 0; i<comp.length; i++){\n switch(comp[i]){\n case \"..\": if(ncomp.length>1) ncomp.pop(); break;\n case \".\": break;\n case \"\": if(ncomp.length == 0) ncomp.push(\"\"); break;\n default: ncomp.push(comp[i]);break\n }\n }\n ncomp.ori
|
||
|
"//Provides: unix_gettimeofday\nfunction unix_gettimeofday () {\n return (new Date()).getTime() / 1000;\n}\n\n//Provides: unix_time\n//Requires: unix_gettimeofday\nfunction unix_time () {\n return Math.floor(unix_gettimeofday ());\n}\n\n//Provides: unix_gmtime\nfunction unix_gmtime (t) {\n var d = new Date (t * 1000);\n var januaryfirst = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\n var doy = Math.floor((d - januaryfirst) / 86400000);\n return [0, d.getUTCSeconds(), d.getUTCMinutes(), d.getUTCHours(),\n d.getUTCDate(), d.getUTCMonth(), d.getUTCFullYear() - 1900,\n d.getUTCDay(), doy,\n false | 0 /* for UTC daylight savings time is false */]\n}\n\n//Provides: unix_localtime\nfunction unix_localtime (t) {\n var d = new Date (t * 1000);\n var januaryfirst = new Date(d.getFullYear(), 0, 1);\n var doy = Math.floor((d - januaryfirst) / 86400000);\n var jan = new Date(d.getFullYear(), 0, 1);\n var jul = new Date(d.getFullYear(), 6, 1);\n var stdTimezoneOffset = Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());\n return [0, d.getSeconds(), d.getMinutes(), d.getHours(),\n d.getDate(), d.getMonth(), d.getFullYear() - 1900,\n d.getDay(), doy,\n (d.getTimezoneOffset() < stdTimezoneOffset) | 0 /* daylight savings time field. */]\n}\n\n//Provides: unix_mktime\n//Requires: unix_localtime\nfunction unix_mktime(tm){\n var d = new Date(tm[6]+1900,tm[5],tm[4],tm[3],tm[2],tm[1]);\n var t = Math.floor(d.getTime() / 1000);\n var tm2 = unix_localtime(t);\n return [0,t,tm2];\n}\n\n//Provides: win_startup const\nfunction win_startup() {}\n\n//Provides: win_cleanup const\nfunction win_cleanup() {}\n\n//Provides: win_handle_fd const\nfunction win_handle_fd(x) {return x;}\n"]}
|