reynir.dk/js/index.map
2023-11-14 09:20:41 +01:00

30 lines
120 KiB
Plaintext

{"version":3,
"file":"js/index.js",
"sourceRoot":"",
"names":[],
"mappings":
";;;yo0CAy3BA;UACS;;kBAEP,OAAW;IAAO,mBAA6B,UAG/C,QACF,CA12BA;UACQ;;SACN,IAAU;wBACV,QACF,CC2CA;UACQ;sBACN,8BAA8C,MAAO,iBAC/C;IACN,wBACO,aAAe,OAAmB,iBACzC,QACF,CAsLA;SAEQ;;WAAoB,MAAS,WAAc,IACjD,kBAA0B,gBAC1B,qCAGA,QACF,CA4GA;aACE,QAAc,SACd,yCACsE,YAE3D,oCACqC,4CAEzC;yBAAkD,aAE9C,oCACqC,4CAEzC,CACL,UAA2B,SACpB;MAAW,MAClB,UACE,IAAW;8BACR,CACG;EAAE,uBACR,IAAW;mBAA+B,kBAC1C,uBAGJ,QACF,CDjWA;WACQ;WACA;WACA,IACN,8BAEA,QACF,CAKA;QACE,SACE,MAAO,gBACH;WACM,WACN,MACN,QACE,MAAO,qBACJ;OACH,MAAO,IAAc,aACQ,WACR,iBAErB;mBAAqB,MAAO,MAAiB,QAAtC,CACX,CAoDA;QAA0C,YAAqB,CC3E/D;QACE,YAAc,MAAO,gBACf;IAAQ,IACd,QAAY,SACZ,OAAQ,CACN,kBAEA,QAAY,kBAGZ,QAAY,aAMhB,CAuLA;MAEE,eACS;IAED,0BAEV,CA9FA;MAEE,eAAmB,CAEjB,IAAW;mBAAwB,GAAI,mBAAuB,aAC9D,gBAEA;OAAQ,sBACZ,CAvDA;MACE,OAAW;IAAQ,YAAsB,IAAO,mBAAwB,GACjE,gBACL,OAAe,CACb,IAAW;cAA0B,uBAA6B,CAClE,UAAiB,CAAE,0BAAqC;GAC9C,aACV,QAAY,cAId,cAAyB,yBAAiC,YAExD,QAAe,WAEb,eACK,KAEL,cAAyB,yBAAiC,YAExD,QAAe,YAEb,mCACK,KAEH,cAAyB,gCACR,qBAEf,2BAMZ,OAAW,sBAGJ;WACA;GAEA,u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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_data.Sys_error, msg);\n}\n\n//Provides: caml_failwith (const)\n//Requires: caml_raise_with_string, caml_global_data\nfunction caml_failwith (msg) {\n caml_raise_with_string(caml_global_data.Failure, msg);\n}\n\n//Provides: caml_wrap_exception const (const)\n//Requires: caml_global_data,caml_js_to_string,caml_named_value\n//Requires: caml_return_exn_constant\nfunction caml_wrap_exception(e) {\n if(e instanceof Array) return e;\n //Stack_overflow: chrome, safari\n if(joo_global_object.RangeError\n && e instanceof joo_global_object.RangeError\n && e.message\n && e.message.match(/maximum call stack/i))\n return caml_return_exn_constant(caml_global_data.Stack_overflow);\n //Stack_overflow: firefox\n if(joo_global_object.InternalError\n && e instanceof joo_global_object.InternalError\n && e.message\n && e.message.match(/too much recursion/i))\n return caml_return_exn_constant(caml_global_data.Stack_overflow);\n //Wrap Error in Js.Error exception\n if(e instanceof joo_global_object.Error)\n return [0,caml_named_value(\"jsError\"),e];\n //fallback: wrapped in Failure\n return [0,caml_global_data.Failure,caml_js_to_string (String(e))];\n}\n\n//Provides: caml_invalid_argument (const)\n//Requires: caml_raise_with_string, caml_global_data\nfunction caml_invalid_argument (msg) {\n caml_raise_with_string(caml_global_data.Invalid_argument, msg);\n}\n\n//Provides: caml_raise_end_of_file\n//Requires: caml_raise_constant, caml_global_data\nfunction caml_raise_end_of_file () {\n caml_raise_constant(caml_global_data.End_of_file);\n}\n\n//Provides: caml_raise_zero_divide\n//Requires: caml_raise_constant, caml_global_data\nfunction caml_raise_zero_divide () {\n caml_raise_constant(caml_global_data.Division_by_zero);\n}\n\n//Provides: caml_raise_not_found\n//Requires: caml_raise_constant, caml_global_data\nfunction caml_raise_not_found () {\n caml_raise_constant(caml_global_data.Not_found); }\n\n\n//Provides: caml_array_bound_error\n//Requires: caml_invalid_argument\nfunction caml_array_bound_error () {\n caml_invalid_argument(\"index out of bounds\");\n}\n\n//Provides: caml_update_dummy\nfunction caml_update_dummy (x, y) {\n if( typeof y===\"function\" ) { x.fun = y; return 0; }\n if( y.fun ) { x.fun = y.fun; return 0; }\n var i = y.length; while (i--) x[i] = y[i]; return 0;\n}\n\n//Provides: caml_obj_is_block const (const)\nfunction caml_obj_is_block (x) { return +(x instanceof Array); }\n//Provides: caml_obj_tag const (const)\n//Requires: MlString\nfunction caml_obj_tag (x) { return (x instanceof Array)?x[0]:(x instanceof MlString)?252:1000; }\n//Provides: caml_obj_set_tag (mutable, const)\nfunction caml_obj_set_tag (x, tag) { x[0] = tag; return 0; }\n//Provides: caml_obj_block const (const,const)\nfunction caml_obj_block (tag, size) {\n var o = new Array(size+1);\n o[0]=tag;\n for (var i = 1; i <= size; i++) o[i] = 0;\n return o;\n}\n//Provides: caml_obj_dup mutable (const)\nfunction caml_obj_dup (x) {\n var l = x.length;\n var a = new Array(l);\n for(var i = 0; i < l; i++ ) a[i] = x[i];\n return a;\n}\n//Provides: caml_obj_truncate (mutable, const)\n//Requires: caml_invalid_argument\nfunction caml_obj_truncate (x, s) {\n if (s<=0 || s + 1 > x.length)\n caml_invalid_argument (\"Obj.truncate\");\n if (x.length != s + 1) x.length = s + 1;\n return 0;\n}\n\n//Provides: caml_lazy_make_forward const (const)\nfunction caml_lazy_make_forward (v) { return [250, v]; }\n\n//Provides: caml_mul const\nif (!Math.imul)\n Math.imul =\n function (x,y)\n { y |= 0; return ((((x >> 16) * y) << 16) + (x & 0xffff) * y)|0; };\nvar caml_mul = Math.imul;\n\n//slightly slower\n// function mul32(x,y) {\n// var xlo = x & 0xffff;\n// var xhi = x - xlo;\n// return (((xhi * y) |0) + xlo * y)|0;\n// }\n\n//Provides: caml_div\n//Requires: caml_raise_zero_divide\nfunction caml_div(x,y) {\n if (y == 0) caml_raise_zero_divide ();\n return (x/y)|0;\n}\n\n//Provides: caml_mod\n//Requires: caml_raise_zero_divide\nfunction caml_mod(x,y) {\n if (y == 0) caml_raise_zero_divide ();\n return x%y;\n}\n\n///////////// Pervasive\n//Provides: caml_array_set (mutable, const, const)\n//Requires: caml_array_bound_error\nfunction caml_array_set (array, index, newval) {\n if ((index < 0) || (index >= array.length - 1)) caml_array_bound_error();\n array[index+1]=newval; return 0;\n}\n\n//Provides: caml_array_get mutable (const, const)\n//Requires: caml_array_bound_error\nfunction caml_array_get (array, index) {\n if ((index < 0) || (index >= array.length - 1)) caml_array_bound_error();\n return array[index+1];\n}\n\n//Provides: caml_check_bound (const, const)\n//Requires: caml_array_bound_error\nfunction caml_check_bound (array, index) {\n if (index >>> 0 >= array.length - 1) caml_array_bound_error();\n return array;\n}\n\n//Provides: caml_make_vect const (const, const)\nfunction caml_make_vect (len, init) {\n var len = len + 1 | 0;\n var b = new Array(len);\n b[0]=0;\n for (var i = 1; i < len; i++) b[i] = init;\n return b;\n}\n\n//Provides: caml_make_float_vect const (const)\nfunction caml_make_float_vect(len){\n var len = len + 1 | 0;\n var b = new Array(len);\n b[0]=254;\n for (var i = 1; i < len; i++) b[i] = 0;\n return b\n}\n\n//Provides: caml_compare_val (const, const, const)\n//Requires: MlString, caml_int64_compare, caml_int_compare, caml_string_compare\n//Requires: caml_invalid_argument\nfunction caml_compare_val (a, b, total) {\n var stack = [];\n for(;;) {\n if (!(total && a === b)) {\n if (a instanceof MlString) {\n if (b instanceof MlString) {\n if (a !== b) {\n\u0009\u0009var x = caml_string_compare(a, b);\n\u0009\u0009if (x != 0) return x;\n\u0009 }\n } else\n // Should not happen\n return 1;\n } else if (a instanceof Array && a[0] === (a[0]|0)) {\n var ta = a[0];\n // ignore double_array_tag\n if (ta === 254) ta=0;\n // Forward object\n if (ta === 250) {\n a = a[1];\n continue;\n } else if (b instanceof Array && b[0] === (b[0]|0)) {\n var tb = b[0];\n // ignore double_array_tag\n if (tb === 254) tb=0;\n // Forward object\n if (tb === 250) {\n b = b[1];\n continue;\n } else if (ta != tb) {\n return (ta < tb)?-1:1;\n } else {\n switch (ta) {\n case 248: {\n\u0009\u0009// Object\n\u0009\u0009var x = caml_int_compare(a[2], b[2]);\n\u0009\u0009if (x != 0) return x;\n\u0009\u0009break;\n\u0009 }\n case 251: {\n caml_invalid_argument(\"equal: abstract value\");\n }\n case 255: {\n\u0009\u0009// Int64\n\u0009\u0009var x = caml_int64_compare(a, b);\n\u0009\u0009if (x != 0) return x;\n\u0009\u0009break;\n\u0009 }\n default:\n if (a.length != b.length) return (a.length < b.length)?-1:1;\n if (a.length > 1) stack.push(a, b, 1);\n }\n }\n } else\n return 1;\n } else if (b instanceof MlString ||\n (b instanceof Array && b[0] === (b[0]|0))) {\n return -1;\n } else if (typeof a != \"number\" && a && a.compare) {\n return a.compare(b,total);\n } else {\n if (a < b) return -1;\n if (a > b) return 1;\n if (a != b) {\n if (!total) return NaN;\n if (a == a) return 1;\n if (b == b) return -1;\n }\n }\n }\n if (stack.length == 0) return 0;\n var i = stack.pop();\n b = stack.pop();\n a = stack.pop();\n if (i + 1 < a.length) stack.push(a, b, i + 1);\n a = a[i];\n b = b[i];\n }\n}\n//Provides: caml_compare (const, const)\n//Requires: caml_compare_val\nfunction caml_compare (a, b) { return caml_compare_val (a, b, true); }\n//Provides: caml_int_compare mutable (const, const)\nfunction caml_int_compare (a, b) {\n if (a < b) return (-1); if (a == b) return 0; return 1;\n}\n//Provides: caml_equal mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_equal (x, y) { return +(caml_compare_val(x,y,false) == 0); }\n//Provides: caml_notequal mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_notequal (x, y) { return +(caml_compare_val(x,y,false) != 0); }\n//Provides: caml_greaterequal mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_greaterequal (x, y) { return +(caml_compare_val(x,y,false) >= 0); }\n//Provides: caml_greaterthan mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_greaterthan (x, y) { return +(caml_compare_val(x,y,false) > 0); }\n//Provides: caml_lessequal mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_lessequal (x, y) { return +(caml_compare_val(x,y,false) <= 0); }\n//Provides: caml_lessthan mutable (const, const)\n//Requires: caml_compare_val\nfunction caml_lessthan (x, y) { return +(caml_compare_val(x,y,false) < 0); }\n\n//Provides: caml_parse_sign_and_base\n//Requires: caml_string_unsafe_get, caml_ml_string_length\nfunction caml_parse_sign_and_base (s) {\n var i = 0, len = caml_ml_string_length(s), base = 10,\n sign = (len > 0 && caml_string_unsafe_get(s,0) == 45)?(i++,-1):1;\n if (i + 1 < len && caml_string_unsafe_get(s, i) == 48)\n switch (caml_string_unsafe_get(s, i + 1)) {\n case 120: case 88: base = 16; i += 2; break;\n case 111: case 79: base = 8; i += 2; break;\n case 98: case 66: base = 2; i += 2; break;\n }\n return [i, sign, base];\n}\n\n//Provides: caml_parse_digit\nfunction caml_parse_digit(c) {\n if (c >= 48 && c <= 57) return c - 48;\n if (c >= 65 && c <= 90) return c - 55;\n if (c >= 97 && c <= 122) return c - 87;\n return -1;\n}\n\n//Provides: caml_int_of_string (const)\n//Requires: caml_ml_string_length, caml_string_unsafe_get\n//Requires: caml_parse_sign_and_base, caml_parse_digit, caml_failwith\nfunction caml_int_of_string (s) {\n var r = caml_parse_sign_and_base (s);\n var i = r[0], sign = r[1], base = r[2];\n var len = caml_ml_string_length(s);\n var threshold = -1 >>> 0;\n var c = (i < len)?caml_string_unsafe_get(s, i):0;\n var d = caml_parse_digit(c);\n if (d < 0 || d >= base) caml_failwith(\"int_of_string\");\n var res = d;\n for (i++;i<len;i++) {\n c = caml_string_unsafe_get(s, i);\n if (c == 95) continue;\n d = caml_parse_digit(c);\n if (d < 0 || d >= base) break;\n res = base * res + d;\n if (res > threshold) caml_failwith(\"int_of_string\");\n }\n if (i != len) caml_failwith(\"int_of_string\");\n // For base different from 10, we expect an unsigned representation,\n // hence any value of 'res' (less than 'threshold') is acceptable.\n // But we have to convert the result back to a signed integer.\n res = sign * res;\n if ((base == 10) && ((res | 0) != res))\n /* Signed representation expected, allow -2^(nbits-1) to 2^(nbits-1) - 1 */\n caml_failwith(\"int_of_string\");\n return res | 0;\n}\n\n//Provides: caml_float_of_string (const)\n//Requires: caml_failwith, caml_bytes_of_string\nfunction caml_float_of_string(s) {\n var res;\n s = caml_bytes_of_string (s);\n res = +s;\n if ((s.length > 0) && (res === res)) return res;\n s = s.replace(/_/g,\"\");\n res = +s;\n if (((s.length > 0) && (res === res)) || /^[+-]?nan$/i.test(s)) return res;\n if(/^ *0x[0-9a-f_]+p[+-]?[0-9_]+/i.test(s)){\n var pidx = s.indexOf('p');\n pidx = (pidx==-1)?s.indexOf('P'):pidx;\n var exp = +s.substring(pidx + 1);\n res = +s.substring(0,pidx);\n return res * Math.pow(2,exp);\n }\n if(/^\\+?inf(inity)?$/i.test(s)) return Infinity;\n if(/^-inf(inity)?$/i.test(s)) return -Infinity;\n caml_failwith(\"float_of_string\");\n}\n\n//Provides: caml_is_printable const (const)\nfunction caml_is_printable(c) { return +(c > 31 && c < 127); }\n\n///////////// Format\n//Provides: caml_parse_format\n//Requires: caml_bytes_of_string, caml_invalid_argument\nfunction caml_parse_format (fmt) {\n fmt = caml_bytes_of_string(fmt);\n var len = fmt.length;\n if (len > 31) caml_invalid_argument(\"format_int: format too long\");\n var f =\n { justify:'+', signstyle:'-', filler:' ', alternate:false,\n base:0, signedconv:false, width:0, uppercase:false,\n sign:1, prec:-1, conv:'f' };\n for (var i = 0; i < len; i++) {\n var c = fmt.charAt(i);\n switch (c) {\n case '-':\n f.justify = '-'; break;\n case '+': case ' ':\n f.signstyle = c; break;\n case '0':\n f.filler = '0'; break;\n case '#':\n f.alternate = true; break;\n case '1': case '2': case '3': case '4': case '5':\n case '6': case '7': case '8': case '9':\n f.width = 0;\n while (c=fmt.charCodeAt(i) - 48, c >= 0 && c <= 9) {\n f.width = f.width * 10 + c; i++\n }\n i--;\n break;\n case '.':\n f.prec = 0;\n i++;\n while (c=fmt.charCodeAt(i) - 48, c >= 0 && c <= 9) {\n f.prec = f.prec * 10 + c; i++\n }\n i--;\n case 'd': case 'i':\n f.signedconv = true; /* fallthrough */\n case 'u':\n f.base = 10; break;\n case 'x':\n f.base = 16; break;\n case 'X':\n f.base = 16; f.uppercase = true; break;\n case 'o':\n f.base = 8; break;\n case 'e': case 'f': case 'g':\n f.signedconv = true; f.conv = c; break;\n case 'E': case 'F': case 'G':\n f.signedconv = true; f.uppercase = true;\n f.conv = c.toLowerCase (); break;\n }\n }\n return f;\n}\n\n//Provides: caml_finish_formatting\n//Requires: caml_new_string\nfunction caml_finish_formatting(f, rawbuffer) {\n if (f.uppercase) rawbuffer = rawbuffer.toUpperCase();\n var len = rawbuffer.length;\n /* Adjust len to reflect additional chars (sign, etc) */\n if (f.signedconv && (f.sign < 0 || f.signstyle != '-')) len++;\n if (f.alternate) {\n if (f.base == 8) len += 1;\n if (f.base == 16) len += 2;\n }\n /* Do the formatting */\n var buffer = \"\";\n if (f.justify == '+' && f.filler == ' ')\n for (var i = len; i < f.width; i++) buffer += ' ';\n if (f.signedconv) {\n if (f.sign < 0) buffer += '-';\n else if (f.signstyle != '-') buffer += f.signstyle;\n }\n if (f.alternate && f.base == 8) buffer += '0';\n if (f.alternate && f.base == 16) buffer += \"0x\";\n if (f.justify == '+' && f.filler == '0')\n for (var i = len; i < f.width; i++) buffer += '0';\n buffer += rawbuffer;\n if (f.justify == '-')\n for (var i = len; i < f.width; i++) buffer += ' ';\n return caml_new_string (buffer);\n}\n\n//Provides: caml_format_int const (const, const)\n//Requires: caml_parse_format, caml_finish_formatting, caml_str_repeat\n//Requires: caml_new_string, caml_bytes_of_string\nfunction caml_format_int(fmt, i) {\n if (caml_bytes_of_string(fmt) == \"%d\") return caml_new_string(\"\"+i);\n var f = caml_parse_format(fmt);\n if (i < 0) { if (f.signedconv) { f.sign = -1; i = -i; } else i >>>= 0; }\n var s = i.toString(f.base);\n if (f.prec >= 0) {\n f.filler = ' ';\n var n = f.prec - s.length;\n if (n > 0) s = caml_str_repeat (n, '0') + s;\n }\n return caml_finish_formatting(f, s);\n}\n\n//Provides: caml_format_float const\n//Requires: caml_parse_format, caml_finish_formatting\nfunction caml_format_float (fmt, x) {\n var s, f = caml_parse_format(fmt);\n var prec = (f.prec < 0)?6:f.prec;\n if (x < 0) { f.sign = -1; x = -x; }\n if (isNaN(x)) { s = \"nan\"; f.filler = ' '; }\n else if (!isFinite(x)) { s = \"inf\"; f.filler = ' '; }\n else\n switch (f.conv) {\n case 'e':\n var s = x.toExponential(prec);\n // exponent should be at least two digits\n var i = s.length;\n if (s.charAt(i - 3) == 'e')\n s = s.slice (0, i - 1) + '0' + s.slice (i - 1);\n break;\n case 'f':\n s = x.toFixed(prec); break;\n case 'g':\n prec = prec?prec:1;\n s = x.toExponential(prec - 1);\n var j = s.indexOf('e');\n var exp = +s.slice(j + 1);\n if (exp < -4 || x >= 1e21 || x.toFixed(0).length > prec) {\n // remove trailing zeroes\n var i = j - 1; while (s.charAt(i) == '0') i--;\n if (s.charAt(i) == '.') i--;\n s = s.slice(0, i + 1) + s.slice(j);\n i = s.length;\n if (s.charAt(i - 3) == 'e')\n s = s.slice (0, i - 1) + '0' + s.slice (i - 1);\n break;\n } else {\n var p = prec;\n if (exp < 0) { p -= exp + 1; s = x.toFixed(p); }\n else while (s = x.toFixed(p), s.length > prec + 1) p--;\n if (p) {\n // remove trailing zeroes\n var i = s.length - 1; while (s.charAt(i) == '0') i--;\n if (s.charAt(i) == '.') i--;\n s = s.slice(0, i + 1);\n }\n }\n break;\n }\n return caml_finish_formatting(f, s);\n}\n\n///////////// Hashtbl\n//Provides: caml_hash_univ_param mutable\n//Requires: MlString, caml_convert_string_to_bytes\n//Requires: caml_int64_to_bytes, caml_int64_bits_of_float\nfunction caml_hash_univ_param (count, limit, obj) {\n var hash_accu = 0;\n function hash_aux (obj) {\n limit --;\n if (count < 0 || limit < 0) return;\n if (obj instanceof Array && obj[0] === (obj[0]|0)) {\n switch (obj[0]) {\n case 248:\n // Object\n count --;\n hash_accu = (hash_accu * 65599 + obj[2]) | 0;\n break;\n case 250:\n // Forward\n limit++; hash_aux(obj); break;\n case 255:\n // Int64\n count --;\n hash_accu = (hash_accu * 65599 + obj[1] + (obj[2] << 24)) | 0;\n break;\n default:\n count --;\n hash_accu = (hash_accu * 19 + obj[0]) | 0;\n for (var i = obj.length - 1; i > 0; i--) hash_aux (obj[i]);\n }\n } else if (obj instanceof MlString) {\n count --;\n switch (obj.t & 6) {\n default: /* PARTIAL */\n caml_convert_string_to_bytes(obj);\n case 0: /* BYTES */\n for (var b = obj.c, l = obj.l, i = 0; i < l; i++)\n hash_accu = (hash_accu * 19 + b.charCodeAt(i)) | 0;\n break;\n case 2: /* ARRAY */\n for (var a = obj.c, l = obj.l, i = 0; i < l; i++)\n hash_accu = (hash_accu * 19 + a[i]) | 0;\n }\n } else if (obj === (obj|0)) {\n // Integer\n count --;\n hash_accu = (hash_accu * 65599 + obj) | 0;\n } else if (obj === +obj) {\n // Float\n count--;\n var p = caml_int64_to_bytes (caml_int64_bits_of_float (obj));\n for (var i = 7; i >= 0; i--) hash_accu = (hash_accu * 19 + p[i]) | 0;\n }\n }\n hash_aux (obj);\n return hash_accu & 0x3FFFFFFF;\n}\n\n//Provides: caml_hash mutable\n//Requires: MlString, caml_convert_string_to_bytes\n//Requires: caml_int64_bits_of_float, caml_mul\nvar caml_hash =\nfunction () {\n var HASH_QUEUE_SIZE = 256;\n function ROTL32(x,n) { return ((x << n) | (x >>> (32-n))); }\n function MIX(h,d) {\n d = caml_mul(d, 0xcc9e2d51|0);\n d = ROTL32(d, 15);\n d = caml_mul(d, 0x1b873593);\n h ^= d;\n h = ROTL32(h, 13);\n return (((h + (h << 2))|0) + (0xe6546b64|0))|0;\n }\n function FINAL_MIX(h) {\n h ^= h >>> 16;\n h = caml_mul (h, 0x85ebca6b|0);\n h ^= h >>> 13;\n h = caml_mul (h, 0xc2b2ae35|0);\n h ^= h >>> 16;\n return h;\n }\n function caml_hash_mix_int64 (h, v) {\n var lo = v[1] | (v[2] << 24);\n var hi = (v[2] >>> 8) | (v[3] << 16);\n h = MIX(h, lo);\n h = MIX(h, hi);\n return h;\n }\n function caml_hash_mix_int64_2 (h, v) {\n var lo = v[1] | (v[2] << 24);\n var hi = (v[2] >>> 8) | (v[3] << 16);\n h = MIX(h, hi ^ lo);\n return h;\n }\n function caml_hash_mix_string_str(h, s) {\n var len = s.length, i, w;\n for (i = 0; i + 4 <= len; i += 4) {\n w = s.charCodeAt(i)\n | (s.charCodeAt(i+1) << 8)\n | (s.charCodeAt(i+2) << 16)\n | (s.charCodeAt(i+3) << 24);\n h = MIX(h, w);\n }\n w = 0;\n switch (len & 3) {\n case 3: w = s.charCodeAt(i+2) << 16;\n case 2: w |= s.charCodeAt(i+1) << 8;\n case 1: w |= s.charCodeAt(i);\n h = MIX(h, w);\n default:\n }\n h ^= len;\n return h;\n }\n function caml_hash_mix_string_arr(h, s) {\n var len = s.length, i, w;\n for (i = 0; i + 4 <= len; i += 4) {\n w = s[i]\n | (s[i+1] << 8)\n | (s[i+2] << 16)\n | (s[i+3] << 24);\n h = MIX(h, w);\n }\n w = 0;\n switch (len & 3) {\n case 3: w = s[i+2] << 16;\n case 2: w |= s[i+1] << 8;\n case 1: w |= s[i];\n h = MIX(h, w);\n default:\n }\n h ^= len;\n return h;\n }\n return function (count, limit, seed, obj) {\n var queue, rd, wr, sz, num, h, v, i, len;\n sz = limit;\n if (sz < 0 || sz > HASH_QUEUE_SIZE) sz = HASH_QUEUE_SIZE;\n num = count;\n h = seed;\n queue = [obj]; rd = 0; wr = 1;\n while (rd < wr && num > 0) {\n v = queue[rd++];\n if (v instanceof Array && v[0] === (v[0]|0)) {\n switch (v[0]) {\n case 248:\n // Object\n h = MIX(h, v[2]);\n num--;\n break;\n case 250:\n // Forward\n queue[--rd] = v[1];\n break;\n case 255:\n // Int64\n h = caml_hash_mix_int64_2 (h, v);\n num --;\n break;\n default:\n var tag = ((v.length - 1) << 10) | v[0];\n h = MIX(h, tag);\n for (i = 1, len = v.length; i < len; i++) {\n if (wr >= sz) break;\n queue[wr++] = v[i];\n }\n break;\n }\n } else if (v instanceof MlString) {\n switch (v.t & 6) {\n default:\n caml_convert_string_to_bytes (v);\n case 0: /* BYTES */\n h = caml_hash_mix_string_str(h, v.c);\n break;\n case 2: /* ARRAY */\n h = caml_hash_mix_string_arr(h, v.c);\n }\n num--;\n } else if (v === (v|0)) {\n // Integer\n h = MIX(h, v+v+1);\n num--;\n } else if (v === +v) {\n // Float\n h = caml_hash_mix_int64(h, caml_int64_bits_of_float (v));\n num--;\n }\n }\n h = FINAL_MIX(h);\n return h & 0x3FFFFFFF;\n }\n} ();\n\n///////////// Sys\n//Provides: caml_sys_time mutable\nvar caml_initial_time = new Date() * 0.001;\nfunction caml_sys_time () { return new Date() * 0.001 - caml_initial_time; }\n//Provides: caml_sys_get_config const\n//Requires: caml_new_string\nfunction caml_sys_get_config () {\n return [0, caml_new_string(\"Unix\"), 32, 0];\n}\n//Provides: caml_sys_random_seed mutable\n//Version: < 4.00\n//The function needs to return an array since OCaml 4.0...\nfunction caml_sys_random_seed () {\n var x = new Date()^0xffffffff*Math.random();\n return x;\n}\n\n//Provides: caml_sys_random_seed mutable\n//Version: >= 4.00\n//The function needs to return an array since OCaml 4.0...\nfunction caml_sys_random_seed () {\n var x = new Date()^0xffffffff*Math.random();\n return [0,x];\n}\n\n\n\n//Provides: caml_sys_const_big_endian const\nfunction caml_sys_const_big_endian () { return 0; }\n//Provides: caml_sys_const_word_size const\nfunction caml_sys_const_word_size () { return 32; }\n//Provides: caml_sys_const_int_size const\nfunction caml_sys_const_int_size () { return 32; }\n\n//Provides: caml_sys_const_max_wosize const\n// max_int / 4 so that the following does not overflow\n//let max_string_length = word_size / 8 * max_array_length - 1;;\nfunction caml_sys_const_max_wosize () { return (0x7FFFFFFF/4) | 0;}\n\n//Provides: caml_sys_const_ostype_cygwin const\nfunction caml_sys_const_ostype_cygwin () { return 0; }\n//Provides: caml_sys_const_ostype_unix const\nfunction caml_sys_const_ostype_unix () { return 1; }\n//Provides: caml_sys_const_ostype_win32 const\nfunction caml_sys_const_ostype_win32 () { return 0; }\n\n//Provides: caml_sys_system_command\nfunction caml_sys_system_command(_cmd){\n return 127;\n}\n\n///////////// Array\n//Provides: caml_array_sub mutable\nfunction caml_array_sub (a, i, len) {\n var a2 = new Array(len+1);\n a2[0]=0;\n for(var i2 = 1, i1= i+1; i2 <= len; i2++,i1++ ){\n a2[i2]=a[i1];\n }\n return a2;\n}\n\n//Provides: caml_array_append mutable\nfunction caml_array_append(a1, a2) {\n var l1 = a1.length, l2 = a2.length;\n var l = l1+l2-1\n var a = new Array(l);\n a[0] = 0;\n var i = 1,j = 1;\n for(;i<l1;i++) a[i]=a1[i];\n for(;i<l;i++,j++) a[i]=a2[j];\n return a;\n}\n\n//Provides: caml_array_concat mutable\nfunction caml_array_concat(l) {\n var a = [0];\n while (l !== 0) {\n var b = l[1];\n for (var i = 1; i < b.length; i++) a.push(b[i]);\n l = l[2];\n }\n return a;\n}\n\n//Provides: caml_array_blit\nfunction caml_array_blit(a1, i1, a2, i2, len) {\n if (i2 <= i1) {\n for (var j = 1; j <= len; j++) a2[i2 + j] = a1[i1 + j];\n } else {\n for (var j = len; j >= 1; j--) a2[i2 + j] = a1[i1 + j];\n };\n return 0;\n}\n\n///////////// CamlinternalOO\n//Provides: caml_get_public_method const\nvar caml_method_cache = [];\nfunction caml_get_public_method (obj, tag, cacheid) {\n var meths = obj[1];\n var ofs = caml_method_cache[cacheid];\n if (ofs === null) {\n // Make sure the array is not sparse\n for (var i = caml_method_cache.length; i < cacheid; i++)\n caml_method_cache[i] = 0;\n } else if (meths[ofs] === tag) {\n// console.log(\"cache hit\");\n return meths[ofs - 1];\n }\n// console.log(\"cache miss\");\n var li = 3, hi = meths[1] * 2 + 1, mi;\n while (li < hi) {\n mi = ((li+hi) >> 1) | 1;\n if (tag < meths[mi+1]) hi = mi-2;\n else li = mi;\n }\n caml_method_cache[cacheid] = li + 1;\n /* return 0 if tag is not there */\n return (tag == meths[li+1] ? meths[li] : 0);\n}\n\n//Provides: caml_final_register const\nfunction caml_final_register () { return 0; }\n//Provides: caml_final_release const\nfunction caml_final_release () { return 0; }\n//Provides: caml_backtrace_status const\nfunction caml_backtrace_status () { return 0; }\n//Provides: caml_get_exception_backtrace const\nfunction caml_get_exception_backtrace () { return 0; }\n//Provides: caml_get_exception_raw_backtrace const\nfunction caml_get_exception_raw_backtrace () { return 0; }\n//Provides: caml_record_backtrace\nfunction caml_record_backtrace () { return 0; }\n//Provides: caml_convert_raw_backtrace const\nfunction caml_convert_raw_backtrace () { return 0; }\n//Provides: caml_get_current_callstack const\nfunction caml_get_current_callstack () { return 0; }\n//Provides: caml_sys_getenv\n//Requires: caml_raise_not_found\n//Requires: caml_js_to_string\nfunction caml_sys_getenv (name) {\n var g = joo_global_object;\n var n = name.toString();\n //nodejs env\n if(g.process\n && g.process.env\n && g.process.env[n] != undefined)\n return caml_js_to_string(g.process.env[n]);\n caml_raise_not_found ();\n}\n//Provides: caml_sys_exit\n//Requires: caml_invalid_argument\nfunction caml_sys_exit (code) {\n var g = joo_global_object;\n if(g.quit) g.quit(code);\n //nodejs\n if(g.process && g.process.exit) g.process.exit(code);\n caml_invalid_argument(\"Function 'exit' not implemented\");\n}\n\n//Provides: caml_sys_get_argv const\n//Requires: caml_js_to_string\n//Requires: raw_array_sub\nfunction caml_sys_get_argv () {\n var g = joo_global_object;\n var main = \"a.out\";\n var args = []\n\n if(g.process\n && g.process.argv\n && g.process.argv.length > 0) {\n var argv = g.process.argv\n //nodejs\n main = argv[1];\n args = raw_array_sub(argv,2,argv.length - 2);\n }\n\n var p = caml_js_to_string(main);\n var args2 = [0, p];\n for(var i = 0; i < args.length; i++)\n args2.push(caml_js_to_string(args[i]));\n return [0, p, args2];\n}\n\n//Provides: unix_inet_addr_of_string\nfunction unix_inet_addr_of_string () {return 0;}\n\n//Provides: caml_oo_last_id\nvar caml_oo_last_id = 0;\n\n//Provides: caml_set_oo_id\n//Requires: caml_oo_last_id\nfunction caml_set_oo_id (b) {\n b[2]=caml_oo_last_id++;\n return b;\n}\n\n//Provides: caml_fresh_oo_id\n//Requires: caml_oo_last_id\nfunction caml_fresh_oo_id() {\n return caml_oo_last_id++;\n}\n\n//Provides: caml_install_signal_handler const\nfunction caml_install_signal_handler(){return 0}\n\n\n//Provides: caml_convert_raw_backtrace_slot\n//Requires: caml_failwith\nfunction caml_convert_raw_backtrace_slot(){\n caml_failwith(\"caml_convert_raw_backtrace_slot\");\n}\n\n//Provides: caml_bswap16\nfunction caml_bswap16(x) {\n return ((((x & 0x00FF) << 8) |\n ((x & 0xFF00) >> 8)));\n}\n//Provides: caml_int32_bswap\nfunction caml_int32_bswap(x) {\n return (((x & 0x000000FF) << 24) |\n ((x & 0x0000FF00) << 8) |\n ((x & 0x00FF0000) >> 8) |\n ((x & 0xFF000000) >> 24));\n}\n//Provides: caml_int64_bswap\nfunction caml_int64_bswap(x) {\n return [\n 255,\n (((x[3] & 0x0000ff00) >> 8) |\n ((x[3] & 0x000000ff) << 8) |\n ((x[2] & 0x00ff0000))),\n (((x[2] & 0x0000ff00) >> 8) |\n ((x[2] & 0x000000ff) << 8) |\n ((x[1] & 0x00ff0000))),\n (((x[1] & 0x0000ff00) >> 8) |\n ((x[1] & 0x000000ff) << 8))]\n}\n\n//Provides: caml_list_of_js_array const (const)\nfunction caml_list_of_js_array(a){\n var l = 0;\n for(var i=a.length - 1; i>=0; i--){\n var e = a[i];\n l = [0,e,l];\n }\n return l\n}\n",
"// 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 0x80 | ((c >> 12) & 0x3f),\n 0x80 | ((c >> 6) & 0x3f),\n 0x80 | (c & 0x3f));\n }\n if (t.length > 1024) {t.substr(0, 1); b += t; t = \"\";}\n }\n return b+t;\n}\n\n//Provides: caml_utf16_of_utf8\nfunction caml_utf16_of_utf8(s) {\n for (var b = \"\", t = \"\", c, c1, c2, v, i = 0, l = s.length; i < l; i++) {\n c1 = s.charCodeAt(i);\n if (c1 < 0x80) {\n for (var j = i + 1; (j < l) && (c1 = 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 v = 1;\n if ((++i < l) && (((c2 = s.charCodeAt(i)) & -64) == 128)) {\n c = c2 + (c1 << 6);\n if (c1 < 0xe0) {\n v = c - 0x3080;\n if (v < 0x80) v = 1;\n } else {\n v = 2;\n if ((++i < l) && (((c2 = s.charCodeAt(i)) & -64) == 128)) {\n c = c2 + (c << 6);\n if (c1 < 0xf0) {\n v = c - 0xe2080;\n if ((v < 0x800) || ((v >= 0xd7ff) && (v < 0xe000))) v = 2;\n } else {\n v = 3;\n if ((++i < l) && (((c2 = s.charCodeAt(i)) & -64) == 128) &&\n (c1 < 0xf5)) {\n v = c2 - 0x3c82080 + (c << 6);\n if (v < 0x10000 || v > 0x10ffff) v = 3;\n }\n }\n }\n }\n }\n if (v < 4) { // Invalid sequence\n i -= v;\n t += \"\\ufffd\";\n } else if (v > 0xffff)\n t += String.fromCharCode(0xd7c0 + (v >> 10), 0xdc00 + (v & 0x3FF))\n else\n t += String.fromCharCode(v);\n if (t.length > 1024) {t.substr(0, 1); b += t; t = \"\";}\n }\n return b+t;\n}\n\n//Provides: caml_is_ascii\nfunction caml_is_ascii (s) {\n // The regular expression gets better at around this point for all browsers\n if (s.length < 24) {\n // Spidermonkey gets much slower when s.length >= 24 (on 64 bit archs)\n for (var i = 0; i < s.length; i++) if (s.charCodeAt(i) > 127) return false;\n return true;\n } else\n return !/[^\\x00-\\x7f]/.test(s);\n}\n\n//Provides: caml_to_js_string\n//Requires: caml_convert_string_to_bytes, caml_is_ascii, caml_utf16_of_utf8\nfunction caml_to_js_string(s) {\n switch (s.t) {\n case 9: /*BYTES | ASCII*/\n return s.c;\n default:\n caml_convert_string_to_bytes(s);\n case 0: /*BYTES | UNKOWN*/\n if (caml_is_ascii(s.c)) {\n s.t = 9; /*BYTES | ASCII*/\n return s.c;\n }\n s.t = 8; /*BYTES | NOT_ASCII*/\n case 8: /*BYTES | NOT_ASCII*/\n return caml_utf16_of_utf8(s.c);\n }\n}\n\n//Provides: caml_string_unsafe_get mutable\nfunction caml_string_unsafe_get (s, i) {\n switch (s.t & 6) {\n default: /* PARTIAL */\n if (i >= s.c.length) return 0;\n case 0: /* BYTES */\n return s.c.charCodeAt(i);\n case 4: /* ARRAY */\n return s.c[i]\n }\n}\n\n//Provides: caml_string_unsafe_set\n//Requires: caml_convert_string_to_array\nfunction caml_string_unsafe_set (s, i, c) {\n // The OCaml compiler uses Char.unsafe_chr on integers larger than 255!\n c &= 0xff;\n if (s.t != 4 /* ARRAY */) {\n if (i == s.c.length) {\n s.c += String.fromCharCode (c);\n if (i + 1 == s.l) s.t = 0; /*BYTES | UNKOWN*/\n return 0;\n }\n caml_convert_string_to_array (s);\n }\n s.c[i] = c;\n return 0;\n}\n\n//Provides: caml_string_bound_error\n//Requires: caml_invalid_argument\nfunction caml_string_bound_error () {\n caml_invalid_argument (\"index out of bounds\");\n}\n\n//Provides: caml_string_get mutable\n//Requires: caml_string_bound_error, caml_string_unsafe_get\nfunction caml_string_get (s, i) {\n if (i >>> 0 >= s.l) caml_string_bound_error();\n return caml_string_unsafe_get (s, i);\n}\n\n//Provides: caml_string_set\n//Requires: caml_string_bound_error, caml_string_unsafe_set\nfunction caml_string_set (s, i, c) {\n if (i >>> 0 >= s.l) caml_string_bound_error();\n return caml_string_unsafe_set (s, i, c);\n}\n\n//Provides: MlString\n//Requires: caml_to_js_string\nfunction MlString (tag, contents, length) {\n this.t=tag; this.c=contents; this.l=length;\n}\nMlString.prototype.toString = function(){return caml_to_js_string(this)};\n\n//Provides: caml_convert_string_to_bytes\n//Requires: caml_str_repeat, caml_subarray_to_string\nfunction caml_convert_string_to_bytes (s) {\n /* Assumes not BYTES */\n if (s.t == 2 /* PARTIAL */)\n s.c += caml_str_repeat(s.l - s.c.length, '\\0')\n else\n s.c = caml_subarray_to_string (s.c, 0, s.c.length);\n s.t = 0; /*BYTES | UNKOWN*/\n}\n\n//Provides: caml_convert_string_to_array\nfunction caml_convert_string_to_array (s) {\n /* Assumes not ARRAY */\n var a = new Array(s.l), b = s.c, l = b.length, i = 0;\n for (; i < l; i++) a[i] = b.charCodeAt(i);\n for (l = s.l; i < l; i++) a[i] = 0;\n s.c = a;\n s.t = 4; /* ARRAY */\n return a;\n}\n\n//Provides: caml_array_of_string mutable\n//Requires: caml_convert_string_to_array\nfunction caml_array_of_string (s) {\n if (s.t != 4 /* ARRAY */) caml_convert_string_to_array(s);\n return s.c;\n}\n\n//Provides: caml_bytes_of_string mutable\n//Requires: caml_convert_string_to_bytes\nfunction caml_bytes_of_string (s) {\n if ((s.t & 6) != 0 /* BYTES */) caml_convert_string_to_bytes(s);\n return s.c;\n}\n\n//Provides: caml_js_to_string const\n//Requires: caml_is_ascii, caml_utf8_of_utf16, MlString\nfunction caml_js_to_string (s) {\n var tag = 9 /* BYTES | ASCII */;\n if (!caml_is_ascii(s))\n tag = 8 /* BYTES | NOT_ASCII */, s = caml_utf8_of_utf16(s);\n return new MlString(tag, s, s.length);\n}\n\n//Provides: caml_create_string const\n//Requires: MlString,caml_invalid_argument\nfunction caml_create_string(len) {\n if (len < 0) caml_invalid_argument(\"String.create\");\n return new MlString(len?2:9,\"\",len);\n}\n//Provides: caml_new_string\n//Requires: MlString\nfunction caml_new_string (s) { return new MlString(0,s,s.length); }\n//Provides: caml_string_of_array\n//Requires: MlString\nfunction caml_string_of_array (a) { return new MlString(4,a,a.length); }\n\n//Provides: caml_string_compare mutable\n//Requires: caml_convert_string_to_bytes\nfunction caml_string_compare(s1, s2) {\n (s1.t & 6) && caml_convert_string_to_bytes(s1);\n (s2.t & 6) && caml_convert_string_to_bytes(s2);\n return (s1.c < s2.c)?-1:(s1.c > s2.c)?1:0;\n}\n\n//Provides: caml_string_equal mutable\n//Requires: caml_convert_string_to_bytes\nfunction caml_string_equal(s1, s2) {\n (s1.t & 6) && caml_convert_string_to_bytes(s1);\n (s2.t & 6) && caml_convert_string_to_bytes(s2);\n return (s1.c == s2.c)?1:0;\n}\n\n//Provides: caml_string_notequal mutable\n//Requires: caml_string_equal\nfunction caml_string_notequal(s1, s2) { return 1-caml_string_equal(s1, s2); }\n\n//Provides: caml_string_lessequal mutable\n//Requires: caml_convert_string_to_bytes\nfunction caml_string_lessequal(s1, s2) {\n (s1.t & 6) && caml_convert_string_to_bytes(s1);\n (s2.t & 6) && caml_convert_string_to_bytes(s2);\n return (s1.c <= s2.c)?1:0;\n}\n\n//Provides: caml_string_lessthan mutable\n//Requires: caml_convert_string_to_bytes\nfunction caml_string_lessthan(s1, s2) {\n (s1.t & 6) && caml_convert_string_to_bytes(s1);\n (s2.t & 6) && caml_convert_string_to_bytes(s2);\n return (s1.c < s2.c)?1:0;\n}\n\n//Provides: caml_string_greaterequal\n//Requires: caml_string_lessequal\nfunction caml_string_greaterequal(s1, s2) {\n return caml_string_lessequal(s2,s1);\n}\n\n//Provides: caml_string_greaterthan\n//Requires: caml_string_lessthan\nfunction caml_string_greaterthan(s1, s2) {\n return caml_string_lessthan(s2, s1);\n}\n\n//Provides: caml_fill_string\n//Requires: caml_str_repeat, caml_convert_string_to_array\nfunction caml_fill_string(s, i, l, c) {\n if (l > 0) {\n if (i == 0 && (l >= s.l || (s.t == 2 /* PARTIAL */ && l >= s.c.length))) {\n if (c == 0) {\n s.c = \"\";\n s.t = 2; /* PARTIAL */\n } else {\n s.c = caml_str_repeat (l, String.fromCharCode(c));\n s.t = (l == s.l)?0 /* BYTES | UNKOWN */ :2; /* PARTIAL */\n }\n } else {\n if (s.t != 4 /* ARRAY */) caml_convert_string_to_array(s);\n for (l += i; i < l; i++) s.c[i] = c;\n }\n }\n return 0;\n}\n\n//Provides: caml_blit_string\n//Requires: caml_subarray_to_string, caml_convert_string_to_array\nfunction caml_blit_string(s1, i1, s2, i2, len) {\n if (len == 0) return 0;\n if ((i2 == 0) &&\n (len >= s2.l || (s2.t == 2 /* PARTIAL */ && len >= s2.c.length))) {\n s2.c = (s1.t == 4 /* ARRAY */)?\n caml_subarray_to_string(s1.c, i1, len):\n (i1 == 0 && s1.c.length == len)?s1.c:s1.c.substr(i1, len);\n s2.t = (s2.c.length == s2.l)?0 /* BYTES | UNKOWN */ :2; /* PARTIAL */\n } else if (s2.t == 2 /* PARTIAL */ && i2 == s2.c.length) {\n s2.c += (s1.t == 4 /* ARRAY */)?\n caml_subarray_to_string(s1.c, i1, len):\n (i1 == 0 && s1.c.length == len)?s1.c:s1.c.substr(i1, len);\n s2.t = (s2.c.length == s2.l)?0 /* BYTES | UNKOWN */ :2; /* PARTIAL */\n } else {\n if (s2.t != 4 /* ARRAY */) caml_convert_string_to_array(s2);\n var c1 = s1.c, c2 = s2.c;\n if (s1.t == 4 /* ARRAY */)\n for (var i = 0; i < len; i++) c2 [i2 + i] = c1 [i1 + i];\n else {\n var l = Math.min (len, c1.length - i1);\n for (var i = 0; i < l; i++) c2 [i2 + i] = c1.charCodeAt(i1 + i);\n for (; i < len; i++) c2 [i2 + i] = 0;\n }\n }\n return 0;\n}\n\n//Provides: caml_ml_string_length const\nfunction caml_ml_string_length(s) { return s.l }\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: caml_hypot_float const\nfunction caml_hypot_float (x, y) {\n var x = Math.abs(x), y = Math.abs(y);\n var a = Math.max(x, y), b = Math.min(x,y) / (a?a:1);\n return (a * Math.sqrt(1 + b*b));\n}\n\n// FIX: these five functions only give approximate results.\n//Provides: caml_log10_float const\nfunction caml_log10_float (x) { return Math.LOG10E * Math.log(x); }\n//Provides: caml_cosh_float const\nfunction caml_cosh_float (x) { return (Math.exp(x) + Math.exp(-x)) / 2; }\n//Provides: caml_sinh_float const\nfunction caml_sinh_float (x) { return (Math.exp(x) - Math.exp(-x)) / 2; }\n//Provides: caml_tanh_float const\nfunction caml_tanh_float (x) {\n var y = Math.exp(x), z = Math.exp(-x);\n return (y + z) / (y - z);\n}\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_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))) & 0xffff];\n return [255, 0, 0, (x[1] << (s - 48)) & 0xffff];\n}\n\n//Provides: caml_int64_shift_right_unsigned const\nfunction caml_int64_shift_right_unsigned (x, s) {\n s = s & 63;\n if (s == 0) return x;\n if (s < 24)\n return [255,\n ((x[1] >> s) | (x[2] << (24 - s))) & 0xffffff,\n ((x[2] >> s) | (x[3] << (24 - s))) & 0xffffff,\n (x[3] >> s)];\n if (s < 48)\n return [255,\n ((x[2] >> (s - 24)) | (x[3] << (48 - s))) & 0xffffff,\n (x[3] >> (s - 24)),\n 0];\n return [255, (x[3] >> (s - 48)), 0, 0];\n}\n\n//Provides: caml_int64_shift_right const\nfunction caml_int64_shift_right (x, s) {\n s = s & 63;\n if (s == 0) return x;\n var h = (x[3] << 16) >> 16;\n if (s < 24)\n return [255,\n ((x[1] >> s) | (x[2] << (24 - s))) & 0xffffff,\n ((x[2] >> s) | (h << (24 - s))) & 0xffffff,\n ((x[3] << 16) >> s) >>> 16];\n var sign = (x[3] << 16) >> 31;\n if (s < 48)\n return [255,\n ((x[2] >> (s - 24)) | (x[3] << (48 - s))) & 0xffffff,\n ((x[3] << 16) >> (s - 24) >> 16) & 0xffffff,\n sign & 0xffff];\n return [255,\n ((x[3] << 16) >> (s - 32)) & 0xffffff,\n sign & 0xffffff, sign & 0xffff];\n}\n\n//Provides: caml_int64_lsl1 const\nfunction caml_int64_lsl1 (x) {\n x[3] = (x[3] << 1) | (x[2] >> 23);\n x[2] = ((x[2] << 1) | (x[1] >> 23)) & 0xffffff;\n x[1] = (x[1] << 1) & 0xffffff;\n}\n\n//Provides: caml_int64_lsr1 const\nfunction caml_int64_lsr1 (x) {\n x[1] = ((x[1] >>> 1) | (x[2] << 23)) & 0xffffff;\n x[2] = ((x[2] >>> 1) | (x[3] << 23)) & 0xffffff;\n x[3] = x[3] >>> 1;\n}\n\n//Provides: caml_int64_udivmod const\n//Requires: caml_int64_ucompare, caml_int64_lsl1, caml_int64_lsr1\n//Requires: caml_int64_sub\n//Requires: caml_obj_dup\nfunction caml_int64_udivmod (x, y) {\n var offset = 0;\n var modulus = caml_obj_dup(x);\n var divisor = caml_obj_dup(y);\n var quotient = [255, 0, 0, 0];\n while (caml_int64_ucompare (modulus, divisor) > 0) {\n offset++;\n caml_int64_lsl1 (divisor);\n }\n while (offset >= 0) {\n offset --;\n caml_int64_lsl1 (quotient);\n if (caml_int64_ucompare (modulus, divisor) >= 0) {\n quotient[1] ++;\n modulus = caml_int64_sub (modulus, divisor);\n }\n caml_int64_lsr1 (divisor);\n }\n return [0,quotient, modulus];\n}\n\n//Provides: caml_int64_div const\n//Requires: caml_int64_is_zero, caml_raise_zero_divide\n//Requires: caml_int64_neg, caml_int64_udivmod\nfunction caml_int64_div (x, y)\n{\n if (caml_int64_is_zero (y)) caml_raise_zero_divide ();\n var sign = x[3] ^ y[3];\n if (x[3] & 0x8000) x = caml_int64_neg(x);\n if (y[3] & 0x8000) y = caml_int64_neg(y);\n var q = caml_int64_udivmod(x, y)[1];\n if (sign & 0x8000) q = caml_int64_neg(q);\n return q;\n}\n\n//Provides: caml_int64_mod const\n//Requires: caml_int64_is_zero, caml_raise_zero_divide\n//Requires: caml_int64_neg, caml_int64_udivmod\nfunction caml_int64_mod (x, y)\n{\n if (caml_int64_is_zero (y)) caml_raise_zero_divide ();\n var sign = x[3] ^ y[3];\n if (x[3] & 0x8000) x = caml_int64_neg(x);\n if (y[3] & 0x8000) y = caml_int64_neg(y);\n var r = caml_int64_udivmod(x, y)[2];\n if (sign & 0x8000) r = caml_int64_neg(r);\n return r;\n}\n\n//Provides: caml_int64_of_int32 const\nfunction caml_int64_of_int32 (x) {\n return [255, x & 0xffffff, (x >> 24) & 0xffffff, (x >> 31) & 0xffff]\n}\n\n//Provides: caml_int64_to_int32 const\nfunction caml_int64_to_int32 (x) {\n return x[1] | (x[2] << 24);\n}\n\n//Provides: caml_int64_to_float const\nfunction caml_int64_to_float (x) {\n return ((x[3] << 16) * Math.pow(2, 32) + x[2] * Math.pow(2, 24)) + x[1];\n}\n\n//Provides: caml_int64_of_float const\n//Requires: caml_int64_offset\nfunction caml_int64_of_float (x) {\n if (x < 0) x = Math.ceil(x);\n return [255,\n x & 0xffffff,\n Math.floor(x * caml_int64_offset) & 0xffffff,\n Math.floor(x * caml_int64_offset * caml_int64_offset) & 0xffff];\n}\n\n//Provides: caml_int64_format const\n//Requires: caml_parse_format, caml_finish_formatting\n//Requires: caml_int64_is_negative, caml_int64_neg\n//Requires: caml_int64_of_int32, caml_int64_udivmod, caml_int64_to_int32\n//Requires: caml_int64_is_zero, caml_str_repeat\nfunction caml_int64_format (fmt, x) {\n var f = caml_parse_format(fmt);\n if (f.signedconv && caml_int64_is_negative(x)) {\n f.sign = -1; x = caml_int64_neg(x);\n }\n var buffer = \"\";\n var wbase = caml_int64_of_int32(f.base);\n var cvtbl = \"0123456789abcdef\";\n do {\n var p = caml_int64_udivmod(x, wbase);\n x = p[1];\n buffer = cvtbl.charAt(caml_int64_to_int32(p[2])) + buffer;\n } while (! caml_int64_is_zero(x));\n if (f.prec >= 0) {\n f.filler = ' ';\n var n = f.prec - buffer.length;\n if (n > 0) buffer = caml_str_repeat (n, '0') + buffer;\n }\n return caml_finish_formatting(f, buffer);\n}\n\n//Provides: caml_int64_of_string\n//Requires: caml_parse_sign_and_base, caml_failwith, caml_parse_digit, MlString\n//Requires: caml_int64_of_int32, caml_int64_udivmod, caml_int64_ult\n//Requires: caml_int64_add, caml_int64_mul, caml_int64_neg\n//Requires: caml_ml_string_length,caml_string_unsafe_get\nfunction caml_int64_of_string(s) {\n var r = caml_parse_sign_and_base (s);\n var i = r[0], sign = r[1], base = r[2];\n var base64 = caml_int64_of_int32(base);\n var threshold =\n caml_int64_udivmod([255, 0xffffff, 0xfffffff, 0xffff], base64)[1];\n var c = caml_string_unsafe_get(s, i);\n var d = caml_parse_digit(c);\n if (d < 0 || d >= base) caml_failwith(\"int_of_string\");\n var res = caml_int64_of_int32(d);\n for (;;) {\n i++;\n c = caml_string_unsafe_get(s, i);\n if (c == 95) continue;\n d = caml_parse_digit(c);\n if (d < 0 || d >= base) break;\n /* Detect overflow in multiplication base * res */\n if (caml_int64_ult(threshold, res)) caml_failwith(\"int_of_string\");\n d = caml_int64_of_int32(d);\n res = caml_int64_add(caml_int64_mul(base64, res), d);\n /* Detect overflow in addition (base * res) + d */\n if (caml_int64_ult(res, d)) caml_failwith(\"int_of_string\");\n }\n if (i != caml_ml_string_length(s)) caml_failwith(\"int_of_string\");\n if (r[2] == 10 && caml_int64_ult([255, 0, 0, 0x8000], res))\n caml_failwith(\"int_of_string\");\n if (sign < 0) res = caml_int64_neg(res);\n return res;\n}\n\n//Provides: caml_int64_of_bytes\nfunction caml_int64_of_bytes(a) {\n return [255, a[7] | (a[6] << 8) | (a[5] << 16),\n a[4] | (a[3] << 8) | (a[2] << 16), a[1] | (a[0] << 8)];\n}\n//Provides: caml_int64_to_bytes\nfunction caml_int64_to_bytes(x) {\n return [x[3] >> 8, x[3] & 0xff, x[2] >> 16, (x[2] >> 8) & 0xff, x[2] & 0xff,\n x[1] >> 16, (x[1] >> 8) & 0xff, x[1] & 0xff];\n}\n",
"// 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) {\n return function () { f.apply(null, raw_array_cons(arguments,this)); }\n}\n//Provides: caml_js_equals mutable (const, const)\nfunction caml_js_equals (x, y) { return +(x == y); }\n//Provides: caml_js_to_byte_string const\n//Requires: caml_new_string\nfunction caml_js_to_byte_string (s) {return caml_new_string (s);}\n\n//Provides: caml_js_eval_string (const)\n//Requires: MlString\nfunction caml_js_eval_string (s) {return eval(s.toString());}\n\n//Provides: caml_js_expr (const)\n//Requires: js_print_stderr\n//Requires: MlString\nfunction caml_js_expr(s) {\n js_print_stderr(\"caml_js_expr: fallback to runtime evaluation\");\n return eval(s.toString());}\n\n//Provides: caml_pure_js_expr const (const)\n//Requires: js_print_stderr\n//Requires: MlString\nfunction caml_pure_js_expr (s){\n js_print_stderr(\"caml_pure_js_expr: fallback to runtime evaluation\");\n return eval(s.toString());}\n\n//Provides: caml_js_object (object_literal)\n//Requires: MlString\nfunction caml_js_object (a) {\n var o = {};\n for (var i = 1; i < a.length; i++) {\n var p = a[i];\n o[p[1].toString()] = p[2];\n }\n return o;\n}\n",
"// 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, \"&amp;\")\n .replace(caml_js_regexps.lt, \"&lt;\")\n .replace(caml_js_regexps.quot, \"&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_mem(s, i, mem, curr_pos) {\n for (;;) {\n var dst = s.charCodeAt(i); i++;\n if (dst == 0xff) return;\n var src = s.charCodeAt(i); i++;\n if (src == 0xff)\n mem [dst + 1] = curr_pos;\n else\n mem [dst + 1] = mem [src + 1];\n }\n}\n\nfunction caml_lex_run_tag(s, i, mem) {\n for (;;) {\n var dst = s.charCodeAt(i); i++;\n if (dst == 0xff) return ;\n var src = s.charCodeAt(i); i++;\n if (src == 0xff)\n mem [dst + 1] = -1;\n else\n mem [dst + 1] = mem [src + 1];\n }\n}\n\nfunction caml_new_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_mem = 10;\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 var lex_base_code = 6;\n var lex_backtrk_code = 7;\n var lex_default_code = 8;\n var lex_trans_code = 9;\n var lex_check_code = 10;\n var lex_code = 11;\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 if (!tbl.lex_default_code) {\n tbl.lex_base_code = caml_lex_array (tbl[lex_base_code]);\n tbl.lex_backtrk_code = caml_lex_array (tbl[lex_backtrk_code]);\n tbl.lex_check_code = caml_lex_array (tbl[lex_check_code]);\n tbl.lex_trans_code = caml_lex_array (tbl[lex_trans_code]);\n tbl.lex_default_code = caml_lex_array (tbl[lex_default_code]);\n }\n if (tbl.lex_code == null) tbl.lex_code = caml_bytes_of_string(tbl[lex_code]);\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) {\n var pc_off = tbl.lex_base_code[state];\n caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]);\n return -base-1;\n }\n /* See if it's a backtrack point */\n var backtrk = tbl.lex_backtrk[state];\n if (backtrk >= 0) {\n var pc_off = tbl.lex_backtrk_code[state];\n caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]);\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 var pstate = 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 /* If some transition, get and perform memory moves */\n var base_code = tbl.lex_base_code[pstate], pc_off;\n if (tbl.lex_check_code[base_code + c] == pstate)\n pc_off = tbl.lex_trans_code[base_code + c];\n else\n pc_off = tbl.lex_default_code[pstate];\n if (pc_off > 0)\n caml_lex_run_mem\n (tbl.lex_code, pc_off, lexbuf[lex_mem], lexbuf[lex_curr_pos]);\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",
"// 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+12], 20, 0x8D2A4C8A);\n\n a = hh(a, b, c, d, buffer[i+ 5], 4, 0xFFFA3942);\n d = hh(d, a, b, c, buffer[i+ 8], 11, 0x8771F681);\n c = hh(c, d, a, b, buffer[i+11], 16, 0x6D9D6122);\n b = hh(b, c, d, a, buffer[i+14], 23, 0xFDE5380C);\n a = hh(a, b, c, d, buffer[i+ 1], 4, 0xA4BEEA44);\n d = hh(d, a, b, c, buffer[i+ 4], 11, 0x4BDECFA9);\n c = hh(c, d, a, b, buffer[i+ 7], 16, 0xF6BB4B60);\n b = hh(b, c, d, a, buffer[i+10], 23, 0xBEBFBC70);\n a = hh(a, b, c, d, buffer[i+13], 4, 0x289B7EC6);\n d = hh(d, a, b, c, buffer[i+ 0], 11, 0xEAA127FA);\n c = hh(c, d, a, b, buffer[i+ 3], 16, 0xD4EF3085);\n b = hh(b, c, d, a, buffer[i+ 6], 23, 0x04881D05);\n a = hh(a, b, c, d, buffer[i+ 9], 4, 0xD9D4D039);\n d = hh(d, a, b, c, buffer[i+12], 11, 0xE6DB99E5);\n c = hh(c, d, a, b, buffer[i+15], 16, 0x1FA27CF8);\n b = hh(b, c, d, a, buffer[i+ 2], 23, 0xC4AC5665);\n\n a = ii(a, b, c, d, buffer[i+ 0], 6, 0xF4292244);\n d = ii(d, a, b, c, buffer[i+ 7], 10, 0x432AFF97);\n c = ii(c, d, a, b, buffer[i+14], 15, 0xAB9423A7);\n b = ii(b, c, d, a, buffer[i+ 5], 21, 0xFC93A039);\n a = ii(a, b, c, d, buffer[i+12], 6, 0x655B59C3);\n d = ii(d, a, b, c, buffer[i+ 3], 10, 0x8F0CCC92);\n c = ii(c, d, a, b, buffer[i+10], 15, 0xFFEFF47D);\n b = ii(b, c, d, a, buffer[i+ 1], 21, 0x85845DD1);\n a = ii(a, b, c, d, buffer[i+ 8], 6, 0x6FA87E4F);\n d = ii(d, a, b, c, buffer[i+15], 10, 0xFE2CE6E0);\n c = ii(c, d, a, b, buffer[i+ 6], 15, 0xA3014314);\n b = ii(b, c, d, a, buffer[i+13], 21, 0x4E0811A1);\n a = ii(a, b, c, d, buffer[i+ 4], 6, 0xF7537E82);\n d = ii(d, a, b, c, buffer[i+11], 10, 0xBD3AF235);\n c = ii(c, d, a, b, buffer[i+ 2], 15, 0x2AD7D2BB);\n b = ii(b, c, d, a, buffer[i+ 9], 21, 0xEB86D391);\n\n w[0] = add(a, w[0]);\n w[1] = add(b, w[1]);\n w[2] = add(c, w[2]);\n w[3] = add(d, w[3]);\n }\n\n var t = new Array(16);\n for (var i = 0; i < 4; i++)\n for (var j = 0; j < 4; j++)\n t[i * 4 + j] = (w[i] >> (8 * j)) & 0xFF;\n return t;\n }\n\n return function (s, ofs, len) {\n // FIX: maybe we should perform the computation by chunk of 64 bytes\n // as in http://www.myersdaily.org/joseph/javascript/md5.js\n var buf = [];\n switch (s.t & 6) {\n default:\n caml_convert_string_to_bytes(s);\n case 0: /* BYTES */\n var b = s.c;\n for (var i = 0; i < len; i+=4) {\n var j = i + ofs;\n buf[i>>2] =\n b.charCodeAt(j) | (b.charCodeAt(j+1) << 8) |\n (b.charCodeAt(j+2) << 16) | (b.charCodeAt(j+3) << 24);\n }\n for (; i < len; i++) buf[i>>2] |= b.charCodeAt(i + ofs) << (8 * (i & 3));\n break;\n case 4: /* ARRAY */\n var a = s.c;\n for (var i = 0; i < len; i+=4) {\n var j = i + ofs;\n buf[i>>2] = a[j] | (a[j+1] << 8) | (a[j+2] << 16) | (a[j+3] << 24);\n }\n for (; i < len; i++) buf[i>>2] |= a[i + ofs] << (8 * (i & 3));\n }\n return caml_string_of_array(md5(buf, len));\n }\n} ();\n",
"// 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_error,caml_new_string\n//Requires: caml_create_string, caml_blit_string,caml_ml_string_length\nfunction caml_std_output(chan,s){\n var str = caml_new_string(s);\n var slen = caml_ml_string_length(str);\n var clen = caml_ml_string_length(chan.file.data);\n var offset = chan.offset;\n if(offset + slen >= clen) {\n var new_str = caml_create_string (offset + slen);\n caml_blit_string(chan.file.data, 0, new_str, 0, clen);\n caml_blit_string(str, 0, new_str, offset, slen);\n chan.file.data = new_str;\n }\n chan.offset += slen;\n chan.file.modified();\n return 0;\n}\n\nfunction caml_ml_open_descriptor_out (fd) {\n var output;\n switch(fd){\n case 1: output=js_print_stdout;break;\n case 2: output=js_print_stderr;break;\n default: output=caml_std_output;\n }\n var data = caml_global_data.fds[fd];\n if(data.flags.rdonly) caml_raise_sys_error(\"fd \"+ fd + \" is readonly\");\n var channel = {\n file:data.file,\n offset:data.offset,\n fd:fd,\n opened:true,\n\n buffer:\"\",\n output : output\n };\n caml_ml_out_channels[channel.fd]=channel;\n return channel;\n}\n\n//Provides: caml_ml_open_descriptor_in\n//Requires: caml_global_data,caml_sys_open,caml_raise_sys_error\nfunction caml_ml_open_descriptor_in (fd) {\n var data = caml_global_data.fds[fd];\n if(data.flags.wronly) caml_raise_sys_error(\"fd \"+ fd + \" is writeonly\");\n\n return {\n file:data.file,\n offset:data.offset,\n fd:fd,\n opened:true,\n refill:null\n };\n}\n\n\n//Provides: caml_ml_set_binary_mode\n//Requires: caml_global_data\nfunction caml_ml_set_binary_mode(chan,mode){\n var data = caml_global_data.fds[chan.fd];\n data.flags.text = !mode\n data.flags.binary = mode\n return 0;\n}\n\n//Input from in_channel\n\n//Provides: caml_ml_close_channel\n//Requires: caml_ml_flush, caml_ml_out_channels\n//Requires: caml_sys_close\nfunction caml_ml_close_channel (channel) {\n caml_ml_flush(channel);\n channel.opened = false;\n delete caml_ml_out_channels[channel.fd];\n caml_sys_close(channel.fd)\n return 0;\n}\n\n//Provides: caml_ml_channel_size\n//Requires: caml_ml_string_length\nfunction caml_ml_channel_size(chan) {\n return caml_ml_string_length(chan.file.data);\n}\n\n//Provides: caml_ml_channel_size_64\n//Requires: caml_ml_channel_size,caml_int64_of_float,caml_ml_string_length\nfunction caml_ml_channel_size_64(chan) {\n return caml_int64_of_float(caml_ml_string_length(chan.file.data));\n}\n\n//Provides: caml_ml_set_channel_output\nfunction caml_ml_set_channel_output(chan,f) {\n chan.output = f;\n return 0;\n}\n\n//Provides: caml_ml_set_channel_refill\nfunction caml_ml_set_channel_refill(chan,f) {\n chan.refill = f;\n return 0;\n}\n\n//Provides: caml_ml_refill_input\n//Requires: caml_ml_string_length, caml_create_string, caml_blit_string\nfunction caml_ml_refill_input (chan) {\n var str = chan.refill();\n var str_len = caml_ml_string_length(str);\n if (str_len == 0) chan.refill = null;\n var old_len = caml_ml_string_length(chan.file.data) - chan.offset;\n if (old_len == 0) {\n chan.file.data = str;\n } else {\n var new_data = caml_create_string(old_len + str_len);\n caml_blit_string(chan.file.data, chan.offset, new_data, 0, old_len);\n caml_blit_string(str, 0, new_data, old_len, str_len);\n chan.file.data = new_data;\n }\n chan.offset = 0;\n return str_len;\n}\n\n//Provides: caml_ml_may_refill_input\n//Requires: caml_ml_string_length, caml_ml_refill_input\nfunction caml_ml_may_refill_input (chan) {\n if (chan.refill == null) return;\n if (caml_ml_string_length(chan.file.data) != chan.offset) return;\n caml_ml_refill_input (chan);\n}\n\n//Provides: caml_ml_input\n//Requires: caml_blit_string, caml_string_of_array, caml_ml_string_length\n//Requires: caml_ml_refill_input\nfunction caml_ml_input (chan, s, i, l) {\n var l2 = caml_ml_string_length(chan.file.data) - chan.offset;\n if (l2 == 0 && chan.refill != null) l2 = caml_ml_refill_input(chan);\n if (l2 < l) l = l2;\n caml_blit_string(chan.file.data, chan.offset, s, i, l);\n chan.offset += l;\n return l;\n}\n\n//Provides: caml_fs_file_content\n//Requires: caml_string_of_array, caml_fs_content, caml_make_path, MlFile\n//Requires: caml_raise_not_found, unix_time\nfunction caml_fs_file_content(name) {\n var path = caml_make_path(name);\n var f = caml_fs_content(path);\n if(f instanceof MlFile){\n var now = unix_time();\n f.atime = now;\n return f.data;\n }\n caml_raise_not_found();\n}\n\n//Provides: caml_input_value\n//Requires: caml_marshal_data_size, caml_input_value_from_string, caml_string_of_array\nfunction caml_input_value (chan) {\n var str = chan.file.data;\n var offset = [chan.offset];\n var _len = caml_marshal_data_size (str, offset[0]);\n var res = caml_input_value_from_string(str, offset);\n chan.offset = offset[0];\n return res;\n}\n\n//Provides: caml_ml_input_char\n//Requires: caml_raise_end_of_file, caml_array_bound_error\n//Requires: caml_ml_string_length, caml_string_get, caml_ml_may_refill_input\nfunction caml_ml_input_char (chan) {\n caml_ml_may_refill_input(chan);\n if (chan.offset >= caml_ml_string_length(chan.file.data))\n caml_raise_end_of_file();\n var c = caml_string_get(chan.file.data, chan.offset);\n chan.offset++;\n return c;\n}\n\n//Provides: caml_ml_input_int\n//Requires: caml_raise_end_of_file\n//Requires: caml_ml_string_length, caml_string_unsafe_get, caml_ml_refill_input\nfunction caml_ml_input_int (chan) {\n var s = chan.file.data, o = chan.offset;\n while ((o + 3) >= caml_ml_string_length(s)) {\n var l = caml_ml_refill_input(chan);\n if (l == 0) caml_raise_end_of_file();\n s = chan.file.data;\n o = chan.offset;\n }\n var r = (caml_string_unsafe_get(s,o) << 24) | (caml_string_unsafe_get(s,o+1) << 16) | (caml_string_unsafe_get(s,o+2) << 8) | (caml_string_unsafe_get(s,o+3));\n chan.offset+=4;\n return r;\n}\n\n//Provides: caml_ml_seek_in\n//Requires: caml_raise_sys_error\nfunction caml_ml_seek_in(chan,pos){\n if (chan.refill != null) caml_raise_sys_error(\"Illegal seek\");\n chan.offset = pos;\n return 0;\n}\n\n//Provides: caml_ml_seek_in_64\n//Requires: caml_int64_to_float, caml_raise_sys_error\nfunction caml_ml_seek_in_64(chan,pos){\n if (chan.refill != null) caml_raise_sys_error(\"Illegal seek\");\n chan.offset = caml_int64_to_float(pos);\n return 0;\n}\n\n//Provides: caml_ml_pos_in\nfunction caml_ml_pos_in(chan) {return chan.offset}\n\n//Provides: caml_ml_pos_in_64\n//Requires: caml_int64_of_float\nfunction caml_ml_pos_in_64(chan) {return caml_int64_of_float(chan.offset)}\n\n//Provides: caml_ml_input_scan_line\n//Requires: caml_array_bound_error, caml_ml_string_length, caml_string_get\n//Requires: caml_ml_may_refill_input\nfunction caml_ml_input_scan_line(chan){\n caml_ml_may_refill_input(chan);\n var p = chan.offset;\n var s = chan.file.data;\n var len = caml_ml_string_length(s);\n if(p >= len) { return 0;}\n while(true) {\n if(p >= len) return - (p - chan.offset);\n if(caml_string_get(s, p) == 10) return p - chan.offset + 1;\n p++;\n }\n}\n\n//Provides: caml_ml_flush\n//Requires: caml_raise_sys_error\nfunction caml_ml_flush (oc) {\n if(! oc.opened) caml_raise_sys_error(\"Cannot flush a closed channel\");\n if(oc.buffer == \"\") return 0;\n if(oc.output) {\n switch(oc.output.length){\n case 2: oc.output(oc,oc.buffer);break;\n default: oc.output(oc.buffer)\n };\n }\n oc.buffer = \"\";\n return 0;\n}\n\n//output to out_channel\n\n//Provides: caml_ml_output\n//Requires: caml_ml_flush,caml_ml_string_length\n//Requires: caml_create_string, caml_blit_string, caml_raise_sys_error\nfunction caml_ml_output (oc,buffer,offset,len) {\n if(! oc.opened) caml_raise_sys_error(\"Cannot output to a closed channel\");\n var string;\n if(offset == 0 && caml_ml_string_length(buffer) == len)\n string = buffer;\n else {\n string = caml_create_string(len);\n caml_blit_string(buffer,offset,string,0,len);\n }\n var jsstring = string.toString();\n var id = jsstring.lastIndexOf(\"\\n\");\n if(id < 0)\n oc.buffer+=jsstring;\n else {\n oc.buffer+=jsstring.substr(0,id+1);\n caml_ml_flush (oc);\n oc.buffer += jsstring.substr(id+1);\n }\n return 0;\n}\n//Provides: caml_ml_output_char\n//Requires: caml_ml_output\n//Requires: caml_new_string\nfunction caml_ml_output_char (oc,c) {\n var s = caml_new_string(String.fromCharCode(c));\n caml_ml_output(oc,s,0,1);\n return 0;\n}\n\n//Provides: caml_output_value\n//Requires: caml_output_value_to_string, caml_ml_output,caml_ml_string_length\nfunction caml_output_value (chan,v,_flags) {\n var s = caml_output_value_to_string(v);\n caml_ml_output(chan,s,0,caml_ml_string_length(s));\n return 0;\n}\n\n\n//Provides: caml_ml_seek_out\nfunction caml_ml_seek_out(chan,pos){\n chan.offset = pos;\n return 0;\n}\n\n//Provides: caml_ml_seek_out_64\n//Requires: caml_int64_to_float\nfunction caml_ml_seek_out_64(chan,pos){\n chan.offset = caml_int64_to_float(pos);\n return 0;\n}\n\n//Provides: caml_ml_pos_out\nfunction caml_ml_pos_out(chan) {return chan.offset}\n\n//Provides: caml_ml_pos_out_64\n//Requires: caml_int64_of_float\nfunction caml_ml_pos_out_64(chan) {\n return caml_int64_of_float (chan.offset);\n}\n\n//Provides: caml_ml_output_int\n//Requires: caml_ml_output\n//Requires: caml_string_of_array\nfunction caml_ml_output_int (oc,i) {\n var arr = [(i>>24) & 0xFF,(i>>16) & 0xFF,(i>>8) & 0xFF,i & 0xFF ];\n var s = caml_string_of_array(arr);\n caml_ml_output(oc,s,0,4);\n return 0\n}\n",
"// 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.orig = name;\n return ncomp;\n\n}\n\n\n//Provides: caml_fs_register\n//Requires: MlDir, MlFile, caml_root_dir, caml_make_path, caml_raise_sys_error\n//Requires: MlString, caml_array_of_string\n//Requires: caml_invalid_argument, caml_new_string\n//Requires: caml_string_of_array\n// content can be : MlDIr,MlFile,MlString,Array, string\nfunction caml_fs_register(name,content) {\n var path = caml_make_path(name);\n var dir = caml_root_dir;\n for(var i=0;i<path.length-1;i++){\n var d = path[i];\n if(!(dir.exists(d)))\n dir.mk(d,new MlDir());\n dir = dir.get(d);\n if(!(dir instanceof MlDir))\n caml_raise_sys_error (path.orig + \" : file already exists\");\n }\n var d = path[path.length-1];\n if(dir.exists(d)) caml_raise_sys_error (path.orig + \" : file already exists\");\n if(content instanceof MlDir) dir.mk(d,content);\n else if(content instanceof MlFile) dir.mk(d,content);\n else if(content instanceof MlString) dir.mk(d,new MlFile(content));\n else if(content instanceof Array) dir.mk(d,new MlFile(caml_string_of_array(content)));\n else if(content.toString) dir.mk(d,new MlFile((caml_new_string(content.toString()))));\n else caml_invalid_argument(\"caml_fs_register\");\n return 0;\n}\n\n//Provides: caml_fs_init\n//Requires: caml_fs_register\nfunction caml_fs_init (){\n var tmp=joo_global_object.caml_fs_tmp\n if(tmp){\n for(var i = 0; i < tmp.length; i++){\n caml_fs_register(tmp[i].name,tmp[i].content);\n }\n }\n joo_global_object.caml_fs_register = caml_fs_register;\n return 0;\n}\n\n//Provides: caml_fs_register_extern\nfunction caml_fs_register_extern(name,content){\n if(joo_global_object.caml_fs_register)\n joo_global_object.caml_fs_register(name,content);\n else {\n if(!joo_global_object.caml_fs_tmp) joo_global_object.caml_fs_tmp = [];\n joo_global_object.caml_fs_tmp.push({name:name,content:content});\n }\n return 0;\n}\n\n//Provides: caml_fs_content\n//Requires: caml_root_dir, caml_raise_no_such_file\nfunction caml_fs_content(path){\n var dir = caml_root_dir;\n for(var i=0;i<path.length;i++){\n if(!(dir.exists && dir.exists(path[i]))) caml_raise_no_such_file(path.orig);\n dir=dir.get(path[i]);\n }\n return dir\n}\n\n//Provides: caml_sys_file_exists\n//Requires: caml_root_dir, caml_make_path\nfunction caml_sys_file_exists (name) {\n var dir = caml_root_dir;\n var path = caml_make_path(name);\n var auto_load;\n var pos;\n for(var i=0;i<path.length;i++){\n if(dir.auto) { auto_load = dir.auto; pos = i}\n if(!(dir.exists && dir.exists(path[i]))) {\n if(auto_load) {\n return auto_load(path,pos);\n }\n else return 0;\n }\n dir=dir.get(path[i]);\n }\n return 1;\n}\n\n//Provides: caml_fs_register_autoload\n//Requires: MlDir, caml_make_path, caml_raise_sys_error, caml_root_dir\nfunction caml_fs_register_autoload(path,f){\n var path = caml_make_path(path);\n var dir = caml_root_dir;\n for(var i=0;i<path.length;i++){\n var d = path[i];\n if(!(dir.exists(d)))\n dir.mk(d,new MlDir());\n dir = dir.get(d);\n if(!(dir instanceof MlDir))\n caml_raise_sys_error (path.orig + \" : not a directory\");\n }\n dir.auto = f;\n return 0;\n}\n\n//Provides: caml_sys_read_directory\n//Requires: caml_new_string, MlDir\n//Requires: caml_fs_content, caml_make_path, caml_raise_not_a_dir\nfunction caml_sys_read_directory(name){\n var dir = caml_fs_content(caml_make_path(name));\n if(!(dir instanceof MlDir)){\n caml_raise_not_a_dir(name);\n }\n var list = dir.list();\n var l = new Array(list.length + 1);\n l[0] = 0;\n for(var i=0;i<list.length;i++)\n l[i+1] = caml_new_string(list[i]);\n return l;\n}\n\n//Provides: caml_sys_remove\n//Requires: caml_make_path, caml_fs_content, caml_raise_no_such_file\nfunction caml_sys_remove(name){\n var path = caml_make_path(name);\n var dir = caml_fs_content(path.slice(0,-1))\n if(dir.exists(path[path.length-1]))\n dir.remove(path[path.length-1]);\n else caml_raise_no_such_file(name);\n return 0;\n}\n\n//Provides: caml_sys_is_directory\n//Requires: caml_make_path, caml_fs_content, MlDir\nfunction caml_sys_is_directory(name){\n var path = caml_make_path(name);\n var dir = caml_fs_content(path);\n return (dir instanceof MlDir)?1:0;\n}\n\n//Provides: caml_sys_rename\n//Requires: caml_fs_register,caml_sys_remove\n//Requires: caml_make_path,caml_fs_content\n//Requires: caml_sys_file_exists, caml_sys_is_directory, caml_raise_sys_error\nfunction caml_sys_rename(o,n){\n var path = caml_make_path(o);\n var content = caml_fs_content(path);\n if(caml_sys_file_exists(n)){\n if(caml_sys_is_directory(n)) caml_raise_sys_error(n.toString() + \" : is a directory\");\n caml_sys_remove(n);\n }\n caml_fs_register(n, content);\n caml_sys_remove(o);\n return 0;\n}\n\n\n//Provides: caml_ba_map_file\n//Requires: caml_failwith\nfunction caml_ba_map_file(vfd, kind, layout, shared, dims, pos) {\n // var data = caml_global_data.fds[vfd];\n caml_failwith(\"caml_ba_map_file not Implemented\");\n}\n\n//Provides: caml_ba_map_file_bytecode\n//Requires: caml_ba_map_file\nfunction caml_ba_map_file_bytecode(argv,argn){\n return caml_ba_map_file(argv[0],argv[1],argv[2],argv[3],argv[4],argv[5]);\n}\n\n\n//Provides: unix_stat_file\n//Requires: caml_make_path, caml_fs_content, MlFile, MlDir,caml_ml_string_length\nfunction unix_stat_file(f){\n if (f instanceof MlDir) {\n var kind = 1; //S_DIR\n var size = 0;\n }\n if (f instanceof MlFile) {\n var kind = 0; //S_REG\n var size = caml_ml_string_length(f.data);\n }\n\n return [0,\n 0, //st_dev\n f.inode, // st_ino\n kind, // st_kind\n 436, //st_perm 0o664\n 1, //st_nlink\n 1, //st_uid\n 1, //st_gid\n 0, //st_rdev\n size,//st_size\n +f.atime,\n +f.mtime,\n +f.ctime\n ]\n}\n\n//Provides: unix_stat\n//Requires: caml_fs_content, caml_make_path, unix_stat_file\nfunction unix_stat(name){\n var f = caml_fs_content(caml_make_path(name));\n return unix_stat_file(f)\n}\n\n//Provides: unix_lstat\n//Requires: unix_stat\nvar unix_lstat = unix_stat\n\n//Provides: unix_fstat\n//Requires: unix_stat_file, caml_global_data\nfunction unix_fstat(idx){\n return unix_stat_file(caml_global_data.fds[idx].file)\n}\n",
"//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"]}