// File generated by Gambit v4.9.3 // Link info: (409003 (js ()) "app_" (("lib") ("app")) (ffi nargs wrong_nargs stack sp r0 r1 string pollcount poll glo glo-println r2 pair make_interned_symbol peps module_register modlinkinfo module_registry_init check_procedure_glo check_procedure) (for-each app current-milliseconds append js-alert fib println ##apply-with-procedure-check-nary lib app# ##apply-global-with-procedure-check-nary) (for-each current-milliseconds append ##vm-main-module-ref lib# js-alert fib println ##program-descr app#) (for-each current-milliseconds append js-alert fib println app#) #f) g_glo = {}; g_host_function2scm = function (obj) { g_h2s_procedure = function () { return g_scm2host_call(obj); }; return g_h2s_procedure; }; G_ModLinkInfo = function (name,index) { this.name = name; this.index = index; }; g_module_count = 0; g_module_map = {}; g_module_table = null; g_nargs = 0; g_peps = {}; g_pollcount = 100; g_println = function (s) { console.log(s); }; G_ScmObj = function () { }; g_stack = []; g_str2codes = function (strng) { var codes = []; for (var i=0; i < strng.length; i++) { codes.push(strng.charCodeAt(i)); } return codes; }; g_str_hash = function (strng) { var h = 18652613; var i = 0; var leng = strng.length; while (i < leng) { h = ((h ^ strng.charCodeAt(i)) * 16777619) & 536870911; ++i; } return h; }; g_symbol_table = {}; G_Eof = function () { }; G_F32Vector = function (elems) { this.elems = elems; }; G_F64Vector = function (elems) { this.elems = elems; }; G_Flonum = function (val) { this.val = val; }; G_Flonum.prototype.toString = function () { return this.val.toString(); }; G_Jumpable = function () { }; G_Jumpable.prototype.jump = function () {}; g_module_latest_registered = null; g_module_registry_init = function (link_info) { var n = link_info.length; var i = 0; g_module_table = new Array(n); while (i < n) { var info = link_info[i]; g_module_map[info.name] = info; g_module_table[i] = null; ++i; } }; G_Pair = function (car,cdr) { this.car = car; this.cdr = cdr; }; g_r0 = void 0; g_r1 = void 0; g_r2 = void 0; g_r3 = void 0; G_S16Vector = function (elems) { this.elems = elems; }; G_S32Vector = function (elems) { this.elems = elems; }; G_S8Vector = function (elems) { this.elems = elems; }; g_scm_procedure2host = function (obj) { scm_procedure = function () { var args = Array.prototype.slice.call(arguments); return g_host2scm_call(obj,args); }; return scm_procedure; }; g_sp = -1; G_ScmString = function (codes) { this.codes = codes; }; G_ScmString.prototype.toString = function () { var limit = 32768; if (this.codes.length < limit) { return String.fromCharCode.apply(null,this.codes); } else { var chunks = []; var i = 0; while (i < this.codes.length) { chunks.push(String.fromCharCode.apply(null,this.codes.slice(i,i + limit))); i += limit; } return chunks.join(""); } }; G_Structure = function (slots) { this.slots = slots; if (slots[0] === null) { this.slots[0] = this; } }; G_Symbol = function (name,hash,interned) { this.name = name; this.hash = hash; this.interned = interned; }; G_Symbol.prototype.toString = function () { return this.name; }; G_U16Vector = function (elems) { this.elems = elems; }; G_U32Vector = function (elems) { this.elems = elems; }; G_U8Vector = function (elems) { this.elems = elems; }; G_ControlPoint = function (id,parent) { this.id = id; this.parent = parent; }; G_ControlPoint.prototype = Object.create(G_Jumpable.prototype); g_eof_obj = new G_Eof(); g_host2scm = function (obj) { if (obj === void 0) { return void 0; } if (obj === null) { return null; } if (typeof obj === "boolean") { return obj; } if (typeof obj === "number") { if ((obj | 0) === obj && obj >= -536870912 && obj <= 536870911) { return obj; } else { return new G_Flonum(obj); } } if (typeof obj === "function") { return g_host_function2scm(obj); } if (typeof obj === "string") { return new G_ScmString(g_str2codes(obj)); } if (obj instanceof Array) { return obj.map( g_host2scm ); } if (obj instanceof Uint8Array) { return new G_U8Vector(obj); } if (obj instanceof Uint16Array) { return new G_U16Vector(obj); } if (obj instanceof Uint32Array) { return new G_U32Vector(obj); } if (obj instanceof Int8Array) { return new G_S8Vector(obj); } if (obj instanceof Int16Array) { return new G_S16Vector(obj); } if (obj instanceof Int32Array) { return new G_S32Vector(obj); } if (obj instanceof Float32Array) { return new G_F32Vector(obj); } if (obj instanceof Float64Array) { return new G_F64Vector(obj); } if (typeof obj === "object") { var alist = null; for (var key in obj) { alist = new G_Pair(new G_Pair(g_host2scm(key),g_host2scm(obj[key])),alist); } return alist; } throw "host2scm error"; }; g_make_interned_symbol = function (name) { var obj = Object.prototype.hasOwnProperty.call(g_symbol_table,name) ? g_symbol_table[name] : null; if (obj === null) { obj = new G_Symbol(name,g_str_hash(name),false); obj.interned = true; g_symbol_table[name] = obj; } return obj; }; g_scm2host = function (obj) { if (obj === void 0) { return obj; } if (obj === null) { return obj; } if (typeof obj === "boolean") { return obj; } if (typeof obj === "number") { return obj; } if (obj instanceof G_Flonum) { return obj.val; } if (obj instanceof G_ScmString) { return obj.toString(); } if (obj instanceof Array) { return obj.map( g_scm2host ); } if (obj instanceof G_U8Vector) { return obj.elems; } if (obj instanceof G_U16Vector) { return obj.elems; } if (obj instanceof G_U32Vector) { return obj.elems; } if (obj instanceof G_S8Vector) { return obj.elems; } if (obj instanceof G_S16Vector) { return obj.elems; } if (obj instanceof G_S32Vector) { return obj.elems; } if (obj instanceof G_F32Vector) { return obj.elems; } if (obj instanceof G_F64Vector) { return obj.elems; } if (obj instanceof G_Pair) { var jsobj = {}; var i = 0; while (obj instanceof G_Pair) { var elem = obj.car; if (elem instanceof G_Pair) { jsobj[g_scm2host(elem.car)] = g_scm2host(elem.cdr); } else { jsobj[i] = g_scm2host(elem); } ++i; obj = obj.cdr; } return jsobj; } if (obj instanceof G_Structure) { throw "scm2host error (cannot convert Structure)"; } if (typeof obj === "function") { return g_scm_procedure2host(obj); } throw "scm2host error"; }; g_trampoline = function (pc) { while (pc !== null) { pc = pc(); } }; g_underflow = function () { var nextf = g_stack[0]; if (nextf === void 0) { return null; } var frame = nextf; var ra = frame[0]; var fs = ra.fs; var link = ra.link; g_stack = frame.slice(0,fs + 1); g_sp = fs; g_stack[0] = frame[link]; g_stack[link] = g_underflow; return ra; }; g_underflow.id = 0; g_underflow.parent = null; g_underflow.fs = 0; g_underflow.link = 0; G_EntryPoint = function (id,parent,nfree) { this.id = id; this.parent = parent; this.nfree = nfree; }; G_EntryPoint.prototype = Object.create(G_ControlPoint.prototype); g_module_register = function (module_descr) { var temp = module_descr[0]; var name = temp[temp.length - 1].name; var info = Object.prototype.hasOwnProperty.call(g_module_map,name) ? g_module_map[name] : null; g_module_latest_registered = module_descr; if (!(info === null || g_module_count === g_module_table.length)) { var index = info.index; var old = g_module_table[index]; g_module_table[index] = module_descr; if (old === null) { ++g_module_count; if (g_module_count === g_module_table.length) { g_glo["##program-descr"] = [g_module_table,null,false]; temp = g_module_table[g_module_table.length - 1][0]; g_glo["##vm-main-module-ref"] = temp[temp.length - 1]; g_sp = -1; g_stack[++g_sp] = void 0; g_r0 = g_underflow; g_nargs = 0; g_trampoline(g_module_table[0][4]); } } } }; g_poll = function (dest) { g_pollcount = 100; g_stack.length = g_sp + 1; return dest; }; G_ReturnPoint = function (id,parent,fs,link) { this.id = id; this.parent = parent; this.fs = fs; this.link = link; }; G_ReturnPoint.prototype = Object.create(G_ControlPoint.prototype); g_scm_call = function (proc,args) { g_sp = -1; g_stack[++g_sp] = void 0; g_nargs = args.length; i = 0; while (i < g_nargs) { g_stack[++g_sp] = args[i]; ++i; } if (g_nargs > 0) { if (g_nargs > 1) { if (g_nargs > 2) { g_r3 = g_stack[g_sp]; --g_sp; } g_r2 = g_stack[g_sp]; --g_sp; } g_r1 = g_stack[g_sp]; --g_sp; } g_r0 = g_underflow; g_trampoline(proc); return g_r1; }; g_tostr = function (obj) { if (obj === false) { return "#f"; } else { if (obj === true) { return "#t"; } else { if (obj === null) { return ""; } else { if (obj === void 0) { return "#!void"; } else { if (obj === g_eof_obj) { return "#!eof"; } else { if (obj instanceof G_Pair) { return g_tostr(obj.car) + g_tostr(obj.cdr); } else { return obj.toString(); } } } } } } }; g_bb1_println = function () { g_println(g_tostr(g_r1)); g_r1 = void 0; return g_r0; }; g_bb1_println.id = 0; g_bb1_println.parent = null; g_bb1_println.nfree = -1; g_glo["println"] = g_bb1_println; g_heapify_cont = function (ra) { if (g_sp > 0) { var fs = ra.fs; var link = ra.link; var base = g_sp - fs; var chain; if (base > 0) { chain = g_stack.slice(base,base + fs + 1); chain[0] = ra; g_sp = base; var prev_frame = chain; var prev_link = link; ra = prev_frame[prev_link]; fs = ra.fs; link = ra.link; base = g_sp - fs; while (base > 0) { var frame = g_stack.slice(base,base + fs + 1); frame[0] = ra; g_sp = base; prev_frame[prev_link] = frame; prev_frame = frame; prev_link = link; ra = prev_frame[prev_link]; fs = ra.fs; link = ra.link; base = g_sp - fs; } g_stack[link] = g_stack[0]; g_stack[0] = ra; prev_frame[prev_link] = (g_stack.length = fs + 1 , g_stack); } else { g_stack[link] = g_stack[0]; g_stack[0] = ra; chain = (g_stack.length = fs + 1 , g_stack); } g_stack = [chain]; g_sp = 0; } return g_underflow; }; g_host2scm_call = function (proc,args) { return g_scm2host(g_scm_call(proc,args.map( g_host2scm ))); }; g_prepend_arg1 = function (arg1) { var i = 0; if (g_nargs > 0) { g_stack[++g_sp] = g_r1; if (g_nargs > 1) { g_stack[++g_sp] = g_r2; if (g_nargs > 2) { g_stack[++g_sp] = g_r3; } } } g_stack[++g_sp] = null; while (i < g_nargs) { g_stack[g_sp - i] = g_stack[g_sp - (i + 1)]; ++i; } g_stack[g_sp - i] = arg1; ++g_nargs; if (g_nargs > 0) { if (g_nargs > 1) { if (g_nargs > 2) { g_r3 = g_stack[g_sp]; --g_sp; } g_r2 = g_stack[g_sp]; --g_sp; } g_r1 = g_stack[g_sp]; --g_sp; } }; g_check_procedure = function (dest) { if (!(typeof dest === "function")) { g_prepend_arg1(dest); dest = g_glo["##apply-with-procedure-check-nary"]; } return dest; }; g_check_procedure_glo = function (dest,gv) { if (!(typeof dest === "function")) { g_prepend_arg1(gv); dest = g_glo["##apply-global-with-procedure-check-nary"]; } return dest; }; g_scm2host_call = function (fn) { if (g_nargs > 0) { g_stack[++g_sp] = g_r1; if (g_nargs > 1) { g_stack[++g_sp] = g_r2; if (g_nargs > 2) { g_stack[++g_sp] = g_r3; } } } var args = g_stack.slice(g_sp + 1 - g_nargs,g_sp + 1 - g_nargs + g_nargs); g_sp += - g_nargs; var ra = g_heapify_cont(g_r0); var frame = g_stack[0]; var tmp = args.map( g_scm2host ); tmp = fn.apply( null, tmp ); g_r1 = g_host2scm(tmp); g_sp = -1; g_stack[++g_sp] = frame; return ra; }; g_wrong_nargs = function (proc) { g_prepend_arg1(proc); return g_peps["##raise-wrong-number-of-arguments-exception-nary"]; }; g_module_registry_init([new G_ModLinkInfo("lib",0),new G_ModLinkInfo("app",1)]);