changeset 1635:8938f7b31573

Fix C-side unurlification of unboxable Option datatypes
author Adam Chlipala <adam@chlipala.net>
date Sat, 17 Dec 2011 09:24:31 -0500
parents f4cb4eebf7ae
children 2b312f6d4007
files src/cjr_print.sml
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Dec 11 15:02:55 2011 -0500
+++ b/src/cjr_print.sml	Sat Dec 17 09:24:31 2011 -0500
@@ -676,13 +676,19 @@
                               | [(has_arg, _, SOME t), (no_arg, _, NONE)] =>
                                 (no_arg, has_arg, t)
                               | _ => raise Fail "CjrPrint: unfooify misclassified Option datatype"
+
+                        val unboxable = isUnboxable t
                     in
                         unurlifies := IS.add (!unurlifies, i);
                         addUrlHandler (box [string "static",
                                             space,
                                             p_typ env t,
                                             space,
-                                            string "*unurlify_",
+                                            if unboxable then
+                                                box []
+                                            else
+                                                string "*",
+                                            string "unurlify_",
                                             string (Int.toString i),
                                             string "(uw_context, char **);",
                                             newline],
@@ -690,7 +696,11 @@
                                             space,
                                             p_typ env t,
                                             space,
-                                            string "*unurlify_",
+                                            if unboxable then
+                                                box []
+                                            else
+                                                string "*",
+                                            string "unurlify_",
                                             string (Int.toString i),
                                             string "(uw_context ctx, char **request) {",
                                             newline,
@@ -725,7 +735,7 @@
                                                  string ", ((*request)[0] == '/' ? ++*request : NULL), ",
                                                  newline,
                                                  
-                                                 if isUnboxable  t then
+                                                 if unboxable then
                                                      unurlify' "(*request)" (#1 t)
                                                  else
                                                      box [string "({",