comparison lib/js/urweb.js @ 1057:eaba663fd6aa

Represent FFI function names as strings, to deal with cross-file recursion
author Adam Chlipala <adamc@hcoop.net>
date Sat, 05 Dec 2009 14:01:34 -0500
parents a8a825861397
children e8a35d710ab9
comparison
equal deleted inserted replaced
1056:c42bfbd75ca9 1057:eaba663fd6aa
503 } 503 }
504 504
505 function ts(x) { return x.toString() } 505 function ts(x) { return x.toString() }
506 function bs(b) { return (b ? "True" : "False") } 506 function bs(b) { return (b ? "True" : "False") }
507 507
508 function id(x) { return x; }
508 function sub(s, i) { return s.charAt(i); } 509 function sub(s, i) { return s.charAt(i); }
509 function suf(s, i) { return s.substring(i); } 510 function suf(s, i) { return s.substring(i); }
510 function slen(s) { return s.length; } 511 function slen(s) { return s.length; }
511 function sidx(s, ch) { 512 function sidx(s, ch) {
512 var r = s.indexOf(ch); 513 var r = s.indexOf(ch);
1047 stack = cons({c: "1", n: e.n}, stack); 1048 stack = cons({c: "1", n: e.n}, stack);
1048 e = e.v; 1049 e = e.v;
1049 break; 1050 break;
1050 case "f": 1051 case "f":
1051 if (e.a == null) 1052 if (e.a == null)
1052 e = {c: "c", v: e.f()}; 1053 e = {c: "c", v: (eval(e.f))()};
1053 else { 1054 else {
1054 var args = []; 1055 var args = [];
1055 stack = cons({c: "f", f: e.f, args: args, pos: 0, a: e.a.next}, stack); 1056 stack = cons({c: "f", f: eval(e.f), args: args, pos: 0, a: e.a.next}, stack);
1056 if (!e.a.data.c) alert("[2] fr.f = " + e.f + "; 0 = " + e.a.data); 1057 if (!e.a.data.c) alert("[2] fr.f = " + e.f + "; 0 = " + e.a.data);
1057 e = e.a.data; 1058 e = e.a.data;
1058 } 1059 }
1059 break; 1060 break;
1060 case "l": 1061 case "l":