UNPKG

libatscc2js-rt

Version:

Runtime needed to execute libatscc2js-compiled code

2,547 lines (2,249 loc) 301 kB
/* Time of Generation: Sun Oct 15 21:51:08 EDT 2017 */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [basics_cats.js] ****** */ /* ****** ****** */ var the_atsptr_null = 0; /* ****** ****** */ function ATSCKiseqz(x) { return (x === 0); } function ATSCKisneqz(x) { return (x !== 0); } /* ****** ****** */ function ATSCKptrisnull(xs) { return (xs === null); } function ATSCKptriscons(xs) { return (xs !== null); } /* ****** ****** */ function ATSCKpat_int(tmp, given) { return (tmp === given); } function ATSCKpat_bool(tmp, given) { return (tmp === given); } function ATSCKpat_char(tmp, given) { return (tmp === given); } function ATSCKpat_float(tmp, given) { return (tmp === given); } function ATSCKpat_string(tmp, given) { return (tmp === given); } /* ****** ****** */ function ATSCKpat_con0 (con, tag) { return (con === tag); } function ATSCKpat_con1 (con, tag) { return (con[0] === tag); } /* ****** ****** */ // function ATSINScaseof_fail(errmsg) { throw new Error("ATSINScaseof_fail:"+errmsg); return; } // function ATSINSdeadcode_fail() { throw new Error("ATSINSdeadcode_fail"); return; } // /* ****** ****** */ function ATSPMVempty() { return; } /* ****** ****** */ // function ATSPMVlazyval(thunk) { return [0, thunk]; } // /* ****** ****** */ function ATSPMVlazyval_eval(lazyval) { // var flag, mythunk; // flag = lazyval[0]; // if(flag===0) { lazyval[0] = 1; mythunk = lazyval[1]; lazyval[1] = mythunk[0](mythunk); } else { lazyval[0] = flag + 1; } // end of [if] // return (lazyval[1]); // } // end of [ATSPMVlazyval_eval] /* ****** ****** */ // function ATSPMVllazyval(thunk){ return thunk; } // /* ****** ****** */ // function ATSPMVllazyval_eval(llazyval) { return llazyval[0](llazyval, true); } function atspre_lazy_vt_free(llazyval) { return llazyval[0](llazyval, false); } // /* ****** ****** */ function ats2jspre_alert(msg) { alert(msg); return; } /* ****** ****** */ function ats2jspre_confirm(msg) { return confirm(msg); } /* ****** ****** */ // function ats2jspre_prompt_none (msg) { return prompt(msg); } // function ats2jspre_prompt_some (msg, dflt) { return prompt(msg, dflt); } // /* ****** ****** */ function ats2jspre_typeof(obj) { return typeof(obj); } /* ****** ****** */ // function ats2jspre_tostring(obj) { return String(obj); } function ats2jspre_toString(obj) { return String(obj); } // /* ****** ****** */ function ats2jspre_console_log(obj) { return console.log(obj); } /* ****** ****** */ function ats2jspre_lazy2cloref(lazyval) { return lazyval[1]; } /* ****** ****** */ // function ats2jspre_ListSubscriptExn_throw (/*void*/) { throw new Error("ListSubscriptionExn"); } function ats2jspre_ArraySubscriptExn_throw (/*void*/) { throw new Error("ArraySubscriptionExn"); } function ats2jspre_StreamSubscriptExn_throw (/*void*/) { throw new Error("StreamSubscriptionExn"); } // /* ****** ****** */ // function ats2jspre_assert_bool0(tfv) { if (!tfv) throw new Error("Assert"); return; } function ats2jspre_assert_bool1(tfv) { if (!tfv) throw new Error("Assert"); return; } // /* ****** ****** */ // function ats2jspre_assert_errmsg_bool0 (tfv, errmsg) { if (!tfv) throw new Error(errmsg); return; } function ats2jspre_assert_errmsg_bool1 (tfv, errmsg) { if (!tfv) throw new Error(errmsg); return; } // /* ****** ****** */ // /* // // HX-2015-10-25: // Commenting out // implementation in basics.dats // */ function ats2jspre_cloref0_app(cf) { return cf[0](cf); } function ats2jspre_cloref1_app(cf, x) { return cf[0](cf, x); } function ats2jspre_cloref2_app(cf, x1, x2) { return cf[0](cf, x1, x2); } function ats2jspre_cloref3_app(cf, x1, x2, x3) { return cf[0](cf, x1, x2, x3); } // /* ****** ****** */ // function ats2jspre_cloref2fun0(cf) { return function(){return ats2jspre_cloref0_app(cf);}; } function ats2jspre_cloref2fun1(cf) { return function(x){return ats2jspre_cloref1_app(cf,x);}; } function ats2jspre_cloref2fun2(cf) { return function(x1,x2){return ats2jspre_cloref2_app(cf,x1,x2);}; } function ats2jspre_cloref2fun3(cf) { return function(x1,x2,x3){return ats2jspre_cloref2_app(cf,x1,x2,x3);}; } // /* ****** ****** */ /* end of [basics_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [integer_cats.js] ****** */ /* ****** ****** */ // // HX: for signed integers // /* ****** ****** */ function ats2jspre_neg_int0(x) { return ( -x ); } function ats2jspre_neg_int1(x) { return ( -x ); } /* ****** ****** */ function ats2jspre_abs_int0(x) { return Math.abs(x); } /* ****** ****** */ function ats2jspre_succ_int0(x) { return (x + 1); } function ats2jspre_pred_int0(x) { return (x - 1); } /* ****** ****** */ function ats2jspre_half_int0(x) { return (x >= 0) ? Math.floor(x/2) : Math.ceil(x/2); } /* ****** ****** */ function ats2jspre_succ_int1(x) { return (x + 1); } function ats2jspre_pred_int1(x) { return (x - 1); } /* ****** ****** */ function ats2jspre_half_int1(x) { return ats2jspre_half_int0(x); } /* ****** ****** */ function ats2jspre_add_int0_int0(x, y) { return (x + y); } function ats2jspre_sub_int0_int0(x, y) { return (x - y); } function ats2jspre_mul_int0_int0(x, y) { return (x * y); } function ats2jspre_div_int0_int0(x, y) { var q = x / y; return (q >= 0 ? Math.floor(q) : Math.ceil(q)); } function ats2jspre_mod_int0_int0(x, y) { return (x % y); } // /* ****** ****** */ function ats2jspre_add_int1_int1(x, y) { return (x + y); } function ats2jspre_sub_int1_int1(x, y) { return (x - y); } function ats2jspre_mul_int1_int1(x, y) { return (x * y); } function ats2jspre_div_int1_int1(x, y) { return ats2jspre_div_int0_int0(x, y); } // function ats2jspre_mod_int1_int1(x, y) { return (x % y); } function ats2jspre_nmod_int1_int1(x, y) { return (x % y); } // /* ****** ****** */ function ats2jspre_pow_int0_int1(x, y) { var res = 1; while(y >= 2) { if (y%2 > 0) res *= x; x = x * x; y = Math.floor(y/2); } return (y > 0) ? (x * res) : res; } /* ****** ****** */ function ats2jspre_asl_int0_int1(x, y) { return (x << y); } function ats2jspre_asr_int0_int1(x, y) { return (x >> y); } /* ****** ****** */ function ats2jspre_lnot_int0(x) { return (~x); } function ats2jspre_lor_int0_int0(x, y) { return (x | y); } function ats2jspre_lxor_int0_int0(x, y) { return (x ^ y); } function ats2jspre_land_int0_int0(x, y) { return (x & y); } /* ****** ****** */ function ats2jspre_lt_int0_int0(x, y) { return (x < y); } function ats2jspre_lte_int0_int0(x, y) { return (x <= y); } function ats2jspre_gt_int0_int0(x, y) { return (x > y); } function ats2jspre_gte_int0_int0(x, y) { return (x >= y); } function ats2jspre_eq_int0_int0(x, y) { return (x === y); } function ats2jspre_neq_int0_int0(x, y) { return (x !== y); } /* ****** ****** */ function ats2jspre_compare_int0_int0(x, y) { if (x < y) return -1; else if (x > y) return 1; else return 0; } /* ****** ****** */ function ats2jspre_lt_int1_int1(x, y) { return (x < y); } function ats2jspre_lte_int1_int1(x, y) { return (x <= y); } function ats2jspre_gt_int1_int1(x, y) { return (x > y); } function ats2jspre_gte_int1_int1(x, y) { return (x >= y); } function ats2jspre_eq_int1_int1(x, y) { return (x === y); } function ats2jspre_neq_int1_int1(x, y) { return (x !== y); } /* ****** ****** */ // function ats2jspre_max_int0_int0(x, y) { return (x >= y) ? x : y ; } function ats2jspre_min_int0_int0(x, y) { return (x <= y) ? x : y ; } // function ats2jspre_max_int1_int1(x, y) { return (x >= y) ? x : y ; } function ats2jspre_min_int1_int1(x, y) { return (x <= y) ? x : y ; } // /* ****** ****** */ // // HX: for unsigned integers // /* ****** ****** */ function ats2jspre_succ_uint0(x) { return (x + 1); } function ats2jspre_pred_uint0(x) { return (x - 1); } /* ****** ****** */ function ats2jspre_add_uint0_uint0(x, y) { return (x + y); } function ats2jspre_sub_uint0_uint0(x, y) { return (x - y); } function ats2jspre_mul_uint0_uint0(x, y) { return (x * y); } function ats2jspre_div_uint0_uint0(x, y) { return Math.floor(x/y); } function ats2jspre_mod_uint0_uint0(x, y) { return (x % y); } /* ****** ****** */ function ats2jspre_lsl_uint0_int1(x, y) { return (x << y); } function ats2jspre_lsr_uint0_int1(x, y) { return (x >>> y); } /* ****** ****** */ function ats2jspre_lnot_uint0(x) { return (~x); } function ats2jspre_lor_uint0_uint0(x, y) { return (x | y); } function ats2jspre_lxor_uint0_uint0(x, y) { return (x ^ y); } function ats2jspre_land_uint0_uint0(x, y) { return (x & y); } /* ****** ****** */ function ats2jspre_lt_uint0_uint0(x, y) { return (x < y); } function ats2jspre_lte_uint0_uint0(x, y) { return (x <= y); } function ats2jspre_gt_uint0_uint0(x, y) { return (x > y); } function ats2jspre_gte_uint0_uint0(x, y) { return (x >= y); } function ats2jspre_eq_uint0_uint0(x, y) { return (x === y); } function ats2jspre_neq_uint0_uint0(x, y) { return (x !== y); } /* ****** ****** */ function ats2jspre_compare_uint0_uint0(x, y) { if (x < y) return -1; else if (x > y) return 1; else return 0; } /* ****** ****** */ /* end of [integer_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [bool_cats.js] ****** */ /* ****** ****** */ // function ats2jspre_bool2int0(x) { return ( x ? 1 : 0 ); } function ats2jspre_bool2int1(x) { return ( x ? 1 : 0 ); } // /* ****** ****** */ // function ats2jspre_int2bool0(x) { return ( x !== 0 ? true : false ) ; } function ats2jspre_int2bool1(x) { return ( x !== 0 ? true : false ) ; } // /* ****** ****** */ // function ats2jspre_neg_bool0(x) { return ( x ? false : true ); } function ats2jspre_neg_bool1(x) { return ( x ? false : true ); } // /* ****** ****** */ function ats2jspre_add_bool0_bool0(x, y) { return (x || y); } function ats2jspre_add_bool0_bool1(x, y) { return (x || y); } function ats2jspre_add_bool1_bool0(x, y) { return (x || y); } function ats2jspre_add_bool1_bool1(x, y) { return (x || y); } /* ****** ****** */ function ats2jspre_mul_bool0_bool0(x, y) { return (x && y); } function ats2jspre_mul_bool0_bool1(x, y) { return (x && y); } function ats2jspre_mul_bool1_bool0(x, y) { return (x && y); } function ats2jspre_mul_bool1_bool1(x, y) { return (x && y); } /* ****** ****** */ // function ats2jspre_eq_bool0_bool0(x, y) { return (x === y); } function ats2jspre_neq_bool0_bool0(x, y) { return (x !== y); } // function ats2jspre_eq_bool1_bool1(x, y) { return (x === y); } function ats2jspre_neq_bool1_bool1(x, y) { return (x !== y); } // /* ****** ****** */ // function ats2jspre_int2bool0(x) { return (x !== 0 ? true : false) ; } function ats2jspre_int2bool1(x) { return (x !== 0 ? true : false) ; } // /* ****** ****** */ // function ats2jspre_bool2int0(x) { return (x ? 1 : 0); } function ats2jspre_bool2int1(x) { return (x ? 1 : 0); } // /* ****** ****** */ /* end of [bool_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [float_cats.js] ****** */ /* ****** ****** */ // function ats2jspre_int2double(x) { return x; } function ats2jspre_double_of_int(x) { return x; } // function ats2jspre_double2int(x) { return (x >= 0 ? Math.floor(x) : Math.ceil(x)); } function ats2jspre_int_of_double(x) { return (x >= 0 ? Math.floor(x) : Math.ceil(x)); } // /* ****** ****** */ function ats2jspre_neg_double(x) { return ( -x ); } /* ****** ****** */ function ats2jspre_abs_double(x) { return Math.abs(x); } /* ****** ****** */ // function ats2jspre_add_int_double(x, y) { return (x + y); } function ats2jspre_add_double_int(x, y) { return (x + y); } // function ats2jspre_sub_int_double(x, y) { return (x - y); } function ats2jspre_sub_double_int(x, y) { return (x - y); } // function ats2jspre_mul_int_double(x, y) { return (x * y); } function ats2jspre_mul_double_int(x, y) { return (x * y); } // function ats2jspre_div_int_double(x, y) { return (x / y); } function ats2jspre_div_double_int(x, y) { return (x / y); } // /* ****** ****** */ function ats2jspre_pow_double_int1(x, y) { var res = 1; while(y >= 2) { if (y%2 > 0) res *= x; x = x * x; y = Math.floor(y/2); } return (y > 0) ? (x * res) : res; } /* ****** ****** */ function ats2jspre_add_double_double(x, y) { return (x + y); } function ats2jspre_sub_double_double(x, y) { return (x - y); } function ats2jspre_mul_double_double(x, y) { return (x * y); } function ats2jspre_div_double_double(x, y) { return (x / y); } /* ****** ****** */ // function ats2jspre_lt_int_double(x, y) { return (x < y); } function ats2jspre_lt_double_int(x, y) { return (x < y); } // function ats2jspre_lte_int_double(x, y) { return (x <= y); } function ats2jspre_lte_double_int(x, y) { return (x <= y); } // function ats2jspre_gt_int_double(x, y) { return (x > y); } function ats2jspre_gt_double_int(x, y) { return (x > y); } // function ats2jspre_gte_int_double(x, y) { return (x >= y); } function ats2jspre_gte_double_int(x, y) { return (x >= y); } // /* ****** ****** */ function ats2jspre_lt_double_double(x, y) { return (x < y); } function ats2jspre_lte_double_double(x, y) { return (x <= y); } function ats2jspre_gt_double_double(x, y) { return (x > y); } function ats2jspre_gte_double_double(x, y) { return (x >= y); } function ats2jspre_eq_double_double(x, y) { return (x === y); } function ats2jspre_neq_double_double(x, y) { return (x !== y); } /* ****** ****** */ function ats2jspre_compare_double_double(x, y) { if (x < y) return -1; else if (x > y) return 1; else return 0; } /* ****** ****** */ // function ats2jspre_max_double_double(x, y) { return (x >= y) ? x : y ; } function ats2jspre_min_double_double(x, y) { return (x <= y) ? x : y ; } // /* ****** ****** */ /* end of [float_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [string_cats.js] ****** */ /* ****** ****** */ // function ats2jspre_string_length (str) { return str.length ; } // /* ****** ****** */ // function ats2jspre_string_get_at (str, i) { return str.charAt(i) ; } // /* ****** ****** */ // function ats2jspre_string0_is_empty(x) { return !Boolean(x); } function ats2jspre_string1_is_empty(x) { return !Boolean(x); } // function ats2jspre_string0_isnot_empty(x) { return Boolean(x); } function ats2jspre_string1_isnot_empty(x) { return Boolean(x); } // /* ****** ****** */ // function ats2jspre_string_substring_beg_end (str, i, j) { return str.substring(i, j) ; } function ats2jspre_string_substring_beg_len (str, i, len) { return str.substring(i, i+len) ; } // /* ****** ****** */ // function ats2jspre_lt_string_string(x, y) { return (x < y); } function ats2jspre_lte_string_string(x, y) { return (x <= y); } // function ats2jspre_gt_string_string(x, y) { return (x > y); } function ats2jspre_gte_string_string(x, y) { return (x >= y); } // function ats2jspre_eq_string_string(x, y) { return (x === y); } function ats2jspre_neq_string_string(x, y) { return (x !== y); } // /* ****** ****** */ // function ats2jspre_compare_string_string(x, y) { if (x < y) return -1; else if (x > y) return 1; else return 0; } // /* ****** ****** */ function ats2jspre_string_charAt(str, i) { return str.charAt(i) ; } function ats2jspre_string_charCodeAt(str, i) { return str.charCodeAt(i) ; } /* ****** ****** */ // function ats2jspre_string_fromCharCode_1 (c1) { return String.fromCharCode(c1) ; } function ats2jspre_string_fromCharCode_2 (c1,c2) { return String.fromCharCode(c1,c2) ; } function ats2jspre_string_fromCharCode_3 (c1,c2,c3) { return String.fromCharCode(c1,c2,c3) ; } function ats2jspre_string_fromCharCode_4 (c1,c2,c3,c4) { return String.fromCharCode(c1,c2,c3,c4) ; } function ats2jspre_string_fromCharCode_5 (c1,c2,c3,c4,c5) { return String.fromCharCode(c1,c2,c3,c4,c5) ; } function ats2jspre_string_fromCharCode_6 (c1,c2,c3,c4,c5,c6) { return String.fromCharCode(c1,c2,c3,c4,c5,c6) ; } // /* ****** ****** */ // function ats2jspre_strstr (str, key) { return str.indexOf(key) ; } function ats2jspre_string_indexOf_2 (str, key) { return str.indexOf(key) ; } function ats2jspre_string_indexOf_3 (str, key, start) { return str.indexOf(key, start) ; } // /* ****** ****** */ function ats2jspre_string_lastIndexOf_2 (str, key) { return str.lastIndexOf(key) ; } function ats2jspre_string_lastIndexOf_3 (str, key, start) { return str.lastIndexOf(key, start) ; } /* ****** ****** */ function ats2jspre_string_append(str1, str2) { return str1.concat(str2) ; } /* ****** ****** */ // function ats2jspre_string_concat_2(str1, str2) { return str1.concat(str2) ; } function ats2jspre_string_concat_3(str1, str2, str3) { return str1.concat(str2, str3) ; } // /* ****** ****** */ /* end of [string_cats.js] */ /* ****** * * HX-2015-12: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [gvalue_cats.js] ****** */ /* ****** ****** */ // function ats2jspre_gvhashtbl_make_nil() { return {}; } // /* ****** ****** */ // function ats2jspre_gvhashtbl_get_atkey(tbl, k0) { var res = tbl[k0]; return (res !== undefined ? res : ats2jspre_gvalue_nil()); } // /* ****** ****** */ // function ats2jspre_gvhashtbl_set_atkey(tbl, k0, x0) { tbl[k0] = x0; return; } // /* ****** ****** */ // function ats2jspre_gvhashtbl_exch_atkey(tbl, k0, x0) { var res = tbl[k0]; tbl[k0] = x0; return (res !== undefined ? res : ats2jspre_gvalue_nil()); } // /* ****** ****** */ /* end of [gvalue_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [JSmath_cats.js] ****** */ /* ****** ****** */ // var ats2jspre_JSmath_E = Math.E var ats2jspre_JSmath_PI = Math.PI var ats2jspre_JSmath_SQRT2 = Math.SQRT2 var ats2jspre_JSmath_SQRT1_2 = Math.SQRT1_2 var ats2jspre_JSmath_LN2 = Math.LN2 var ats2jspre_JSmath_LN10 = Math.LN10 var ats2jspre_JSmath_LOG2E = Math.LOG2E var ats2jspre_JSmath_LOG10E = Math.LOG10E // /* ****** ****** */ // function ats2jspre_JSmath_abs(x) { return Math.abs(x); } // function ats2jspre_JSmath_max(x, y) { return Math.max(x, y); } // function ats2jspre_JSmath_min(x, y) { return Math.min(x, y); } // /* ****** ****** */ // function ats2jspre_JSmath_sqrt(x) { return Math.sqrt(x); } // /* ****** ****** */ // function ats2jspre_JSmath_exp(x) { return Math.exp(x); } // function ats2jspre_JSmath_pow(x, y) { return Math.pow(x, y); } // function ats2jspre_JSmath_log(x) { return Math.log(x); } // /* ****** ****** */ // function ats2jspre_JSmath_ceil(x) { return Math.ceil(x); } function ats2jspre_JSmath_floor(x) { return Math.floor(x); } function ats2jspre_JSmath_round(x) { return Math.round(x); } // /* ****** ****** */ // function ats2jspre_JSmath_sin(x) { return Math.sin(x); } function ats2jspre_JSmath_cos(x) { return Math.cos(x); } function ats2jspre_JSmath_tan(x) { return Math.tan(x); } // /* ****** ****** */ // function ats2jspre_JSmath_asin(x) { return Math.asin(x); } function ats2jspre_JSmath_acos(x) { return Math.acos(x); } function ats2jspre_JSmath_atan(x) { return Math.atan(x); } function ats2jspre_JSmath_atan2(y, x) { return Math.atan2(y, x); } // /* ****** ****** */ // function ats2jspre_JSmath_random() { return Math.random(); } // /* ****** ****** */ /* end of [JSmath_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [JSdate_cats.js] ****** */ /* ****** ****** */ // function ats2jspre_Date_new_0 () { return new Date(); } function ats2jspre_Date_new_1_int (msec) { return new Date(msec); } function ats2jspre_Date_new_1_string (date) { return new Date(date); } function ats2jspre_Date_new_7 (year, mon, day, hour, min, sec, ms) { return new Date(year, mon, day, hour, min, sec, ms); } // /* ****** ****** */ // function ats2jspre_getTime (date) { return date.getTime(); } function ats2jspre_getTimezoneOffset (date) { return date.getTimezoneOffset(); } // /* ****** ****** */ // function ats2jspre_getDay(date) { return date.getDay(); } function ats2jspre_getDate(date) { return date.getDate(); } function ats2jspre_getMonth(date) { return date.getMonth(); } function ats2jspre_getFullYear(date) { return date.getFullYear(); } // function ats2jspre_getHours(date) { return date.getHours(); } function ats2jspre_getMinutes(date) { return date.getMinutes(); } function ats2jspre_getSeconds(date) { return date.getSeconds(); } function ats2jspre_getMilliseconds(date) { return date.getMilliseconds(); } // /* ****** ****** */ // function ats2jspre_getUTCDay(date) { return date.getUTCDay(); } function ats2jspre_getUTCDate(date) { return date.getUTCDate(); } function ats2jspre_getUTCMonth(date) { return date.getUTCMonth(); } function ats2jspre_getUTCFullYear(date) { return date.getUTCFullYear(); } // function ats2jspre_getUTCHours(date) { return date.getUTCHours(); } function ats2jspre_getUTCMinutes(date) { return date.getUTCMinutes(); } function ats2jspre_getUTCSeconds(date) { return date.getUTCSeconds(); } function ats2jspre_getUTCMilliseconds(date) { return date.getUTCMilliseconds(); } // /* ****** ****** */ /* end of [JSdate_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [JSarray_cats.js] ****** */ /* ****** ****** */ function ats2jspre_JSarray_nil() { return []; } function ats2jspre_JSarray_sing(x) { return [x]; } function ats2jspre_JSarray_pair(x1, x2) { return [x1, x2]; } /* ****** ****** */ function ats2jspre_JSarray_copy_arrayref(A, n) { // var A2 = new Array(n); for (var i = 0; i < n; i += 1) A2[i] = A[i]; return A2; // } // end of [ats2jspre_JSarray_copy_arrayref] /* ****** ****** */ // function ats2jspre_JSarray_get_at (A, i) { return A[i]; } function ats2jspre_JSarray_set_at (A, i, x0) { A[i] = x0; return; } // function ats2jspre_JSarray_exch_at (A, i, x0) { var x1 = A[i]; A[i] = x0; return x1; } // /* ****** ****** */ // function ats2jspre_JSarray_length(A) { return A.length; } // /* ****** ****** */ function ats2jspre_JSarray_pop(A) { return A.pop(); } function ats2jspre_JSarray_push(A, x) { return A.push(x); } /* ****** ****** */ function ats2jspre_JSarray_shift(A) { return A.shift(); } function ats2jspre_JSarray_unshift(A, x) { return A.unshift(x); } /* ****** ****** */ function ats2jspre_JSarray_reverse(A) { return A.reverse(); } /* ****** ****** */ function ats2jspre_JSarray_copy(A) { return A.slice(0); } /* ****** ****** */ function ats2jspre_JSarray_concat(A1, A2) { return A1.concat(A2); } /* ****** ****** */ // function ats2jspre_JSarray_insert_at (A, i, x) { A.splice(i, 0, x); return; } // function ats2jspre_JSarray_takeout_at (A, i) { var res = A.splice(i, 1); return res[0]; } // function ats2jspre_JSarray_remove_at(A, i) { A.splice(i, 1); return; } // /* ****** ****** */ // function ats2jspre_JSarray_join(A) { return A.join(""); } function ats2jspre_JSarray_join_sep(A, sep) { return A.join(sep); } // /* ****** ****** */ // function ats2jspre_JSarray_sort_2(A, cmp) { A.sort(ats2jspre_cloref2fun2(cmp)); return; } // /* ****** ****** */ /* end of [JSarray_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [JSglobal_cats.js] ****** */ /* ****** ****** */ function ats2jspre_eval(code) { return eval(code); } /* ****** ****** */ function ats2jspre_Number(obj) { return Number(obj); } function ats2jspre_String(obj) { return String(obj); } /* ****** ****** */ function ats2jspre_isFinite_int(x) { return isFinite(x); } function ats2jspre_isFinite_double(x) { return isFinite(x); } /* ****** ****** */ function ats2jspre_isNaN_int(x) { return isNaN(x); } function ats2jspre_isNaN_double(x) { return isNaN(x); } /* ****** ****** */ function ats2jspre_parseInt_1(rep) { return parseInt(rep); } function ats2jspre_parseInt_2(rep, base) { return parseInt(rep, base); } /* ****** ****** */ function ats2jspre_parseFloat(rep) { return parseFloat(rep); } /* ****** ****** */ function ats2jspre_encodeURI(uri) { return encodeURI(uri); } function ats2jspre_decodeURI(uri) { return decodeURI(uri); } /* ****** ****** */ function ats2jspre_encodeURIComponent(uri) { return encodeURIComponent(uri); } function ats2jspre_decodeURIComponent(uri) { return decodeURIComponent(uri); } /* ****** ****** */ /* end of [JSglobal_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [Ajax_cats.js] ****** */ /* ****** ****** */ function ats2js_Ajax_XMLHttpRequest_new ( // argumentless ) { var res = new XMLHttpRequest(); return res; } /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_open (xmlhttp, method, URL, async) { xmlhttp.open(method, URL, async); return; } // /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_send_0 (xmlhttp) { xmlhttp.send(); return; } function ats2js_Ajax_XMLHttpRequest_send_1 (xmlhttp, msg) { xmlhttp.send(msg); return; } // /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_setRequestHeader (xmlhttp, header, value) { xmlhttp.setRequestHeader(header, value); return; } // /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_get_responseXML (xmlhttp) { return xmlhttp.responseXML; } function ats2js_Ajax_XMLHttpRequest_get_responseText (xmlhttp) { return xmlhttp.responseText; } // /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_get_status (xmlhttp) { return xmlhttp.status; } // function ats2js_Ajax_XMLHttpRequest_get_readyState (xmlhttp) { return xmlhttp.readyState; } // function ats2js_Ajax_XMLHttpRequest_set_onreadystatechange (xmlhttp, f_action) { xmlhttp.onreadystatechange = function() { f_action[0](f_action); }; } // /* ****** ****** */ // // HX-2014-09: Convenience functions // /* ****** ****** */ // function ats2js_Ajax_XMLHttpRequest_is_ready_okay (xmlhttp) { return xmlhttp.readyState===4 && xmlhttp.status===200; } // /* ****** ****** */ /* end of [Ajax_cats.js] */ /* ****** * * HX-2014-08: * for JavaScript code * translated from ATS * ****** */ /* ****** * beg of [canvas2d_cats.js] ****** */ /* ****** ****** */ function ats2js_HTML5_canvas_getById (id) { var canvas = document.getElementById(id); if(!canvas) { throw "ats2js_HTML5_canvas_getById: canvas is not found"; } return canvas; } /* ****** ****** */ function ats2js_HTML5_canvas2d_getById (id) { var canvas = document.getElementById(id); if(!canvas) { throw "ats2js_HTML5_canvas_getById: canvas is not found"; } if(!canvas.getContext) { throw "ats2js_HTML5_canvas2d_getById: canvas-2d is not supported"; } return canvas.getContext("2d"); } /* ****** ****** */ function ats2js_HTML5_canvas2d_beginPath (ctx) { ctx.beginPath(); return; } function ats2js_HTML5_canvas2d_closePath (ctx) { ctx.closePath(); return; } /* ****** ****** */ function ats2js_HTML5_canvas2d_moveTo (ctx, x, y) { ctx.moveTo(x, y); return; } function ats2js_HTML5_canvas2d_lineTo (ctx, x, y) { ctx.lineTo(x, y); return; } /* ****** ****** */ // function ats2js_HTML5_canvas2d_translate (ctx, x, y) { ctx.translate(x, y); return; } // function ats2js_HTML5_canvas2d_scale (ctx, sx, sy) { ctx.scale(sx, sy); return; } // function ats2js_HTML5_canvas2d_rotate (ctx, rangle) { ctx.rotate(rangle); return; } // /* ****** ****** */ function ats2js_HTML5_canvas2d_rect (ctx, xul, yul, width, height) { ctx.rect(xul, yul, width, height); return; } /* end of [ats2js_HTML5_canvas2d_rect] */ function ats2js_HTML5_canvas2d_arc (ctx, xc, yc, rad, angle_beg, angle_end, CCW) { ctx.arc(xc, yc, rad, angle_beg, angle_end, CCW); return; } /* end of [ats2js_HTML5_canvas2d_arc] */ /* ****** ****** */ function ats2js_HTML5_canvas2d_clearRect (ctx, xul, yul, width, height) { ctx.clearRect(xul, yul, width, height); return; } /* end of [ats2js_HTML5_canvas2d_clearRect] */ /* ****** ****** */ // function ats2js_HTML5_canvas2d_fill(ctx) { ctx.fill(); return; } function ats2js_HTML5_canvas2d_stroke(ctx) { ctx.stroke(); return; } // /* ****** ****** */ // function ats2js_HTML5_canvas2d_fillRect (ctx, xul, yul, width, height) { ctx.fillRect(xul, yul, width, height); return; } /* end of [ats2js_HTML5_canvas2d_fillRect] */ // function ats2js_HTML5_canvas2d_strokeRect (ctx, xul, yul, width, height) { ctx.strokeRect(xul, yul, width, height); return; } /* end of [ats2js_HTML5_canvas2d_strokeRect] */ // /* ****** ****** */ // function ats2js_HTML5_canvas2d_fillText (ctx, text, xstart, ystart) { ctx.fillText(text, xstart, ystart); return; } function ats2js_HTML5_canvas2d_fillText2 (ctx, text, xstart, ystart, maxWidth) { ctx.fillText2(text, xstart, ystart, maxWidth); return; } // /* ****** ****** */ function ats2js_HTML5_canvas2d_save(ctx) { ctx.save(); return; } function ats2js_HTML5_canvas2d_restore(ctx) { ctx.restore(); return; } /* ****** ****** */ // function ats2js_HTML5_canvas2d_get_lineWidth (ctx) { return ctx.lineWidth; } function ats2js_HTML5_canvas2d_set_lineWidth_int (ctx, lineWidth) { ctx.lineWidth = lineWidth; return; } function ats2js_HTML5_canvas2d_set_lineWidth_double (ctx, lineWidth) { ctx.lineWidth = lineWidth; return; } // /* ****** ****** */ function ats2js_HTML5_canvas2d_set_font_string (ctx, font) { ctx.font = font; return; } function ats2js_HTML5_canvas2d_set_textAlign_string (ctx, textAlign) { ctx.textAlign = textAlign; return; } function ats2js_HTML5_canvas2d_set_textBaseline_string (ctx, textBaseline) { ctx.textBaseline = textBaseline; return; } /* ****** ****** */ function ats2js_HTML5_canvas2d_set_fillStyle_string (ctx, fillStyle) { ctx.fillStyle = fillStyle; return; } function ats2js_HTML5_canvas2d_set_strokeStyle_string (ctx, strokeStyle) { ctx.strokeStyle = strokeStyle; return; } /* ****** ****** */ function ats2js_HTML5_canvas2d_set_shadowColor_string (ctx, shadowColor) { ctx.shadowColor = shadowColor; return; } /* ****** ****** */ function ats2js_HTML5_canvas2d_set_shadowBlur_int (ctx, shadowBlur) { ctx.shadowBlur = shadowBlur; return; } function ats2js_HTML5_canvas2d_set_shadowBlur_string (ctx, shadowBlur) { ctx.shadowBlur = shadowBlur; return; } /* ****** ****** */ // function ats2js_HTML5_canvas2d_set_shadowOffsetX_int (ctx, X) { ctx.shadowOffsetX = X; return; } function ats2js_HTML5_canvas2d_set_shadowOffsetX_double (ctx, X) { ctx.shadowOffsetX = X; return; } // function ats2js_HTML5_canvas2d_set_shadowOffsetY_int (ctx, Y) { ctx.shadowOffsetY = Y; return; } function ats2js_HTML5_canvas2d_set_shadowOffsetY_double (ctx, Y) { ctx.shadowOffsetY = Y; return; } // /* ****** ****** */ function ats2js_HTML5_canvas2d_createLinearGradient (ctx, x0, y0, x1, y1) { return ctx.createLinearGradient(x0, y0, x1, y1); } /* ****** ****** */ // function ats2js_HTML5_canvas2d_gradient_addColorStop (grad, stop, color) { grad.addColorStop(stop, color); return; } // /* ****** ****** */ // function ats2js_HTML5_canvas2d_set_fillStyle_gradient (ctx, gradient) { ctx.fillStyle = gradient; return; } function ats2js_HTML5_canvas2d_set_strokeStyle_gradient (ctx, gradient) { ctx.strokeStyle = gradient; return; } // /* ****** ****** */ /* end of [canvas2d_cats.js] */ /* ** ** The JavaScript code is generated by atscc2js ** The starting compilation time is: 2017-10-15: 21h:51m ** */ function _ats2jspre_basics_patsfun_15__closurerize(env0) { return [function(cenv) { return _ats2jspre_basics_patsfun_15(cenv[1]); }, env0]; } function _ats2jspre_basics_patsfun_17__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_basics_patsfun_17(cenv[1], arg0); }, env0]; } function _ats2jspre_basics_patsfun_19__closurerize(env0) { return [function(cenv, arg0, arg1) { return _ats2jspre_basics_patsfun_19(cenv[1], arg0, arg1); }, env0]; } function _ats2jspre_basics_patsfun_21__closurerize(env0) { return [function(cenv, arg0, arg1, arg2) { return _ats2jspre_basics_patsfun_21(cenv[1], arg0, arg1, arg2); }, env0]; } function ats2jspre_fun2cloref0(arg0) { // // knd = 0 var tmpret50 var tmplab, tmplab_js // // __patsflab_fun2cloref0 tmpret50 = _ats2jspre_basics_patsfun_15__closurerize(arg0); return tmpret50; } // end-of-function function _ats2jspre_basics_patsfun_15(env0) { // // knd = 0 var tmpret51 var tmplab, tmplab_js // // __patsflab__ats2jspre_basics_patsfun_15 tmpret51 = env0(); return tmpret51; } // end-of-function function ats2jspre_fun2cloref1(arg0) { // // knd = 0 var tmpret52 var tmplab, tmplab_js // // __patsflab_fun2cloref1 tmpret52 = _ats2jspre_basics_patsfun_17__closurerize(arg0); return tmpret52; } // end-of-function function _ats2jspre_basics_patsfun_17(env0, arg0) { // // knd = 0 var tmpret53 var tmplab, tmplab_js // // __patsflab__ats2jspre_basics_patsfun_17 tmpret53 = env0(arg0); return tmpret53; } // end-of-function function ats2jspre_fun2cloref2(arg0) { // // knd = 0 var tmpret54 var tmplab, tmplab_js // // __patsflab_fun2cloref2 tmpret54 = _ats2jspre_basics_patsfun_19__closurerize(arg0); return tmpret54; } // end-of-function function _ats2jspre_basics_patsfun_19(env0, arg0, arg1) { // // knd = 0 var tmpret55 var tmplab, tmplab_js // // __patsflab__ats2jspre_basics_patsfun_19 tmpret55 = env0(arg0, arg1); return tmpret55; } // end-of-function function ats2jspre_fun2cloref3(arg0) { // // knd = 0 var tmpret56 var tmplab, tmplab_js // // __patsflab_fun2cloref3 tmpret56 = _ats2jspre_basics_patsfun_21__closurerize(arg0); return tmpret56; } // end-of-function function _ats2jspre_basics_patsfun_21(env0, arg0, arg1, arg2) { // // knd = 0 var tmpret57 var tmplab, tmplab_js // // __patsflab__ats2jspre_basics_patsfun_21 tmpret57 = env0(arg0, arg1, arg2); return tmpret57; } // end-of-function /* ****** ****** */ /* end-of-compilation-unit */ /* ** ** The JavaScript code is generated by atscc2js ** The starting compilation time is: 2017-10-15: 21h:51m ** */ function ats2jspre_char_isalpha(arg0) { // // knd = 0 var tmpret0 var tmp1 var tmp2 var tmp3 var tmp4 var tmplab, tmplab_js // // __patsflab_char_isalpha tmp2 = ats2jspre_lte_int0_int0(65, arg0); if(tmp2) { tmp1 = ats2jspre_lte_int0_int0(arg0, 90); } else { tmp1 = false; } // end-of-if if(tmp1) { tmpret0 = true; } else { tmp4 = ats2jspre_lte_int0_int0(97, arg0); if(tmp4) { tmp3 = ats2jspre_lte_int0_int0(arg0, 122); } else { tmp3 = false; } // end-of-if if(tmp3) { tmpret0 = true; } else { tmpret0 = false; } // end-of-if } // end-of-if return tmpret0; } // end-of-function function ats2jspre_char_isalnum(arg0) { // // knd = 0 var tmpret5 var tmp6 var tmp7 var tmp8 var tmp9 var tmp10 var tmp11 var tmplab, tmplab_js // // __patsflab_char_isalnum tmp7 = ats2jspre_lte_int0_int0(48, arg0); if(tmp7) { tmp6 = ats2jspre_lte_int0_int0(arg0, 57); } else { tmp6 = false; } // end-of-if if(tmp6) { tmpret5 = true; } else { tmp9 = ats2jspre_lte_int0_int0(65, arg0); if(tmp9) { tmp8 = ats2jspre_lte_int0_int0(arg0, 90); } else { tmp8 = false; } // end-of-if if(tmp8) { tmpret5 = true; } else { tmp11 = ats2jspre_lte_int0_int0(97, arg0); if(tmp11) { tmp10 = ats2jspre_lte_int0_int0(arg0, 122); } else { tmp10 = false; } // end-of-if if(tmp10) { tmpret5 = true; } else { tmpret5 = false; } // end-of-if } // end-of-if } // end-of-if return tmpret5; } // end-of-function function ats2jspre_char_isdigit(arg0) { // // knd = 0 var tmpret12 var tmp13 var tmp14 var tmplab, tmplab_js // // __patsflab_char_isdigit tmp14 = ats2jspre_lte_int0_int0(48, arg0); if(tmp14) { tmp13 = ats2jspre_lte_int0_int0(arg0, 57); } else { tmp13 = false; } // end-of-if if(tmp13) { tmpret12 = true; } else { tmpret12 = false; } // end-of-if return tmpret12; } // end-of-function function ats2jspre_char_isspace(arg0) { // // knd = 0 var tmpret15 var tmp16 var tmp17 var tmp18 var tmp19 var tmp20 var tmp21 var tmplab, tmplab_js // // __patsflab_char_isspace tmp16 = ats2jspre_eq_int0_int0(arg0, 9); if(tmp16) { tmpret15 = true; } else { tmp17 = ats2jspre_eq_int0_int0(arg0, 10); if(tmp17) { tmpret15 = true; } else { tmp18 = ats2jspre_eq_int0_int0(arg0, 11); if(tmp18) { tmpret15 = true; } else { tmp19 = ats2jspre_eq_int0_int0(arg0, 12); if(tmp19) { tmpret15 = true; } else { tmp20 = ats2jspre_eq_int0_int0(arg0, 13); if(tmp20) { tmpret15 = true; } else { tmp21 = ats2jspre_eq_int0_int0(arg0, 32); if(tmp21) { tmpret15 = true; } else { tmpret15 = false; } // end-of-if } // end-of-if } // end-of-if } // end-of-if } // end-of-if } // end-of-if return tmpret15; } // end-of-function /* ****** ****** */ /* end-of-compilation-unit */ /* ** ** The JavaScript code is generated by atscc2js ** The starting compilation time is: 2017-10-15: 21h:51m ** */ function _ats2jspre_string_patsfun_5__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_5(cenv[1], arg0); }, env0]; } function _ats2jspre_string_patsfun_9__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_9(cenv[1], arg0); }, env0]; } function _ats2jspre_string_patsfun_13__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_13(cenv[1], arg0); }, env0]; } function _ats2jspre_string_patsfun_17__closurerize(env0, env1, env2) { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_17(cenv[1], cenv[2], cenv[3], arg0); }, env0, env1, env2]; } function _ats2jspre_string_patsfun_20__closurerize(env0, env1, env2, env3) { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_20(cenv[1], cenv[2], cenv[3], cenv[4], arg0); }, env0, env1, env2, env3]; } function _ats2jspre_string_patsfun_24__24__1__closurerize() { return [function(cenv, arg0) { return _ats2jspre_string_patsfun_24__24__1(arg0); }]; } function ats2jspre_strchr_code(arg0) { // // knd = 0 var tmpret0 var tmplab, tmplab_js // // __patsflab_strchr_code tmpret0 = ats2jspre_string_charCodeAt(arg0, 0); return tmpret0; } // end-of-function function ats2jspre_string_fset_at(arg0, arg1, arg2) { // // knd = 0 var tmpret1 var tmp2 var tmp3 var tmp4 var tmp5 var tmp6 var tmplab, tmplab_js // // __patsflab_string_fset_at tmp2 = ats2jspre_string_length(arg0); tmp3 = ats2jspre_string_substring_beg_end(arg0, 0, arg1); tmp5 = ats2jspre_add_int1_int1(arg1, 1); tmp4 = ats2jspre_string_substring_beg_end(arg0, tmp5, tmp2); tmp6 = ats2jspre_string_concat_3(tmp3, arg2, tmp4); tmpret1 = tmp6; return tmpret1; } // end-of-function function ats2jspre_string_exists_cloref(arg0, arg1) { // // knd = 0 var tmpret7 var tmp8 var tmplab, tmplab_js // // __patsflab_string_exists_cloref tmp8 = ats2jspre_string_length(arg0); tmpret7 = _ats2jspre_string_loop_3(arg1, arg0, tmp8, 0); return tmpret7; } // end-of-function function _ats2jspre_string_loop_3(env0, env1, env2, arg0) { // // knd = 1 var apy0 var tmpret9 var tmp10 var tmp11 var tmp12 var tmp13 var funlab_js var tmplab, tmplab_js // while(true) { funlab_js = 0; // __patsflab__ats2jspre_string_loop_3 tmp10 = ats2jspre_lt_int1_int1(arg0, env2); if(tmp10) { tmp12 = ats2jspre_string_get_at(env1, arg0); tmp11 = env0[0](env0, tmp12); if(tmp11) { tmpret9 = true; } else { tmp13 = ats2jspre_add_int1_int1(arg0, 1); // ATStailcalseq_beg apy0 = tmp13; arg0 = apy0; funlab_js = 1; // __patsflab__ats2jspre_string_loop_3 // ATStailcalseq_end } // end-of-if } else { tmpret9 = false; } // end-of-if if (funlab_js > 0) continue; else return tmpret9; } // endwhile-fun } // end-of-function function ats2jspre_string_exists_method(arg0) { // // knd = 0 var tmpret14 var tmplab, tmplab_js // // __patsflab_string_exists_method tmpret14 = _ats2jspre_string_patsfun_5__closurerize(arg0); return tmpret14; } // end-of-function function _ats2jspre_string_patsfun_5(env0, arg0) { // // knd = 0 var tmpret15 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_5 tmpret15 = ats2jspre_string_exists_cloref(env0, arg0); return tmpret15; } // end-of-function function ats2jspre_string_forall_cloref(arg0, arg1) { // // knd = 0 var tmpret16 var tmp17 var tmplab, tmplab_js // // __patsflab_string_forall_cloref tmp17 = ats2jspre_string_length(arg0); tmpret16 = _ats2jspre_string_loop_7(arg1, arg0, tmp17, 0); return tmpret16; } // end-of-function function _ats2jspre_string_loop_7(env0, env1, env2, arg0) { // // knd = 1 var apy0 var tmpret18 var tmp19 var tmp20 var tmp21 var tmp22 var funlab_js var tmplab, tmplab_js // while(true) { funlab_js = 0; // __patsflab__ats2jspre_string_loop_7 tmp19 = ats2jspre_lt_int1_int1(arg0, env2); if(tmp19) { tmp21 = ats2jspre_string_get_at(env1, arg0); tmp20 = env0[0](env0, tmp21); if(tmp20) { tmp22 = ats2jspre_add_int1_int1(arg0, 1); // ATStailcalseq_beg apy0 = tmp22; arg0 = apy0; funlab_js = 1; // __patsflab__ats2jspre_string_loop_7 // ATStailcalseq_end } else { tmpret18 = false; } // end-of-if } else { tmpret18 = true; } // end-of-if if (funlab_js > 0) continue; else return tmpret18; } // endwhile-fun } // end-of-function function ats2jspre_string_forall_method(arg0) { // // knd = 0 var tmpret23 var tmplab, tmplab_js // // __patsflab_string_forall_method tmpret23 = _ats2jspre_string_patsfun_9__closurerize(arg0); return tmpret23; } // end-of-function function _ats2jspre_string_patsfun_9(env0, arg0) { // // knd = 0 var tmpret24 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_9 tmpret24 = ats2jspre_string_forall_cloref(env0, arg0); return tmpret24; } // end-of-function function ats2jspre_string_foreach_cloref(arg0, arg1) { // // knd = 0 var tmp26 var tmplab, tmplab_js // // __patsflab_string_foreach_cloref tmp26 = ats2jspre_string_length(arg0); _ats2jspre_string_loop_11(arg1, arg0, tmp26, 0); return/*_void*/; } // end-of-function function _ats2jspre_string_loop_11(env0, env1, env2, arg0) { // // knd = 1 var apy0 var tmp28 var tmp30 var tmp31 var funlab_js var tmplab, tmplab_js // while(true) { funlab_js = 0; // __patsflab__ats2jspre_string_loop_11 tmp28 = ats2jspre_lt_int1_int1(arg0, env2); if(tmp28) { tmp30 = ats2jspre_string_get_at(env1, arg0); env0[0](env0, tmp30); tmp31 = ats2jspre_add_int1_int1(arg0, 1); // ATStailcalseq_beg apy0 = tmp31; arg0 = apy0; funlab_js = 1; // __patsflab__ats2jspre_string_loop_11 // ATStailcalseq_end } else { // ATSINSmove_void } // end-of-if if (funlab_js > 0) continue; else return/*_void*/; } // endwhile-fun } // end-of-function function ats2jspre_string_foreach_method(arg0) { // // knd = 0 var tmpret32 var tmplab, tmplab_js // // __patsflab_string_foreach_method tmpret32 = _ats2jspre_string_patsfun_13__closurerize(arg0); return tmpret32; } // end-of-function function _ats2jspre_string_patsfun_13(env0, arg0) { // // knd = 0 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_13 ats2jspre_string_foreach_cloref(env0, arg0); return/*_void*/; } // end-of-function function ats2jspre_string_tabulate_cloref(arg0, arg1) { // // knd = 0 var tmpret34 var tmp35 var tmp36 var tmplab, tmplab_js // // __patsflab_string_tabulate_cloref tmp36 = _057_home_057_hwxi_057_Research_057_ATS_055_Postiats_057_contrib_057_libatscc2js_057_ATS2_055_0_056_3_056_2_057_SATS_057_JSarray_056_sats__JSarray_tabulate_cloref(arg0, arg1); tmp35 = ats2jspre_JSarray_join_sep(tmp36, ""); tmpret34 = tmp35; return tmpret34; } // end-of-function function ats2jspre_streamize_string_code(arg0) { // // knd = 0 var tmpret37 var tmp38 var tmplab, tmplab_js // // __patsflab_streamize_string_code tmp38 = ats2jspre_string_length(arg0); tmpret37 = _ats2jspre_string_auxmain_16(arg0, tmp38, 0); return tmpret37; } // end-of-function function _ats2jspre_string_auxmain_16(env0, env1, arg0) { // // knd = 0 var tmpret39 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_auxmain_16 tmpret39 = ATSPMVllazyval(_ats2jspre_string_patsfun_17__closurerize(env0, env1, arg0)); return tmpret39; } // end-of-function function _ats2jspre_string_patsfun_17(env0, env1, env2, arg0) { // // knd = 0 var tmpret40 var tmp41 var tmp42 var tmp43 var tmp44 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_17 if(arg0) { tmp41 = ats2jspre_lt_int1_int1(env2, env1); if(tmp41) { tmp42 = ats2jspre_string_charCodeAt(env0, env2); tmp44 = ats2jspre_add_int1_int1(env2, 1); tmp43 = _ats2jspre_string_auxmain_16(env0, env1, tmp44); tmpret40 = [tmp42, tmp43]; } else { tmpret40 = null; } // end-of-if } else { } // end-of-if return tmpret40; } // end-of-function function ats2jspre_streamize_string_line(arg0) { // // knd = 0 var tmpret45 var tmp46 var tmplab, tmplab_js // // __patsflab_streamize_string_line tmp46 = ats2jspre_string_length(arg0); tmpret45 = _ats2jspre_string_auxmain_19(arg0, tmp46, 0, 0); return tmpret45; } // end-of-function function _ats2jspre_string_auxmain_19(env0, env1, arg0, arg1) { // // knd = 0 var tmpret47 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_auxmain_19 tmpret47 = ATSPMVllazyval(_ats2jspre_string_patsfun_20__closurerize(env0, env1, arg0, arg1)); return tmpret47; } // end-of-function function _ats2jspre_string_patsfun_20(env0, env1, env2, env3, arg0) { // // knd = 0 var tmpret48 var tmp49 var tmp50 var tmp51 var tmp52 var tmp53 var tmp54 var tmp55 var tmp56 var tmp57 var tmp66 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_20 if(arg0) { tmp49 = ats2jspre_lt_int1_int1(env3, env1); if(tmp49) { tmp50 = ats2jspre_string_charCodeAt(env0, env3); tmp51 = ats2jspre_neq_int0_int0(tmp50, 10); if(tmp51) { tmp53 = ats2jspre_add_int1_int1(env3, 1); tmp52 = _ats2jspre_string_auxmain_19(env0, env1, env2, tmp53); tmpret48 = ATSPMVllazyval_eval(tmp52); } else { tmp54 = ats2jspre_add_int1_int1(env3, 1); tmp55 = ats2jspre_string_substring_beg_end(env0, env2, env3); tmp56 = _ats2jspre_string_auxmain_19(env0, env1, tmp54, tmp54); tmpret48 = [tmp55, tmp56]; } // end-of-if } else { tmp57 = ats2jspre_eq_int1_int1(env2, env3); if(tmp57) { tmpret48 = null; } else { tmp66 = ats2jspre_string_substring_beg_end(env0, env2, env3); tmpret48 = ats2jspre_stream_vt_sing__21__1(tmp66); } // end-of-if } // end-of-if } else { } // end-of-if return tmpret48; } // end-of-function function ats2jspre_stream_vt_sing__21__1(arg0) { // // knd = 0 var tmpret58__1 var tmp59__1 var tmplab, tmplab_js // // __patsflab_stream_vt_sing tmp59__1 = ats2jspre_stream_vt_make_nil__23__1(); tmpret58__1 = [arg0, tmp59__1]; return tmpret58__1; } // end-of-function function ats2jspre_stream_vt_make_nil__23__1() { // // knd = 0 var tmpret62__1 var tmplab, tmplab_js // // __patsflab_stream_vt_make_nil tmpret62__1 = ATSPMVllazyval(_ats2jspre_string_patsfun_24__24__1__closurerize()); return tmpret62__1; } // end-of-function function _ats2jspre_string_patsfun_24__24__1(arg0) { // // knd = 0 var tmpret63__1 var tmplab, tmplab_js // // __patsflab__ats2jspre_string_patsfun_24 if(arg0) { tmpret63__1 = null; } else { } // end-of-if return tmpret63__1; } // end-of-function /* ****** ****** */ /* end-of-compilation-unit */ /* ** ** The JavaScript code is generated by atscc2js ** The starting compilation time is: 2017-10-15: 21h:51m ** */ function _ats2jspre_list_patsfun_40__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_40(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_44__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_44(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_47__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_47(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_51__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_51(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_55__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_55(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_59__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_59(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_62__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_62(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_66__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_66(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_68__closurerize() { return [function(cenv, arg0, arg1) { return _ats2jspre_list_patsfun_68(arg0, arg1); }]; } function _ats2jspre_list_patsfun_72__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspre_list_patsfun_72(cenv[1], arg0); }, env0]; } function _ats2jspre_list_patsfun_76__closurerize(env0) { return [function(cenv, arg0) { return _ats2jspr