summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-08-25 15:19:00 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-08-25 15:19:00 -0400
commitcbec909888bdb0837ade29efb199015226f0fcd3 (patch)
tree8c020dc4fcfc5dc64141f5158ab9c9410a2e075f
parente0d2bc5de775c9b87ec5402ef5a0d14eba9cc570 (diff)
Fix inconsistency in bool URLification between C and JavaScript
-rw-r--r--lib/js/urweb.js4
-rw-r--r--src/jscomp.sml2
-rw-r--r--src/settings.sml2
3 files changed, 6 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index ef2c7b49..251f64ba 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -471,6 +471,10 @@ function uu(s) {
return unescape(s.replace(new RegExp ("\\+", "g"), " "));
}
+function ub(b) {
+ return b ? "1" : "0";
+}
+
function uul(getToken, getData) {
var tok = getToken();
if (tok == "Nil") {
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 0ebdc94a..71046014 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -428,7 +428,7 @@ fun process file =
| 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
diff --git a/src/settings.sml b/src/settings.sml
index bb45cf9c..bed027a3 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -143,7 +143,7 @@ val jsFuncsBase = basisM [("alert", "alert"),
("urlifyInt", "ts"),
("urlifyFloat", "ts"),
("urlifyString", "uf"),
- ("urlifyBool", "bs"),
+ ("urlifyBool", "ub"),
("recv", "rv"),
("strcat", "cat"),
("intToString", "ts"),