# HG changeset patch # User Adam Chlipala # Date 1324131871 18000 # Node ID 8938f7b315732c2dc65985955e304952a0a776c5 # Parent f4cb4eebf7ae4e2149133a13a029a4ffec746568 Fix C-side unurlification of unboxable Option datatypes diff -r f4cb4eebf7ae -r 8938f7b31573 src/cjr_print.sml --- 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 "({",