summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-24 10:42:59 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-24 10:42:59 -0400
commit19754bcfbe11a079957aeb9f012f3ee70b31bb84 (patch)
tree4fca46ab109a2ef7f17bb130f1b00a26b41f0c91
parentf93acbb03f1ea669499bfb39d201ae8dd48f101b (diff)
demo/increment works with interpretation
-rw-r--r--lib/js/urweb.js19
-rw-r--r--src/jscomp.sml10
2 files changed, 16 insertions, 13 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 8170249b..5f9a0a13 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -618,7 +618,8 @@ function requestUri(xhr, uri, needsSig) {
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 rv(chn, parse, k) {
}
}
+function sl(ms, k) {
+ window.setTimeout(function() { execF(k, null); }, ms);
+}
+
// Key events
@@ -854,9 +859,6 @@ function exec0(env, e) {
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 @@ function exec0(env, e) {
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 @@ function exec0(env, e) {
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 @@ function exec0(env, e) {
stack = stack.next;
}
break;
- case "a3":
+ case "<":
env = fr.env;
stack = stack.next;
break;
@@ -923,7 +926,7 @@ function exec0(env, e) {
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 @@ function exec0(env, e) {
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;
diff --git a/src/jscomp.sml b/src/jscomp.sml
index b968ce79..1c94cd05 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -912,11 +912,11 @@ fun process file =
str (",cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return "
^ unurl ^ "}},cons("),
ek,
- str (",cons("
+ str (",cons({c:\"c\",v:"
^ (case eff of
ReadCookieWrite => "true"
| _ => "false")
- ^ ",null)))))}")],
+ ^ "},null)))))}")],
st)
end
@@ -940,10 +940,10 @@ fun process file =
val (e, st) = jsE inner (e, st)
val (ek, st) = jsE inner (ek, st)
in
- (strcat [str "{c:\"f\",f:window.setTimeout,a:cons(",
- ek,
- str ",cons(",
+ (strcat [str "{c:\"f\",f:sl,a:cons(",
e,
+ str ",cons(",
+ ek,
str ",null))}"],
st)
end