summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-14 10:31:11 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-14 10:31:11 -0400
commit471d135b67086298642e9bd26e0e380a605b7068 (patch)
tree5e1f870d80f1e625b95a2fae835753a0103a3285
parentb6163966d74b8f4636d63f28179205ed9f6daaaf (diff)
Improvements while working on Graftid
-rw-r--r--lib/js/urweb.js14
-rw-r--r--src/jscomp.sml8
-rw-r--r--src/settings.sml6
3 files changed, 17 insertions, 11 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 5482c2a5..2943c897 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -34,7 +34,9 @@ function pf() {
whine("Pattern match failure");
}
-function runHandlers(ls, arg) {
+function runHandlers(kind, ls, arg) {
+ if (ls == null)
+ alert(kind + ": " + arg);
for (; ls; ls = ls.next)
try {
ls.data(arg)(null);
@@ -48,7 +50,7 @@ function onError(f) {
}
function er(s) {
- runHandlers(errorHandlers, s);
+ runHandlers("Error", errorHandlers, s);
throw {uw_error: s};
}
@@ -61,7 +63,7 @@ function onFail(f) {
function doExn(v) {
if (v == null || v.uw_error == null) {
var s = (v == null ? "null" : v.toString());
- runHandlers(failHandlers, s);
+ runHandlers("Fail", failHandlers, s);
}
}
@@ -72,7 +74,7 @@ function onDisconnect(f) {
}
function discon() {
- runHandlers(disconnectHandlers, null);
+ runHandlers("Disconnect", disconnectHandlers, null);
}
var connectHandlers = null;
@@ -82,7 +84,7 @@ function onConnectFail(f) {
}
function conn() {
- runHandlers(connectHandlers, null);
+ runHandlers("Connect", connectHandlers, null);
}
var serverHandlers = null;
@@ -92,7 +94,7 @@ function onServerError(f) {
}
function servErr(s) {
- runHandlers(serverHandlers, s);
+ runHandlers("Server", serverHandlers, s);
}
diff --git a/src/jscomp.sml b/src/jscomp.sml
index d10bfd50..c01b9e10 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -824,11 +824,11 @@ fun process file =
val (e, st) = jsE inner (e', st)
in
- (strcat (str "("
+ (strcat (str "(d0="
+ :: e
+ :: str ","
:: List.revAppend (cases,
- [str "d0=",
- e,
- str ",c0())"])), st)
+ [str "c0())"])), st)
end
| EStrcat (e1, e2) =>
diff --git a/src/settings.sml b/src/settings.sml
index d04720c8..bdadb318 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -144,7 +144,11 @@ val jsFuncsBase = basisM [("alert", "alert"),
("onFail", "onFail"),
("onConnectFail", "onConnectFail"),
("onDisconnect", "onDisconnect"),
- ("onServerError", "onServerError")]
+ ("onServerError", "onServerError"),
+ ("attrifyString", "escape"),
+ ("attrifyInt", "ts"),
+ ("attrifyFloat", "ts"),
+ ("attrifyBool", "bs")]
val jsFuncs = ref jsFuncsBase
fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls
fun jsFunc x = M.find (!jsFuncs, x)