diff src/cjr_print.sml @ 1112:7a31e0cf25e9

Proper C-side deserialization; Shake.sliceDb
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Jan 2010 12:47:27 -0500
parents e1d738870086
children 01b6c7144a44
line wrap: on
line diff
--- a/src/cjr_print.sml	Sat Jan 02 14:54:15 2010 -0500
+++ b/src/cjr_print.sml	Sun Jan 03 12:47:27 2010 -0500
@@ -1863,7 +1863,7 @@
              newline,
              string "})"]
 
-      | EUnurlify (e, t) =>
+      | EUnurlify (e, t, true) =>
         let
             fun getIt () =
                 if isUnboxable t then
@@ -1898,6 +1898,40 @@
                  string "})"]
         end
 
+      | EUnurlify (e, t, false) =>
+        let
+            fun getIt () =
+                if isUnboxable t then
+                    unurlify false env t
+                else
+                    box [string "({",
+                         newline,
+                         p_typ env t,
+                         string " *tmp = uw_malloc(ctx, sizeof(",
+                         p_typ env t,
+                         string "));",
+                         newline,
+                         string "*tmp = ",
+                         unurlify false env t,
+                         string ";",
+                         newline,
+                         string "tmp;",
+                         newline,
+                         string "})"]
+        in
+            box [string "({",
+                 newline,
+                 string "uw_Basis_string request = uw_maybe_strdup(ctx, ",
+                 p_exp env e,
+                 string ");",
+                 newline,
+                 newline,
+                 unurlify false env t,
+                 string ";",
+                 newline,
+                 string "})"]
+        end
+
 and p_exp env = p_exp' false env
 
 fun p_fun env (fx, n, args, ran, e) =