changeset 912:771449d8b411

Fix inconsistency in bool URLification between C and JavaScript
author Adam Chlipala <adamc@hcoop.net>
date Tue, 25 Aug 2009 15:19:00 -0400
parents 12c77dc567a2
children b26823138bf8
files lib/js/urweb.js src/jscomp.sml src/settings.sml
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Tue Aug 25 14:50:19 2009 -0400
+++ b/lib/js/urweb.js	Tue Aug 25 15:19:00 2009 -0400
@@ -471,6 +471,10 @@
   return unescape(s.replace(new RegExp ("\\+", "g"), " "));
 }
 
+function ub(b) {
+  return b ? "1" : "0";
+}
+
 function uul(getToken, getData) {
   var tok = getToken();
   if (tok == "Nil") {
--- a/src/jscomp.sml	Tue Aug 25 14:50:19 2009 -0400
+++ b/src/jscomp.sml	Tue Aug 25 15:19:00 2009 -0400
@@ -428,7 +428,7 @@
               | TFfi ("Basis", "float") => ("parseFloat(t[i++])", st)
               | TFfi ("Basis", "channel") => ("(t[i++].length > 0 ? parseInt(t[i]) : null)", st)
 
-              | TFfi ("Basis", "bool") => ("t[i++] == \"True\"", st)
+              | TFfi ("Basis", "bool") => ("t[i++] == \"1\"", st)
 
               | TOption t =>
                 let
--- a/src/settings.sml	Tue Aug 25 14:50:19 2009 -0400
+++ b/src/settings.sml	Tue Aug 25 15:19:00 2009 -0400
@@ -143,7 +143,7 @@
                           ("urlifyInt", "ts"),
                           ("urlifyFloat", "ts"),
                           ("urlifyString", "uf"),
-                          ("urlifyBool", "bs"),
+                          ("urlifyBool", "ub"),
                           ("recv", "rv"),
                           ("strcat", "cat"),
                           ("intToString", "ts"),