changeset 1404:82b204f20026

Patch from Vladimir Shabanov to support implicit passing of 'time' values from server to client
author Adam Chlipala <adam@chlipala.net>
date Thu, 20 Jan 2011 10:40:40 -0500
parents 860c245a7c4d
children 8631e9ed0ee8
files include/urweb.h src/c/urweb.c src/jscomp.sml src/settings.sml
diffstat 4 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/include/urweb.h	Tue Jan 18 13:32:48 2011 -0500
+++ b/include/urweb.h	Thu Jan 20 10:40:40 2011 -0500
@@ -123,6 +123,7 @@
 uw_unit uw_Basis_urlifyFloat_w(uw_context, uw_Basis_float);
 uw_unit uw_Basis_urlifyString_w(uw_context, uw_Basis_string);
 uw_unit uw_Basis_urlifyBool_w(uw_context, uw_Basis_bool);
+uw_unit uw_Basis_urlifyTime_w(uw_context, uw_Basis_time);
 uw_unit uw_Basis_urlifyChannel_w(uw_context, uw_Basis_channel);
 
 uw_Basis_unit uw_Basis_unurlifyUnit(uw_context ctx, char **s);
--- a/src/c/urweb.c	Tue Jan 18 13:32:48 2011 -0500
+++ b/src/c/urweb.c	Thu Jan 20 10:40:40 2011 -0500
@@ -1773,6 +1773,10 @@
   return uw_Basis_urlifyInt(ctx, (uw_Basis_int)t.seconds * 1000000 + t.microseconds);
 }
 
+uw_unit uw_Basis_urlifyTime_w(uw_context ctx, uw_Basis_time t) {
+  return uw_Basis_urlifyInt_w(ctx, (uw_Basis_int)t.seconds * 1000000 + t.microseconds);
+}
+
 uw_unit uw_Basis_urlifyString_w(uw_context ctx, uw_Basis_string s) {
   if (s[0] == '\0') {
     uw_check(ctx, 1);
--- a/src/jscomp.sml	Tue Jan 18 13:32:48 2011 -0500
+++ b/src/jscomp.sml	Thu Jan 20 10:40:40 2011 -0500
@@ -311,6 +311,7 @@
               | TFfi ("Basis", "string") => ("uu(t[i++])", st)
               | TFfi ("Basis", "char") => ("uu(t[i++])", st)
               | TFfi ("Basis", "int") => ("parseInt(t[i++])", st)
+              | TFfi ("Basis", "time") => ("parseInt(t[i++])", st)
               | TFfi ("Basis", "float") => ("parseFloat(t[i++])", st)
               | TFfi ("Basis", "channel") => ("(t[i++].length > 0 ? parseInt(t[i-1]) : null)", st)
 
--- a/src/settings.sml	Tue Jan 18 13:32:48 2011 -0500
+++ b/src/settings.sml	Thu Jan 20 10:40:40 2011 -0500
@@ -219,6 +219,7 @@
                           ("substring", "ssub"),
                           ("strcspn", "sspn"),
                           ("kc", "kc"),
+                          ("minTime", "0"),
 
                           ("islower", "isLower"),
                           ("isupper", "isUpper"),