Skip to content

Instantly share code, notes, and snippets.

@githwxi
Last active August 29, 2015 14:20
Show Gist options
  • Save githwxi/c754d1fbea087ffb9e93 to your computer and use it in GitHub Desktop.
Save githwxi/c754d1fbea087ffb9e93 to your computer and use it in GitHub Desktop.
Library for JS code generated from ATS source
/*
Time of Generation:
Tue Jul 14 00:31:10 EDT 2015
*/
/*
******
*
* HX-2014-08:
* for JavaScript code
* translated from ATS
*
******
*/
/*
******
* beg of [basics_cats.js]
******
*/
/* ****** ****** */
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_make (thunk) { return [0, thunk]; }
*/
/* ****** ****** */
function
ATSPMVlazyval_eval(lazyval)
{
//
var
flag, thunk;
//
flag = lazyval[0];
//
if(flag===0)
{
lazyval[0] = 1;
thunk = lazyval[1];
lazyval[1] = thunk[0](thunk);
} else {
lazyval[0] = flag + 1;
} // end of [if]
//
return;
//
} // end of [ATSPMVlazyval_eval]
/* ****** ****** */
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 obj.toString(); }
/* ****** ****** */
function
ats2jspre_lazy2cloref(lazyval) { return lazyval[1]; }
/* ****** ****** */
//
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; }
//
/* ****** ****** */
/* 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_asl_int0_int1(x, y) { return (x << y); }
function
ats2jspre_asr_int0_int1(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); }
/* ****** ****** */
//
// HX: for unsigned integers
//
/* ****** ****** */
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)
{
var q = x / y; return (q >= 0 ? Math.floor(q) : Math.ceil(q));
}
function
ats2jspre_mod_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_neg_bool0(x)
{ return (x ? false : true ); }
function
ats2jspre_neg_bool1(x)
{ return (x ? false : true ); }
//
/* ****** ****** */
//
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_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;
}
/* ****** ****** */
/* end of [float_cats.js] */
/*
******
*
* HX-2014-08:
* for JavaScript code
* translated from ATS
*
******
*/
/*
******
* beg of [string_cats.js]
******
*/
/* ****** ****** */
//
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_length(str) { return str.length ; }
/* ****** ****** */
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_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-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); }
//
/* ****** ****** */
/* 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: 2015-7-14: 0h:31m
**
*/
function
ats2jspre_cloref0_app(arg0)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_cloref0_app
tmpret0 = arg0[0](arg0);
return tmpret0;
} // end-of-function
function
ats2jspre_cloref1_app(arg0, arg1)
{
//
// knd = 0
var tmpret1
var tmplab, tmplab_js
//
// __patsflab_cloref1_app
tmpret1 = arg0[0](arg0, arg1);
return tmpret1;
} // end-of-function
function
ats2jspre_cloref2_app(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret2
var tmplab, tmplab_js
//
// __patsflab_cloref2_app
tmpret2 = arg0[0](arg0, arg1, arg2);
return tmpret2;
} // end-of-function
function
ats2jspre_cloref3_app(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmpret3
var tmplab, tmplab_js
//
// __patsflab_cloref3_app
tmpret3 = arg0[0](arg0, arg1, arg2, arg3);
return tmpret3;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
function
ats2jspre_list_make_intrange_2(arg0, arg1)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_list_make_intrange_2
tmpret0 = ats2jspre_list_make_intrange_3(arg0, arg1, 1);
return tmpret0;
} // end-of-function
function
ats2jspre_list_make_intrange_3(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret1
var tmp12
var tmp13
var tmp14
var tmp15
var tmp16
var tmp17
var tmp18
var tmp19
var tmp20
var tmp21
var tmp22
var tmp23
var tmp24
var tmp25
var tmp26
var tmp27
var tmp28
var tmp29
var tmp30
var tmp31
var tmp32
var tmplab, tmplab_js
//
// __patsflab_list_make_intrange_3
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab0
tmp12 = ats2jspre_gt_int0_int0(arg2, 0);
if(!ATSCKpat_bool(tmp12, true)) { tmplab_js = 2; break; }
tmp13 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp13) {
tmp17 = ats2jspre_sub_int0_int0(arg1, arg0);
tmp16 = ats2jspre_add_int0_int0(tmp17, arg2);
tmp15 = ats2jspre_sub_int0_int0(tmp16, 1);
tmp14 = ats2jspre_div_int0_int0(tmp15, arg2);
tmp20 = ats2jspre_sub_int0_int0(tmp14, 1);
tmp19 = ats2jspre_mul_int0_int0(tmp20, arg2);
tmp18 = ats2jspre_add_int0_int0(arg0, tmp19);
tmp21 = null;
tmpret1 = _ats2jspre_list_loop1_2(tmp14, tmp18, arg2, tmp21);
} else {
tmpret1 = null;
} // endif
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 2: // __atstmplab1
tmp22 = ats2jspre_lt_int0_int0(arg2, 0);
if(!ATSCKpat_bool(tmp22, true)) { tmplab_js = 3; break; }
tmp23 = ats2jspre_gt_int0_int0(arg0, arg1);
if(tmp23) {
tmp24 = ats2jspre_neg_int0(arg2);
tmp28 = ats2jspre_sub_int0_int0(arg0, arg1);
tmp27 = ats2jspre_add_int0_int0(tmp28, tmp24);
tmp26 = ats2jspre_sub_int0_int0(tmp27, 1);
tmp25 = ats2jspre_div_int0_int0(tmp26, tmp24);
tmp31 = ats2jspre_sub_int0_int0(tmp25, 1);
tmp30 = ats2jspre_mul_int0_int0(tmp31, tmp24);
tmp29 = ats2jspre_sub_int0_int0(arg0, tmp30);
tmp32 = null;
tmpret1 = _ats2jspre_list_loop2_3(tmp25, tmp29, tmp24, tmp32);
} else {
tmpret1 = null;
} // endif
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab2
tmpret1 = null;
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret1;
} // end-of-function
function
_ats2jspre_list_loop1_2(arg0, arg1, arg2, arg3)
{
//
// knd = 1
var apy0
var apy1
var apy2
var apy3
var tmpret2
var tmp3
var tmp4
var tmp5
var tmp6
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_list_loop1_2
tmp3 = ats2jspre_gt_int0_int0(arg0, 0);
if(tmp3) {
tmp4 = ats2jspre_sub_int0_int0(arg0, 1);
tmp5 = ats2jspre_sub_int0_int0(arg1, arg2);
tmp6 = [arg1, arg3];
// ATStailcalseq_beg
apy0 = tmp4;
apy1 = tmp5;
apy2 = arg2;
apy3 = tmp6;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
arg3 = apy3;
funlab_js = 1; // __patsflab__ats2jspre_list_loop1_2
// ATStailcalseq_end
} else {
tmpret2 = arg3;
} // endif
if (funlab_js > 0) continue; else return tmpret2;
} // endwhile-fun
} // end-of-function
function
_ats2jspre_list_loop2_3(arg0, arg1, arg2, arg3)
{
//
// knd = 1
var apy0
var apy1
var apy2
var apy3
var tmpret7
var tmp8
var tmp9
var tmp10
var tmp11
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_list_loop2_3
tmp8 = ats2jspre_gt_int0_int0(arg0, 0);
if(tmp8) {
tmp9 = ats2jspre_sub_int0_int0(arg0, 1);
tmp10 = ats2jspre_add_int0_int0(arg1, arg2);
tmp11 = [arg1, arg3];
// ATStailcalseq_beg
apy0 = tmp9;
apy1 = tmp10;
apy2 = arg2;
apy3 = tmp11;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
arg3 = apy3;
funlab_js = 1; // __patsflab__ats2jspre_list_loop2_3
// ATStailcalseq_end
} else {
tmpret7 = arg3;
} // endif
if (funlab_js > 0) continue; else return tmpret7;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_length(arg0)
{
//
// knd = 0
var tmpret44
var tmplab, tmplab_js
//
// __patsflab_list_length
tmpret44 = _ats2jspre_list_loop_10(arg0, 0);
return tmpret44;
} // end-of-function
function
_ats2jspre_list_loop_10(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmpret45
var tmp47
var tmp48
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_list_loop_10
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab7
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab8
tmpret45 = arg1;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab9
case 4: // __atstmplab10
tmp47 = arg0[1];
tmp48 = ats2jspre_add_int1_int1(arg1, 1);
// ATStailcalseq_beg
apy0 = tmp47;
apy1 = tmp48;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab__ats2jspre_list_loop_10
// ATStailcalseq_end
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
if (funlab_js > 0) continue; else return tmpret45;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_get_at(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmpret49
var tmp50
var tmp51
var tmp52
var tmp53
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab_list_get_at
tmp50 = ats2jspre_eq_int1_int1(arg1, 0);
if(tmp50) {
tmp51 = arg0[0];
tmpret49 = tmp51;
} else {
tmp52 = arg0[1];
tmp53 = ats2jspre_sub_int1_int1(arg1, 1);
// ATStailcalseq_beg
apy0 = tmp52;
apy1 = tmp53;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab_list_get_at
// ATStailcalseq_end
} // endif
if (funlab_js > 0) continue; else return tmpret49;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_append(arg0, arg1)
{
//
// knd = 0
var tmpret54
var tmp55
var tmp56
var tmp57
var tmplab, tmplab_js
//
// __patsflab_list_append
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab11
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab12
tmpret54 = arg1;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab13
case 4: // __atstmplab14
tmp55 = arg0[0];
tmp56 = arg0[1];
tmp57 = ats2jspre_list_append(tmp56, arg1);
tmpret54 = [tmp55, tmp57];
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret54;
} // end-of-function
function
ats2jspre_list_reverse(arg0)
{
//
// knd = 0
var tmpret58
var tmp59
var tmplab, tmplab_js
//
// __patsflab_list_reverse
tmp59 = null;
tmpret58 = ats2jspre_list_reverse_append(arg0, tmp59);
return tmpret58;
} // end-of-function
function
ats2jspre_list_reverse_append(arg0, arg1)
{
//
// knd = 0
var tmpret60
var tmplab, tmplab_js
//
// __patsflab_list_reverse_append
tmpret60 = _ats2jspre_list_loop_15(arg0, arg1);
return tmpret60;
} // end-of-function
function
_ats2jspre_list_loop_15(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmpret61
var tmp62
var tmp63
var tmp64
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_list_loop_15
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab15
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab16
tmpret61 = arg1;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab17
case 4: // __atstmplab18
tmp62 = arg0[0];
tmp63 = arg0[1];
tmp64 = [tmp62, arg1];
// ATStailcalseq_beg
apy0 = tmp63;
apy1 = tmp64;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab__ats2jspre_list_loop_15
// ATStailcalseq_end
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
if (funlab_js > 0) continue; else return tmpret61;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_take(arg0, arg1)
{
//
// knd = 0
var tmpret65
var tmp66
var tmp67
var tmp68
var tmp69
var tmp70
var tmplab, tmplab_js
//
// __patsflab_list_take
tmp66 = ats2jspre_gt_int1_int1(arg1, 0);
if(tmp66) {
tmp67 = arg0[0];
tmp68 = arg0[1];
tmp70 = ats2jspre_sub_int1_int1(arg1, 1);
tmp69 = ats2jspre_list_take(tmp68, tmp70);
tmpret65 = [tmp67, tmp69];
} else {
tmpret65 = null;
} // endif
return tmpret65;
} // end-of-function
function
ats2jspre_list_drop(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmpret71
var tmp72
var tmp73
var tmp74
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab_list_drop
tmp72 = ats2jspre_gt_int1_int1(arg1, 0);
if(tmp72) {
tmp73 = arg0[1];
tmp74 = ats2jspre_sub_int1_int1(arg1, 1);
// ATStailcalseq_beg
apy0 = tmp73;
apy1 = tmp74;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab_list_drop
// ATStailcalseq_end
} else {
tmpret71 = arg0;
} // endif
if (funlab_js > 0) continue; else return tmpret71;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_split_at(arg0, arg1)
{
//
// knd = 0
var tmpret75
var tmp76
var tmp77
var tmplab, tmplab_js
//
// __patsflab_list_split_at
tmp76 = ats2jspre_list_take(arg0, arg1);
tmp77 = ats2jspre_list_drop(arg0, arg1);
tmpret75 = [tmp76, tmp77];
return tmpret75;
} // end-of-function
function
ats2jspre_list_insert_at(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret78
var tmp79
var tmp80
var tmp81
var tmp82
var tmp83
var tmplab, tmplab_js
//
// __patsflab_list_insert_at
tmp79 = ats2jspre_gt_int1_int1(arg1, 0);
if(tmp79) {
tmp80 = arg0[0];
tmp81 = arg0[1];
tmp83 = ats2jspre_sub_int1_int1(arg1, 1);
tmp82 = ats2jspre_list_insert_at(tmp81, tmp83, arg2);
tmpret78 = [tmp80, tmp82];
} else {
tmpret78 = [arg2, arg0];
} // endif
return tmpret78;
} // end-of-function
function
ats2jspre_list_remove_at(arg0, arg1)
{
//
// knd = 0
var tmpret84
var tmp85
var tmp86
var tmp87
var tmp88
var tmp89
var tmp90
var tmp91
var tmp92
var tmplab, tmplab_js
//
// __patsflab_list_remove_at
tmp85 = arg0[0];
tmp86 = arg0[1];
tmp87 = ats2jspre_gt_int1_int1(arg1, 0);
if(tmp87) {
tmp89 = ats2jspre_sub_int1_int1(arg1, 1);
tmp88 = ats2jspre_list_remove_at(tmp86, tmp89);
tmp90 = tmp88[0];
tmp91 = tmp88[1];
tmp92 = [tmp85, tmp91];
tmpret84 = [tmp90, tmp92];
} else {
tmpret84 = [tmp85, tmp86];
} // endif
return tmpret84;
} // end-of-function
function
ats2jspre_list_app(arg0, arg1)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_list_app
ats2jspre_list_foreach(arg0, arg1);
return/*_void*/;
} // end-of-function
function
ats2jspre_list_foreach(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmp95
var tmp96
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab_list_foreach
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab19
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab20
// ATSINSmove_void
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab21
case 4: // __atstmplab22
tmp95 = arg0[0];
tmp96 = arg0[1];
arg1[0](arg1, tmp95);
// ATStailcalseq_beg
apy0 = tmp96;
apy1 = arg1;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab_list_foreach
// ATStailcalseq_end
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
if (funlab_js > 0) continue; else return/*_void*/;
} // endwhile-fun
} // end-of-function
function
ats2jspre_list_map(arg0, arg1)
{
//
// knd = 0
var tmpret98
var tmp99
var tmp100
var tmp101
var tmp102
var tmplab, tmplab_js
//
// __patsflab_list_map
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab23
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab24
tmpret98 = null;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab25
case 4: // __atstmplab26
tmp99 = arg0[0];
tmp100 = arg0[1];
tmp101 = arg1[0](arg1, tmp99);
tmp102 = ats2jspre_list_map(tmp100, arg1);
tmpret98 = [tmp101, tmp102];
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret98;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
function
ats2jspre_option_is_some(arg0)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_option_is_some
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab0
if(ATSCKptrisnull(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab1
tmpret0 = true;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab2
case 4: // __atstmplab3
tmpret0 = false;
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret0;
} // end-of-function
function
ats2jspre_option_is_none(arg0)
{
//
// knd = 0
var tmpret1
var tmplab, tmplab_js
//
// __patsflab_option_is_none
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab4
if(ATSCKptriscons(arg0)) { tmplab_js = 4; break; }
case 2: // __atstmplab5
tmpret1 = true;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab6
case 4: // __atstmplab7
tmpret1 = false;
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret1;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
function
_ats2jspre_stream_patsfun_1__closurerize(env0, env1)
{
return [function(cenv) { return _ats2jspre_stream_patsfun_1(cenv[1], cenv[2]); }, env0, env1];
}
function
_ats2jspre_stream_patsfun_3__closurerize(env0, env1)
{
return [function(cenv) { return _ats2jspre_stream_patsfun_3(cenv[1], cenv[2]); }, env0, env1];
}
function
_ats2jspre_stream_patsfun_6__closurerize(env0, env1)
{
return [function(cenv) { return _ats2jspre_stream_patsfun_6(cenv[1], cenv[2]); }, env0, env1];
}
function
ats2jspre_stream_map_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_stream_map_cloref
tmpret0 = [0, _ats2jspre_stream_patsfun_1__closurerize(arg0, arg1)]
return tmpret0;
} // end-of-function
function
_ats2jspre_stream_patsfun_1(env0, env1)
{
//
// knd = 0
var tmpret1
var tmp2
var tmp3
var tmp4
var tmp5
var tmp6
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_stream_patsfun_1
ATSPMVlazyval_eval(env0); tmp2 = env0[1];
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab0
if(ATSCKptriscons(tmp2)) { tmplab_js = 4; break; }
case 2: // __atstmplab1
tmpret1 = null;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab2
case 4: // __atstmplab3
tmp3 = tmp2[0];
tmp4 = tmp2[1];
tmp5 = env1[0](env1, tmp3);
tmp6 = ats2jspre_stream_map_cloref(tmp4, env1);
tmpret1 = [tmp5, tmp6];
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret1;
} // end-of-function
function
ats2jspre_stream_filter_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret7
var tmplab, tmplab_js
//
// __patsflab_stream_filter_cloref
tmpret7 = [0, _ats2jspre_stream_patsfun_3__closurerize(arg0, arg1)]
return tmpret7;
} // end-of-function
function
_ats2jspre_stream_patsfun_3(env0, env1)
{
//
// knd = 0
var tmpret8
var tmp9
var tmp10
var tmp11
var tmp12
var tmp13
var tmp14
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_stream_patsfun_3
ATSPMVlazyval_eval(env0); tmp9 = env0[1];
// ATScaseofseq_beg
tmplab_js = 1;
while(true) {
tmplab = tmplab_js; tmplab_js = 0;
switch(tmplab) {
// ATSbranchseq_beg
case 1: // __atstmplab4
if(ATSCKptriscons(tmp9)) { tmplab_js = 4; break; }
case 2: // __atstmplab5
tmpret8 = null;
break;
// ATSbranchseq_end
// ATSbranchseq_beg
case 3: // __atstmplab6
case 4: // __atstmplab7
tmp10 = tmp9[0];
tmp11 = tmp9[1];
tmp12 = env1[0](env1, tmp10);
if(tmp12) {
tmp13 = ats2jspre_stream_filter_cloref(tmp11, env1);
tmpret8 = [tmp10, tmp13];
} else {
tmp14 = ats2jspre_stream_filter_cloref(tmp11, env1);
ATSPMVlazyval_eval(tmp14); tmpret8 = tmp14[1];
} // endif
break;
// ATSbranchseq_end
} // end-of-switch
if (tmplab_js === 0) break;
} // endwhile
// ATScaseofseq_end
return tmpret8;
} // end-of-function
function
ats2jspre_stream_tabulate_cloref(arg0)
{
//
// knd = 0
var tmpret15
var tmplab, tmplab_js
//
// __patsflab_stream_tabulate_cloref
tmpret15 = _ats2jspre_stream_aux_5(arg0, 0);
return tmpret15;
} // end-of-function
function
_ats2jspre_stream_aux_5(env0, arg0)
{
//
// knd = 0
var tmpret16
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_stream_aux_5
tmpret16 = [0, _ats2jspre_stream_patsfun_6__closurerize(env0, arg0)]
return tmpret16;
} // end-of-function
function
_ats2jspre_stream_patsfun_6(env0, env1)
{
//
// knd = 0
var tmpret17
var tmp18
var tmp19
var tmp20
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_stream_patsfun_6
tmp18 = env0[0](env0, env1);
tmp20 = ats2jspre_add_int1_int1(env1, 1);
tmp19 = _ats2jspre_stream_aux_5(env0, tmp20);
tmpret17 = [tmp18, tmp19];
return tmpret17;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
function
_ats2jspre_intrange_patsfun_7__closurerize(env0)
{
return [function(cenv, arg0) { return _ats2jspre_intrange_patsfun_7(cenv[1], arg0); }, env0];
}
function
_ats2jspre_intrange_patsfun_9__closurerize(env0)
{
return [function(cenv, arg0) { return _ats2jspre_intrange_patsfun_9(cenv[1], arg0); }, env0];
}
function
_ats2jspre_intrange_patsfun_11__closurerize(env0)
{
return [function(cenv, arg0) { return _ats2jspre_intrange_patsfun_11(cenv[1], arg0); }, env0];
}
function
_ats2jspre_intrange_patsfun_14__closurerize(env0)
{
return [function(cenv, arg0, arg1) { return _ats2jspre_intrange_patsfun_14(cenv[1], arg0, arg1); }, env0];
}
function
_ats2jspre_intrange_patsfun_18__closurerize(env0)
{
return [function(cenv, arg0) { return _ats2jspre_intrange_patsfun_18(cenv[1], arg0); }, env0];
}
function
_ats2jspre_intrange_patsfun_31__closurerize(env0, env1)
{
return [function(cenv, arg0, arg1) { return _ats2jspre_intrange_patsfun_31(cenv[1], cenv[2], arg0, arg1); }, env0, env1];
}
function
ats2jspre_int_repeat_lazy(arg0, arg1)
{
//
// knd = 0
var tmp1
var tmplab, tmplab_js
//
// __patsflab_int_repeat_lazy
tmp1 = ats2jspre_lazy2cloref(arg1);
ats2jspre_int_repeat_cloref(arg0, tmp1);
return/*_void*/;
} // end-of-function
function
ats2jspre_int_repeat_cloref(arg0, arg1)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_int_repeat_cloref
_ats2jspre_intrange_loop_2(arg0, arg1);
return/*_void*/;
} // end-of-function
function
_ats2jspre_intrange_loop_2(arg0, arg1)
{
//
// knd = 1
var apy0
var apy1
var tmp4
var tmp6
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_intrange_loop_2
tmp4 = ats2jspre_gt_int0_int0(arg0, 0);
if(tmp4) {
arg1[0](arg1);
tmp6 = ats2jspre_sub_int0_int0(arg0, 1);
// ATStailcalseq_beg
apy0 = tmp6;
apy1 = arg1;
arg0 = apy0;
arg1 = apy1;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop_2
// ATStailcalseq_end
} else {
// ATSINSmove_void
} // endif
if (funlab_js > 0) continue; else return/*_void*/;
} // endwhile-fun
} // end-of-function
function
ats2jspre_int_exists_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret7
var tmplab, tmplab_js
//
// __patsflab_int_exists_cloref
tmpret7 = ats2jspre_intrange_exists_cloref(0, arg0, arg1);
return tmpret7;
} // end-of-function
function
ats2jspre_int_forall_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret8
var tmplab, tmplab_js
//
// __patsflab_int_forall_cloref
tmpret8 = ats2jspre_intrange_forall_cloref(0, arg0, arg1);
return tmpret8;
} // end-of-function
function
ats2jspre_int_foreach_cloref(arg0, arg1)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_int_foreach_cloref
ats2jspre_intrange_foreach_cloref(0, arg0, arg1);
return/*_void*/;
} // end-of-function
function
ats2jspre_int_exists_method(arg0)
{
//
// knd = 0
var tmpret10
var tmplab, tmplab_js
//
// __patsflab_int_exists_method
tmpret10 = _ats2jspre_intrange_patsfun_7__closurerize(arg0);
return tmpret10;
} // end-of-function
function
_ats2jspre_intrange_patsfun_7(env0, arg0)
{
//
// knd = 0
var tmpret11
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_7
tmpret11 = ats2jspre_int_exists_cloref(env0, arg0);
return tmpret11;
} // end-of-function
function
ats2jspre_int_forall_method(arg0)
{
//
// knd = 0
var tmpret12
var tmplab, tmplab_js
//
// __patsflab_int_forall_method
tmpret12 = _ats2jspre_intrange_patsfun_9__closurerize(arg0);
return tmpret12;
} // end-of-function
function
_ats2jspre_intrange_patsfun_9(env0, arg0)
{
//
// knd = 0
var tmpret13
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_9
tmpret13 = ats2jspre_int_forall_cloref(env0, arg0);
return tmpret13;
} // end-of-function
function
ats2jspre_int_foreach_method(arg0)
{
//
// knd = 0
var tmpret14
var tmplab, tmplab_js
//
// __patsflab_int_foreach_method
tmpret14 = _ats2jspre_intrange_patsfun_11__closurerize(arg0);
return tmpret14;
} // end-of-function
function
_ats2jspre_intrange_patsfun_11(env0, arg0)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_11
ats2jspre_int_foreach_cloref(env0, arg0);
return/*_void*/;
} // end-of-function
function
ats2jspre_int_foldleft_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret16
var tmplab, tmplab_js
//
// __patsflab_int_foldleft_cloref
tmpret16 = ats2jspre_intrange_foldleft_cloref(0, arg0, arg1, arg2);
return tmpret16;
} // end-of-function
function
ats2jspre_int_foldleft_method(arg0, arg1)
{
//
// knd = 0
var tmpret17
var tmplab, tmplab_js
//
// __patsflab_int_foldleft_method
tmpret17 = _ats2jspre_intrange_patsfun_14__closurerize(arg0);
return tmpret17;
} // end-of-function
function
_ats2jspre_intrange_patsfun_14(env0, arg0, arg1)
{
//
// knd = 0
var tmpret18
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_14
tmpret18 = ats2jspre_int_foldleft_cloref(env0, arg0, arg1);
return tmpret18;
} // end-of-function
function
_057_home_057_hwxi_057_research_057_Postiats_055_contrib_057_git_057_contrib_057_libatscc_057_libatscc2js_057_SATS_057_intrange_056_sats__int_list_map_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret19
var tmplab, tmplab_js
//
// __patsflab_int_list_map_cloref
tmpret19 = _ats2jspre_intrange_aux_16(arg0, arg1, 0);
return tmpret19;
} // end-of-function
function
_ats2jspre_intrange_aux_16(env0, env1, arg0)
{
//
// knd = 0
var tmpret20
var tmp21
var tmp22
var tmp23
var tmp24
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_aux_16
tmp21 = ats2jspre_lt_int1_int1(arg0, env0);
if(tmp21) {
tmp22 = env1[0](env1, arg0);
tmp24 = ats2jspre_add_int1_int1(arg0, 1);
tmp23 = _ats2jspre_intrange_aux_16(env0, env1, tmp24);
tmpret20 = [tmp22, tmp23];
} else {
tmpret20 = null;
} // endif
return tmpret20;
} // end-of-function
function
_057_home_057_hwxi_057_research_057_Postiats_055_contrib_057_git_057_contrib_057_libatscc_057_libatscc2js_057_SATS_057_intrange_056_sats__int_list_map_method(arg0, arg1)
{
//
// knd = 0
var tmpret25
var tmplab, tmplab_js
//
// __patsflab_int_list_map_method
tmpret25 = _ats2jspre_intrange_patsfun_18__closurerize(arg0);
return tmpret25;
} // end-of-function
function
_ats2jspre_intrange_patsfun_18(env0, arg0)
{
//
// knd = 0
var tmpret26
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_18
tmpret26 = _057_home_057_hwxi_057_research_057_Postiats_055_contrib_057_git_057_contrib_057_libatscc_057_libatscc2js_057_SATS_057_intrange_056_sats__int_list_map_cloref(env0, arg0);
return tmpret26;
} // end-of-function
function
ats2jspre_int2_exists_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret27
var tmplab, tmplab_js
//
// __patsflab_int2_exists_cloref
tmpret27 = ats2jspre_intrange2_exists_cloref(0, arg0, 0, arg1, arg2);
return tmpret27;
} // end-of-function
function
ats2jspre_int2_forall_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret28
var tmplab, tmplab_js
//
// __patsflab_int2_forall_cloref
tmpret28 = ats2jspre_intrange2_forall_cloref(0, arg0, 0, arg1, arg2);
return tmpret28;
} // end-of-function
function
ats2jspre_int2_foreach_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_int2_foreach_cloref
ats2jspre_intrange2_foreach_cloref(0, arg0, 0, arg1, arg2);
return/*_void*/;
} // end-of-function
function
ats2jspre_intrange_exists_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret30
var tmplab, tmplab_js
//
// __patsflab_intrange_exists_cloref
tmpret30 = _ats2jspre_intrange_loop_23(arg0, arg1, arg2);
return tmpret30;
} // end-of-function
function
_ats2jspre_intrange_loop_23(arg0, arg1, arg2)
{
//
// knd = 1
var apy0
var apy1
var apy2
var tmpret31
var tmp32
var tmp33
var tmp34
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_intrange_loop_23
tmp32 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp32) {
tmp33 = arg2[0](arg2, arg0);
if(tmp33) {
tmpret31 = true;
} else {
tmp34 = ats2jspre_add_int0_int0(arg0, 1);
// ATStailcalseq_beg
apy0 = tmp34;
apy1 = arg1;
apy2 = arg2;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop_23
// ATStailcalseq_end
} // endif
} else {
tmpret31 = false;
} // endif
if (funlab_js > 0) continue; else return tmpret31;
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange_forall_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret35
var tmplab, tmplab_js
//
// __patsflab_intrange_forall_cloref
tmpret35 = _ats2jspre_intrange_loop_25(arg0, arg1, arg2);
return tmpret35;
} // end-of-function
function
_ats2jspre_intrange_loop_25(arg0, arg1, arg2)
{
//
// knd = 1
var apy0
var apy1
var apy2
var tmpret36
var tmp37
var tmp38
var tmp39
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_intrange_loop_25
tmp37 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp37) {
tmp38 = arg2[0](arg2, arg0);
if(tmp38) {
tmp39 = ats2jspre_add_int0_int0(arg0, 1);
// ATStailcalseq_beg
apy0 = tmp39;
apy1 = arg1;
apy2 = arg2;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop_25
// ATStailcalseq_end
} else {
tmpret36 = false;
} // endif
} else {
tmpret36 = true;
} // endif
if (funlab_js > 0) continue; else return tmpret36;
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange_foreach_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_intrange_foreach_cloref
_ats2jspre_intrange_loop_27(arg0, arg1, arg2);
return/*_void*/;
} // end-of-function
function
_ats2jspre_intrange_loop_27(arg0, arg1, arg2)
{
//
// knd = 1
var apy0
var apy1
var apy2
var tmp42
var tmp44
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_intrange_loop_27
tmp42 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp42) {
arg2[0](arg2, arg0);
tmp44 = ats2jspre_add_int0_int0(arg0, 1);
// ATStailcalseq_beg
apy0 = tmp44;
apy1 = arg1;
apy2 = arg2;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop_27
// ATStailcalseq_end
} else {
// ATSINSmove_void
} // endif
if (funlab_js > 0) continue; else return/*_void*/;
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange_foldleft_cloref(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmpret45
var tmplab, tmplab_js
//
// __patsflab_intrange_foldleft_cloref
tmpret45 = _ats2jspre_intrange_loop_29(arg0, arg1, arg2, arg3);
return tmpret45;
} // end-of-function
function
_ats2jspre_intrange_loop_29(arg0, arg1, arg2, arg3)
{
//
// knd = 1
var apy0
var apy1
var apy2
var apy3
var tmpret46
var tmp47
var tmp48
var tmp49
var funlab_js
var tmplab, tmplab_js
//
while(true) {
funlab_js = 0;
// __patsflab__ats2jspre_intrange_loop_29
tmp47 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp47) {
tmp48 = ats2jspre_add_int0_int0(arg0, 1);
tmp49 = arg3[0](arg3, arg2, arg0);
// ATStailcalseq_beg
apy0 = tmp48;
apy1 = arg1;
apy2 = tmp49;
apy3 = arg3;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
arg3 = apy3;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop_29
// ATStailcalseq_end
} else {
tmpret46 = arg2;
} // endif
if (funlab_js > 0) continue; else return tmpret46;
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange_foldleft_method(arg0, arg1)
{
//
// knd = 0
var tmp50
var tmp51
var tmpret52
var tmplab, tmplab_js
//
// __patsflab_intrange_foldleft_method
tmp50 = arg0[0];
tmp51 = arg0[1];
tmpret52 = _ats2jspre_intrange_patsfun_31__closurerize(tmp50, tmp51);
return tmpret52;
} // end-of-function
function
_ats2jspre_intrange_patsfun_31(env0, env1, arg0, arg1)
{
//
// knd = 0
var tmpret53
var tmplab, tmplab_js
//
// __patsflab__ats2jspre_intrange_patsfun_31
tmpret53 = ats2jspre_intrange_foldleft_cloref(env0, env1, arg0, arg1);
return tmpret53;
} // end-of-function
function
ats2jspre_intrange2_exists_cloref(arg0, arg1, arg2, arg3, arg4)
{
//
// knd = 0
var tmpret54
var tmplab, tmplab_js
//
// __patsflab_intrange2_exists_cloref
tmpret54 = _ats2jspre_intrange_loop1_33(arg2, arg3, arg0, arg1, arg4);
return tmpret54;
} // end-of-function
function
_ats2jspre_intrange_loop1_33(env0, env1, arg0, arg1, arg2)
{
//
// knd = 2
var apy0
var apy1
var apy2
var tmpret55
var tmp56
var a2rg0
var a2rg1
var a2rg2
var a2rg3
var a2rg4
var a2py0
var a2py1
var a2py2
var a2py3
var a2py4
var tmpret57
var tmp58
var tmp59
var tmp60
var tmp61
var funlab_js
var tmplab, tmplab_js
//
funlab_js = 1;
while(true) {
switch(funlab_js) {
case 1: {
funlab_js = 0;
tmp56 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp56) {
// ATStailcalseq_beg
a2py0 = arg0;
a2py1 = arg1;
a2py2 = env0;
a2py3 = env1;
a2py4 = arg2;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_34
// ATStailcalseq_end
} else {
tmpret55 = false;
} // endif
if (funlab_js > 0) continue; else return tmpret55;
} // end-of-case
case 2: {
funlab_js = 0;
tmp58 = ats2jspre_lt_int0_int0(a2rg2, a2rg3);
if(tmp58) {
tmp59 = a2rg4[0](a2rg4, a2rg0, a2rg2);
if(tmp59) {
tmpret57 = true;
} else {
tmp60 = ats2jspre_add_int0_int0(a2rg2, 1);
// ATStailcalseq_beg
a2py0 = a2rg0;
a2py1 = a2rg1;
a2py2 = tmp60;
a2py3 = a2rg3;
a2py4 = a2rg4;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_34
// ATStailcalseq_end
} // endif
} else {
tmp61 = ats2jspre_add_int0_int0(a2rg0, 1);
// ATStailcalseq_beg
apy0 = tmp61;
apy1 = a2rg1;
apy2 = a2rg4;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop1_33
// ATStailcalseq_end
} // endif
if (funlab_js > 0) continue; else return tmpret57;
} // end-of-case
} // end-of-switch
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange2_forall_cloref(arg0, arg1, arg2, arg3, arg4)
{
//
// knd = 0
var tmpret62
var tmplab, tmplab_js
//
// __patsflab_intrange2_forall_cloref
tmpret62 = _ats2jspre_intrange_loop1_36(arg2, arg3, arg0, arg1, arg4);
return tmpret62;
} // end-of-function
function
_ats2jspre_intrange_loop1_36(env0, env1, arg0, arg1, arg2)
{
//
// knd = 2
var apy0
var apy1
var apy2
var tmpret63
var tmp64
var a2rg0
var a2rg1
var a2rg2
var a2rg3
var a2rg4
var a2py0
var a2py1
var a2py2
var a2py3
var a2py4
var tmpret65
var tmp66
var tmp67
var tmp68
var tmp69
var funlab_js
var tmplab, tmplab_js
//
funlab_js = 1;
while(true) {
switch(funlab_js) {
case 1: {
funlab_js = 0;
tmp64 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp64) {
// ATStailcalseq_beg
a2py0 = arg0;
a2py1 = arg1;
a2py2 = env0;
a2py3 = env1;
a2py4 = arg2;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_37
// ATStailcalseq_end
} else {
tmpret63 = true;
} // endif
if (funlab_js > 0) continue; else return tmpret63;
} // end-of-case
case 2: {
funlab_js = 0;
tmp66 = ats2jspre_lt_int0_int0(a2rg2, a2rg3);
if(tmp66) {
tmp67 = a2rg4[0](a2rg4, a2rg0, a2rg2);
if(tmp67) {
tmp68 = ats2jspre_add_int0_int0(a2rg2, 1);
// ATStailcalseq_beg
a2py0 = a2rg0;
a2py1 = a2rg1;
a2py2 = tmp68;
a2py3 = a2rg3;
a2py4 = a2rg4;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_37
// ATStailcalseq_end
} else {
tmpret65 = false;
} // endif
} else {
tmp69 = ats2jspre_add_int0_int0(a2rg0, 1);
// ATStailcalseq_beg
apy0 = tmp69;
apy1 = a2rg1;
apy2 = a2rg4;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop1_36
// ATStailcalseq_end
} // endif
if (funlab_js > 0) continue; else return tmpret65;
} // end-of-case
} // end-of-switch
} // endwhile-fun
} // end-of-function
function
ats2jspre_intrange2_foreach_cloref(arg0, arg1, arg2, arg3, arg4)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_intrange2_foreach_cloref
_ats2jspre_intrange_loop1_39(arg2, arg3, arg0, arg1, arg4);
return/*_void*/;
} // end-of-function
function
_ats2jspre_intrange_loop1_39(env0, env1, arg0, arg1, arg2)
{
//
// knd = 2
var apy0
var apy1
var apy2
var tmp72
var a2rg0
var a2rg1
var a2rg2
var a2rg3
var a2rg4
var a2py0
var a2py1
var a2py2
var a2py3
var a2py4
var tmp74
var tmp76
var tmp77
var funlab_js
var tmplab, tmplab_js
//
funlab_js = 1;
while(true) {
switch(funlab_js) {
case 1: {
funlab_js = 0;
tmp72 = ats2jspre_lt_int0_int0(arg0, arg1);
if(tmp72) {
// ATStailcalseq_beg
a2py0 = arg0;
a2py1 = arg1;
a2py2 = env0;
a2py3 = env1;
a2py4 = arg2;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_40
// ATStailcalseq_end
} else {
// ATSINSmove_void
} // endif
if (funlab_js > 0) continue; else return/*_void*/;
} // end-of-case
case 2: {
funlab_js = 0;
tmp74 = ats2jspre_lt_int0_int0(a2rg2, a2rg3);
if(tmp74) {
a2rg4[0](a2rg4, a2rg0, a2rg2);
tmp76 = ats2jspre_add_int0_int0(a2rg2, 1);
// ATStailcalseq_beg
a2py0 = a2rg0;
a2py1 = a2rg1;
a2py2 = tmp76;
a2py3 = a2rg3;
a2py4 = a2rg4;
a2rg0 = a2py0;
a2rg1 = a2py1;
a2rg2 = a2py2;
a2rg3 = a2py3;
a2rg4 = a2py4;
funlab_js = 2; // __patsflab__ats2jspre_intrange_loop2_40
// ATStailcalseq_end
} else {
tmp77 = ats2jspre_add_int0_int0(a2rg0, 1);
// ATStailcalseq_beg
apy0 = tmp77;
apy1 = a2rg1;
apy2 = a2rg4;
arg0 = apy0;
arg1 = apy1;
arg2 = apy2;
funlab_js = 1; // __patsflab__ats2jspre_intrange_loop1_39
// ATStailcalseq_end
} // endif
if (funlab_js > 0) continue; else return/*_void*/;
} // end-of-case
} // end-of-switch
} // endwhile-fun
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
function
ats2jspre_ref(arg0)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_ref
tmpret0 = ats2jspre_ref_make_elt(arg0);
return tmpret0;
} // end-of-function
function
ats2jspre_ref_make_elt(arg0)
{
//
// knd = 0
var tmpret1
var tmp2
var tmplab, tmplab_js
//
// __patsflab_ref_make_elt
tmp2 = ats2jspre_JSarray_sing(arg0);
tmpret1 = tmp2;
return tmpret1;
} // end-of-function
function
ats2jspre_ref_get_elt(arg0)
{
//
// knd = 0
var tmpret3
var tmplab, tmplab_js
//
// __patsflab_ref_get_elt
tmpret3 = ats2jspre_JSarray_get_at(arg0, 0);
return tmpret3;
} // end-of-function
function
ats2jspre_ref_set_elt(arg0, arg1)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_ref_set_elt
ats2jspre_JSarray_set_at(arg0, 0, arg1);
return/*_void*/;
} // end-of-function
function
ats2jspre_ref_exch_elt(arg0, arg1)
{
//
// knd = 0
var tmpret5
var tmp6
var tmplab, tmplab_js
//
// __patsflab_ref_exch_elt
tmp6 = ats2jspre_JSarray_get_at(arg0, 0);
ats2jspre_JSarray_set_at(arg0, 0, arg1);
tmpret5 = tmp6;
return tmpret5;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
/* ATSextcode_beg() */
//
function
ats2jspre_arrayref_make_elt
(n, x)
{
var A, i;
A = new Array(n);
for (i = 0; i < n; i += 1) A[i] = x;
return A;
}
//
/* ATSextcode_end() */
function
ats2jspre_arrayref_exists_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_arrayref_exists_cloref
tmpret0 = ats2jspre_int_exists_cloref(arg1, arg2);
return tmpret0;
} // end-of-function
function
ats2jspre_arrayref_forall_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret1
var tmplab, tmplab_js
//
// __patsflab_arrayref_forall_cloref
tmpret1 = ats2jspre_int_forall_cloref(arg1, arg2);
return tmpret1;
} // end-of-function
function
ats2jspre_arrayref_foreach_cloref(arg0, arg1, arg2)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_arrayref_foreach_cloref
ats2jspre_int_foreach_cloref(arg1, arg2);
return/*_void*/;
} // end-of-function
function
ats2jspre_arrszref_make_elt(arg0, arg1)
{
//
// knd = 0
var tmpret3
var tmp4
var tmplab, tmplab_js
//
// __patsflab_arrszref_make_elt
tmp4 = ats2jspre_arrayref_make_elt(arg0, arg1);
tmpret3 = ats2jspre_arrszref_make_arrayref(tmp4, arg0);
return tmpret3;
} // end-of-function
function
ats2jspre_arrszref_exists_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret5
var tmp6
var tmplab, tmplab_js
//
// __patsflab_arrszref_exists_cloref
tmp6 = ats2jspre_arrszref_size(arg0);
tmpret5 = ats2jspre_int_exists_cloref(tmp6, arg1);
return tmpret5;
} // end-of-function
function
ats2jspre_arrszref_forall_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret7
var tmp8
var tmplab, tmplab_js
//
// __patsflab_arrszref_forall_cloref
tmp8 = ats2jspre_arrszref_size(arg0);
tmpret7 = ats2jspre_int_forall_cloref(tmp8, arg1);
return tmpret7;
} // end-of-function
function
ats2jspre_arrszref_foreach_cloref(arg0, arg1)
{
//
// knd = 0
var tmp10
var tmplab, tmplab_js
//
// __patsflab_arrszref_foreach_cloref
tmp10 = ats2jspre_arrszref_size(arg0);
ats2jspre_int_foreach_cloref(tmp10, arg1);
return/*_void*/;
} // end-of-function
function
ats2jspre_arrayref_get_at(arg0, arg1)
{
//
// knd = 0
var tmpret11
var tmplab, tmplab_js
//
// __patsflab_arrayref_get_at
tmpret11 = ats2jspre_JSarray_get_at(arg0, arg1);
return tmpret11;
} // end-of-function
function
ats2jspre_arrayref_set_at(arg0, arg1, arg2)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_arrayref_set_at
ats2jspre_JSarray_set_at(arg0, arg1, arg2);
return/*_void*/;
} // end-of-function
function
ats2jspre_arrszref_make_arrayref(arg0, arg1)
{
//
// knd = 0
var tmpret13
var tmplab, tmplab_js
//
// __patsflab_arrszref_make_arrayref
tmpret13 = arg0;
return tmpret13;
} // end-of-function
function
ats2jspre_arrszref_size(arg0)
{
//
// knd = 0
var tmpret14
var tmp15
var tmplab, tmplab_js
//
// __patsflab_arrszref_size
tmp15 = ats2jspre_JSarray_length(arg0);
tmpret14 = tmp15;
return tmpret14;
} // end-of-function
function
ats2jspre_arrszref_get_at(arg0, arg1)
{
//
// knd = 0
var tmpret16
var tmplab, tmplab_js
//
// __patsflab_arrszref_get_at
tmpret16 = ats2jspre_JSarray_get_at(arg0, arg1);
return tmpret16;
} // end-of-function
function
ats2jspre_arrszref_set_at(arg0, arg1, arg2)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_arrszref_set_at
ats2jspre_JSarray_set_at(arg0, arg1, arg2);
return/*_void*/;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
/* ATSextcode_beg() */
//
function
ats2jspre_matrixref_make_elt
(m, n, x)
{
var A, i, j;
A = new Array(m*n);
for (i = 0; i < m; i += 1)
{
for (j = 0; j < n; j += 1) A[i*n+j] = x;
}
return A;
}
//
/* ATSextcode_end() */
/* ATSextcode_beg() */
//
function
ats2jspre_mtrxszref_make_matrixref
(M, m, n)
{
return { matrix: M, nrow: m, ncol: n };
}
//
function
ats2jspre_mtrxszref_get_nrow(MSZ) { return MSZ.nrow; }
function
ats2jspre_mtrxszref_get_ncol(MSZ) { return MSZ.ncol; }
//
function
ats2jspre_mtrxszref_get_at
(MSZ, i, j)
{
var nrow = MSZ.nrow;
var ncol = MSZ.ncol;
if (i < 0) throw new RangeError("mtrxszref_get_at");
if (i >= nrow) throw new RangeError("mtrxszref_get_at");
if (j < 0) throw new RangeError("mtrxszref_get_at");
if (j >= ncol) throw new RangeError("mtrxszref_get_at");
return MSZ.matrix[i*ncol+j];
}
//
function
ats2jspre_mtrxszref_set_at
(MSZ, i, j, x)
{
var nrow = MSZ.nrow;
var ncol = MSZ.ncol;
if (i < 0) throw new RangeError("mtrxszref_set_at");
if (i >= nrow) throw new RangeError("mtrxszref_set_at");
if (j < 0) throw new RangeError("mtrxszref_set_at");
if (j >= ncol) throw new RangeError("mtrxszref_set_at");
return (MSZ.matrix[i*ncol+j] = x);
}
//
/* ATSextcode_end() */
function
ats2jspre_matrixref_exists_cloref(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_matrixref_exists_cloref
tmpret0 = ats2jspre_int2_exists_cloref(arg1, arg2, arg3);
return tmpret0;
} // end-of-function
function
ats2jspre_matrixref_forall_cloref(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmpret1
var tmplab, tmplab_js
//
// __patsflab_matrixref_forall_cloref
tmpret1 = ats2jspre_int2_forall_cloref(arg1, arg2, arg3);
return tmpret1;
} // end-of-function
function
ats2jspre_matrixref_foreach_cloref(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_matrixref_foreach_cloref
ats2jspre_int2_foreach_cloref(arg1, arg2, arg3);
return/*_void*/;
} // end-of-function
function
ats2jspre_mtrxszref_make_elt(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret3
var tmp4
var tmplab, tmplab_js
//
// __patsflab_mtrxszref_make_elt
tmp4 = ats2jspre_matrixref_make_elt(arg0, arg1, arg2);
tmpret3 = ats2jspre_mtrxszref_make_matrixref(tmp4, arg0, arg1);
return tmpret3;
} // end-of-function
function
ats2jspre_mtrxszref_exists_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret5
var tmp6
var tmp7
var tmplab, tmplab_js
//
// __patsflab_mtrxszref_exists_cloref
tmp6 = ats2jspre_mtrxszref_get_nrow(arg0);
tmp7 = ats2jspre_mtrxszref_get_ncol(arg0);
tmpret5 = ats2jspre_int2_exists_cloref(tmp6, tmp7, arg1);
return tmpret5;
} // end-of-function
function
ats2jspre_mtrxszref_forall_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret8
var tmp9
var tmp10
var tmplab, tmplab_js
//
// __patsflab_mtrxszref_forall_cloref
tmp9 = ats2jspre_mtrxszref_get_nrow(arg0);
tmp10 = ats2jspre_mtrxszref_get_ncol(arg0);
tmpret8 = ats2jspre_int2_forall_cloref(tmp9, tmp10, arg1);
return tmpret8;
} // end-of-function
function
ats2jspre_mtrxszref_foreach_cloref(arg0, arg1)
{
//
// knd = 0
var tmp12
var tmp13
var tmplab, tmplab_js
//
// __patsflab_mtrxszref_foreach_cloref
tmp12 = ats2jspre_mtrxszref_get_nrow(arg0);
tmp13 = ats2jspre_mtrxszref_get_ncol(arg0);
ats2jspre_int2_foreach_cloref(tmp12, tmp13, arg1);
return/*_void*/;
} // end-of-function
function
ats2jspre_matrixref_get_at(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmpret14
var tmp15
var tmp16
var tmplab, tmplab_js
//
// __patsflab_matrixref_get_at
tmp16 = ats2jspre_mul_int1_int1(arg1, arg2);
tmp15 = ats2jspre_add_int1_int1(tmp16, arg3);
tmpret14 = ats2jspre_JSarray_get_at(arg0, tmp15);
return tmpret14;
} // end-of-function
function
ats2jspre_matrixref_set_at(arg0, arg1, arg2, arg3, arg4)
{
//
// knd = 0
var tmp18
var tmp19
var tmplab, tmplab_js
//
// __patsflab_matrixref_set_at
tmp19 = ats2jspre_mul_int1_int1(arg1, arg2);
tmp18 = ats2jspre_add_int1_int1(tmp19, arg3);
ats2jspre_JSarray_set_at(arg0, tmp18, arg4);
return/*_void*/;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/*
**
** The JavaScript code is generated by atscc2js
** The starting compilation time is: 2015-7-14: 0h:31m
**
*/
// ATSassume(_057_home_057_hwxi_057_research_057_Postiats_055_contrib_057_git_057_contrib_057_libatscc_057_libatscc2js_057_SATS_057_gmatrixref_056_sats__gmatrixref)
function
ats2jspre_gmatrixref_make_matrixref(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret0
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_make_matrixref
tmpret0 = [arg0, arg1, arg2, 0, 0, arg1, arg2];
return tmpret0;
} // end-of-function
function
ats2jspre_gmatrixref_make_subregion(arg0, arg1, arg2, arg3, arg4)
{
//
// knd = 0
var tmpret1
var tmp2
var tmp3
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_make_subregion
tmp2 = ats2jspre_add_int1_int1(arg0[3], arg1);
tmp3 = ats2jspre_add_int1_int1(arg0[4], arg2);
tmpret1 = [arg0[0], arg0[1], arg0[2], tmp2, tmp3, arg3, arg4];
return tmpret1;
} // end-of-function
function
ats2jspre_gmatrixref_get_at(arg0, arg1, arg2)
{
//
// knd = 0
var tmpret4
var tmp5
var tmp6
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_get_at
tmp5 = ats2jspre_add_int1_int1(arg0[3], arg1);
tmp6 = ats2jspre_add_int1_int1(arg0[4], arg2);
tmpret4 = ats2jspre_matrixref_get_at(arg0[0], tmp5, arg0[2], tmp6);
return tmpret4;
} // end-of-function
function
ats2jspre_gmatrixref_set_at(arg0, arg1, arg2, arg3)
{
//
// knd = 0
var tmp8
var tmp9
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_set_at
tmp8 = ats2jspre_add_int1_int1(arg0[3], arg1);
tmp9 = ats2jspre_add_int1_int1(arg0[4], arg2);
ats2jspre_matrixref_set_at(arg0[0], tmp8, arg0[2], tmp9, arg3);
return/*_void*/;
} // end-of-function
function
ats2jspre_gmatrixref_exists_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret10
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_exists_cloref
tmpret10 = ats2jspre_int2_exists_cloref(arg0[3], arg0[4], arg1);
return tmpret10;
} // end-of-function
function
ats2jspre_gmatrixref_forall_cloref(arg0, arg1)
{
//
// knd = 0
var tmpret11
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_forall_cloref
tmpret11 = ats2jspre_int2_forall_cloref(arg0[3], arg0[4], arg1);
return tmpret11;
} // end-of-function
function
ats2jspre_gmatrixref_foreach_cloref(arg0, arg1)
{
//
// knd = 0
var tmplab, tmplab_js
//
// __patsflab_gmatrixref_foreach_cloref
ats2jspre_int2_foreach_cloref(arg0[3], arg0[4], arg1);
return/*_void*/;
} // end-of-function
/* ****** ****** */
/* end-of-compilation-unit */
/* ****** ****** */
/* end of [libatscc2js_all.js] */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment