diff src/cjr_print.sml @ 186:88d46972de53

bool in Basis
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 18:53:20 -0400
parents 19ee24bffbc0
children 8e9f97508f0d
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Aug 03 17:57:47 2008 -0400
+++ b/src/cjr_print.sml	Sun Aug 03 18:53:20 2008 -0400
@@ -116,7 +116,7 @@
 fun p_patCon env pc =
     case pc of
         PConVar n => p_con_named env n
-      | PConFfi _ => raise Fail "CjrPrint PConFfi"
+      | PConFfi {mod = m, con, ...} => string ("lw_" ^ m ^ "_" ^ con)
 
 fun p_pat (env, exit, depth) (p, _) =
     case p of
@@ -276,7 +276,7 @@
             ("__lwd_" ^ dx ^ "_" ^ Int.toString dn,
              "__lwc_" ^ x ^ "_" ^ Int.toString n)
         end
-      | PConFfi {mod = m, datatyp, con} =>
+      | PConFfi {mod = m, datatyp, con, ...} =>
         ("lw_" ^ m ^ "_" ^ datatyp,
          "lw_" ^ m ^ "_" ^ con)
 
@@ -706,11 +706,15 @@
                              string "}"]
                 end
 
+        fun capitalize s =
+            if s = "" then
+                ""
+            else
+                str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
+
         fun unurlify (t, loc) =
             case t of
-                TFfi ("Basis", "int") => string "lw_unurlifyInt(&request)"
-              | TFfi ("Basis", "float") => string "lw_unurlifyFloat(&request)"
-              | TFfi ("Basis", "string") => string "lw_unurlifyString(ctx, &request)"
+                TFfi (m, t) => string ("lw_" ^ m ^ "_unurlify" ^ capitalize t ^ "(ctx, &request)")
 
               | TRecord 0 => string "lw_unit_v"
               | TRecord i =>