changeset 889:bcad392e288e

Tweaking demos a bit
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 18:13:02 -0400
parents ba3569f4fe89
children 034eeb099564
files lib/js/urweb.js src/mysql.sml
diffstat 2 files changed, 62 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Fri Jul 17 17:14:23 2009 -0400
+++ b/lib/js/urweb.js	Fri Jul 17 18:13:02 2009 -0400
@@ -422,11 +422,11 @@
 }
 
 function uf(s) {
-  return escape(s).replace(new RegExp ("/", "g"), "%2F");
+  return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B");
 }
 
 function uu(s) {
-  return unescape(s).replace(new RegExp ("\\+", "g"), " ");
+  return unescape(s);
 }
 
 
@@ -564,7 +564,11 @@
       } catch (e) { }
 
       if (isok) {
-        var lines = xhr.responseText.split("\n");
+        var text = xhr.responseText
+        if (text == "")
+          return;
+        var lines = text.split("\n");
+
         if (lines.length < 2) {
           discon();
           return;
@@ -603,7 +607,7 @@
         try {
           if (xhr.status != 0)
             servErr("Error querying remote server for messages: " + xhr.status);
-        } catch (e) { servErr("Error querying remote server for messages"); }
+        } catch (e) { }
       }
     }
   };
--- a/src/mysql.sml	Fri Jul 17 17:14:23 2009 -0400
+++ b/src/mysql.sml	Fri Jul 17 18:13:02 2009 -0400
@@ -671,6 +671,16 @@
                              string "mktime(&t);",
                              newline,
                              string "})"]
+              | Channel => box [string "({",
+                                string "uw_Basis_channel ch = {buffer",
+                                string (Int.toString i),
+                                string " >> 32, buffer",
+                                string (Int.toString i),
+                                string " & 0xFFFFFFFF};",
+                                newline,
+                                string "ch;",
+                                newline,
+                                string "})"]
               | _ => box [string "buffer",
                           string (Int.toString i)]
     in
@@ -739,6 +749,10 @@
                                                                    string (Int.toString i),
                                                                    string ";",
                                                                    newline]
+                                                    | Channel => box [string "unsigned long long buffer",
+                                                                      string (Int.toString i),
+                                                                      string ";",
+                                                                      newline]
                                                     | _ => box [string (p_sql_ctype t),
                                                                 space,
                                                                 string "buffer",
@@ -906,8 +920,7 @@
                                                                    newline]
                                                     | Time => box [string "MYSQL_TIME in_buffer",
                                                                    string (Int.toString i),
-                                                                   string ";",
-                                                                   newline]
+                                                                   string ";",                                                                   newline]
                                                     | _ => box []
                                           in
                                               box [case t of
@@ -1062,6 +1075,20 @@
                                                                string ";",
                                                                newline]
                                                       end
+                                                    | Channel => box [string "in_buffer",
+                                                                      string (Int.toString i),
+                                                                      string " = ((unsigned long long)arg",
+                                                                      string (Int.toString (i + 1)),
+                                                                      string ".cli << 32) | arg",
+                                                                      string (Int.toString (i + 1)),
+                                                                      string ".chn;",
+                                                                      newline,
+                                                                      string "in[",
+                                                                      string (Int.toString i),
+                                                                      string "].buffer = &in_buffer",
+                                                                      string (Int.toString i),
+                                                                      string ";",
+                                                                      newline]
                                                                    
                                                     | _ => box [string "in[",
                                                                 string (Int.toString i),
@@ -1191,6 +1218,10 @@
                                                                    string (Int.toString i),
                                                                    string ";",
                                                                    newline]
+                                                    | Channel => box [string "unsigned long long in_buffer",
+                                                                      string (Int.toString i),
+                                                                      string ";",
+                                                                      newline]
                                                     | _ => box []
                                           in
                                               box [case t of
@@ -1320,6 +1351,20 @@
                                                                string ";",
                                                                newline]
                                                       end
+                                                    | Channel => box [string "in_buffer",
+                                                                      string (Int.toString i),
+                                                                      string " = ((unsigned long long)arg",
+                                                                      string (Int.toString (i + 1)),
+                                                                      string ".cli << 32) | arg",
+                                                                      string (Int.toString (i + 1)),
+                                                                      string ".chn;",
+                                                                      newline,
+                                                                      string "in[",
+                                                                      string (Int.toString i),
+                                                                      string "].buffer = &in_buffer",
+                                                                      string (Int.toString i),
+                                                                      string ";",
+                                                                      newline]
                                                                    
                                                     | _ => box [string "in[",
                                                                 string (Int.toString i),
@@ -1334,6 +1379,13 @@
                                                    string (p_buffer_type t),
                                                    string ";",
                                                    newline,
+
+                                                   case t of
+                                                       Channel => box [string "in[",
+                                                                       string (Int.toString i),
+                                                                       string "].is_unsigned = 1;",
+                                                                       newline]
+                                                     | _ => box [],
                                                                
                                                    case t of
                                                        Nullable t => box [string "in[",