changeset 798:83875a9eb9b8

Improvements while working on Graftid
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 May 2009 10:31:11 -0400
parents 2c463eee89fa
children 9330ba3a2799
files lib/js/urweb.js src/jscomp.sml src/settings.sml
diffstat 3 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Thu May 14 09:33:48 2009 -0400
+++ b/lib/js/urweb.js	Thu May 14 10:31:11 2009 -0400
@@ -34,7 +34,9 @@
   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 er(s) {
-  runHandlers(errorHandlers, s);
+  runHandlers("Error", errorHandlers, s);
   throw {uw_error: s};
 }
 
@@ -61,7 +63,7 @@
 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 discon() {
-  runHandlers(disconnectHandlers, null);
+  runHandlers("Disconnect", disconnectHandlers, null);
 }
 
 var connectHandlers = null;
@@ -82,7 +84,7 @@
 }
 
 function conn() {
-  runHandlers(connectHandlers, null);
+  runHandlers("Connect", connectHandlers, null);
 }
 
 var serverHandlers = null;
@@ -92,7 +94,7 @@
 }
 
 function servErr(s) {
-  runHandlers(serverHandlers, s);
+  runHandlers("Server", serverHandlers, s);
 }
 
 
--- a/src/jscomp.sml	Thu May 14 09:33:48 2009 -0400
+++ b/src/jscomp.sml	Thu May 14 10:31:11 2009 -0400
@@ -824,11 +824,11 @@
 
                                     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) =>
--- a/src/settings.sml	Thu May 14 09:33:48 2009 -0400
+++ b/src/settings.sml	Thu May 14 10:31:11 2009 -0400
@@ -144,7 +144,11 @@
                           ("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)