summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-11-12 08:46:51 -0500
committerGravatar Ziv Scully <ziv@mit.edu>2015-11-12 08:46:51 -0500
commit6205c6660874af4147828e2610ca5c2feec834ad (patch)
tree3ae1ba40102d50b2e3c434a993e92d3d21d24987 /lib
parent7b14b2f01fd0218c0bbe0a5c4071fff190c91ce1 (diff)
parentdc8c8ed99b79e4f3c3c38f131dd7563148524591 (diff)
Merge.
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js21
-rw-r--r--lib/ur/basis.urs4
2 files changed, 22 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 335cb525..6cf8a3f3 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -149,6 +149,10 @@ function toMilliseconds(tm) {
return Math.round(tm / 1000);
}
+function fromMilliseconds(tm) {
+ return tm * 1000;
+}
+
function addSeconds(tm, n) {
return tm + n * 1000000;
}
@@ -468,8 +472,11 @@ function onConnectFail(f) {
connectHandlers = cons(flift(f), connectHandlers);
}
-function conn() {
- runHandlers("Connect", connectHandlers, null);
+function conn(msg) {
+ var rx = /(.*)<body>((.|\n|\r)*)<\/body>(.*)/g;
+ var arr = rx.exec(msg);
+ msg = (arr && arr.length >= 3) ? arr[2] : msg;
+ runHandlers("RPC failure", connectHandlers, msg);
}
var serverHandlers = null;
@@ -1468,6 +1475,14 @@ function strcmp(str1, str2) {
return ((str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1));
}
+function chr(n) {
+ return String.fromCharCode(n);
+}
+
+function htmlifySpecialChar(ch) {
+ return "&#" + ch.charCodeAt(0) + ";";
+}
+
// Remote calls
@@ -1591,7 +1606,7 @@ function rc(prefix, uri, parse, k, needsSig, isN) {
}
} else {
if (isN == null)
- conn();
+ conn(xhr.responseText);
else
k(null);
}
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index ec6ef599..a4872c32 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -163,6 +163,7 @@ val toSeconds : time -> int
val diffInSeconds : time -> time -> int
(* Earlier time first *)
val toMilliseconds : time -> int
+val fromMilliseconds : int -> time
val diffInMilliseconds : time -> time -> int
val timef : string -> time -> string (* Uses strftime() format string *)
val readUtc : string -> option time
@@ -553,6 +554,9 @@ val sql_div : t ::: Type -> sql_arith t -> sql_binary t t t
val sql_mod : sql_binary int int int
val sql_eq : t ::: Type -> sql_binary t t bool
+(* Note that the semantics of this operator on nullable types are different than for standard SQL!
+ * Instead, we do it the sane way, where [NULL = NULL]. *)
+
val sql_ne : t ::: Type -> sql_binary t t bool
val sql_lt : t ::: Type -> sql_binary t t bool
val sql_le : t ::: Type -> sql_binary t t bool