Mercurial > urweb
diff lib/js/urweb.js @ 978:e1f3f1ea8cff
demo/increment works with interpretation
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 24 Sep 2009 10:42:59 -0400 |
parents | 2ecf308772ba |
children | 3612ff0c6a10 |
line wrap: on
line diff
--- a/lib/js/urweb.js Thu Sep 24 07:52:57 2009 -0400 +++ b/lib/js/urweb.js Thu Sep 24 10:42:59 2009 -0400 @@ -618,7 +618,8 @@ xhr.send(null); } -function rc(uri, parse, k, needsSig) { +function rc(prefix, uri, parse, k, needsSig) { + uri = cat(prefix, uri); uri = flattenLocal(uri); var xhr = getXHR(); @@ -790,6 +791,10 @@ } } +function sl(ms, k) { + window.setTimeout(function() { execF(k, null); }, ms); +} + // Key events @@ -854,9 +859,6 @@ var stack = null; while (true) { - if (!e.c) - throw ("Trace: " + trace); - trace += "|" + e.c; switch (e.c) { case "c": var v = e.v; @@ -879,6 +881,7 @@ e = {c: "c", v: fr.f.apply(null, fr.args)}; stack = stack.next; } else { + trace += "" + fr.pos; e = fr.a.data; fr.a = fr.a.next; } @@ -891,7 +894,7 @@ if (fr.f == null) throw "Ur: applying null function"; else if (fr.f.body) { - stack = cons({c: "a3", env: env}, stack.next); + stack = cons({c: "<", env: env}, stack.next); env = cons(v, fr.f.env); e = fr.f.body; } else { @@ -899,7 +902,7 @@ stack = stack.next; } break; - case "a3": + case "<": env = fr.env; stack = stack.next; break; @@ -923,7 +926,7 @@ stack = stack.next; break; case "=": - stack = cons({c: "a3", env: env}, stack.next); + stack = cons({c: "<", env: env}, stack.next); env = cons(v, env); e = fr.e2; break; @@ -932,7 +935,7 @@ for (ps = fr.p; ps != null; ps = ps.next) { var r = execP(env, ps.data.p, v); if (r != false) { - stack = cons({c: "a3", env: env}, stack.next); + stack = cons({c: "<", env: env}, stack.next); env = r; e = ps.data.b; break;