diff src/settings.sml @ 2226:e10881cd92da

Merge.
author Ziv Scully <ziv@mit.edu>
date Fri, 27 Mar 2015 11:26:06 -0400
parents 365727ff68f4 8beeb4f761b5
children 25c94de06e3c
line wrap: on
line diff
--- a/src/settings.sml	Fri Mar 27 11:19:15 2015 -0400
+++ b/src/settings.sml	Fri Mar 27 11:26:06 2015 -0400
@@ -297,6 +297,8 @@
                           ("mouseEvent", "uw_mouseEvent"),
                           ("keyEvent", "uw_keyEvent"),
                           ("minTime", "0"),
+                          ("stringToBool_error", "s2be"),
+                          ("stringToBool", "s2b"),
 
                           ("islower", "isLower"),
                           ("isupper", "isUpper"),
@@ -378,6 +380,22 @@
 datatype path_kind = Any | Url | Table | Sequence | View | Relation | Cookie | Style
 type rewrite = { pkind : path_kind, kind : pattern_kind, from : string, to : string, hyphenate : bool }
 
+fun pak2s pak =
+    case pak of
+        Exact => "Exact"
+      | Prefix => "Prefix"
+fun pk2s pk =
+    case pk of
+        Any => "Any"
+      | Url => "Url"
+      | Table => "Table"
+      | Sequence => "Sequence"
+      | View => "View"
+      | Relation => "Relation"
+      | Cookie => "Cookie"
+      | Style => "Style"
+fun r2s (r : rewrite) = pak2s (#kind r) ^ " " ^ pk2s (#pkind r) ^ ", from<" ^ #from r ^ ">, to<" ^ #to r ^ ">"
+
 val rewrites = ref ([] : rewrite list)
 
 fun subsume (pk1, pk2) =
@@ -726,15 +744,46 @@
         "" => ""
       | _ => str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
 
+val allLower = CharVector.map Char.toLower
+
 val mangle = ref true
 fun setMangleSql x = mangle := x
-fun mangleSqlTable s = if !mangle then "uw_" ^ capitalize s
-                       else if #name (currentDbms ()) = "mysql" then capitalize s
-                       else lowercase s
-fun mangleSql s = if !mangle then "uw_" ^ s
-                  else if #name (currentDbms ()) = "mysql" then lowercase s
-                  else lowercase s
-fun mangleSqlCatalog s = if !mangle then "uw_" ^ s else lowercase s
+
+fun mangleSqlTable s =
+    if #name (currentDbms ()) = "mysql" then
+        if !mangle then
+            "uw_" ^ allLower s
+        else
+            allLower s
+    else
+        if !mangle then
+            "uw_" ^ capitalize s
+        else
+            lowercase s
+
+fun mangleSql s =
+    if #name (currentDbms ()) = "mysql" then
+        if !mangle then
+            "uw_" ^ allLower s 
+        else
+            allLower s
+    else
+        if !mangle then
+            "uw_" ^ s
+        else
+            lowercase s
+
+fun mangleSqlCatalog s =
+    if #name (currentDbms ()) = "mysql" then
+        if !mangle then
+            "uw_" ^ allLower s
+        else
+            allLower s
+    else
+        if !mangle then
+            "uw_" ^ s
+        else
+            lowercase s
 
 val html5 = ref false
 fun setIsHtml5 b = html5 := b
@@ -822,7 +871,7 @@
 
 fun addFile {Uri, LoadFromFilename} =
     let
-        val path = OS.Path.joinDirFile {dir = !filePath, file = LoadFromFilename}
+        val path = OS.Path.mkAbsolute {relativeTo = !filePath, path = LoadFromFilename}
     in
         case SM.find (!files, Uri) of
             SOME (path', _) =>