changeset 1109:631a3597c065

Proper [un]urlification of unit
author Adam Chlipala <adamc@hcoop.net>
date Fri, 01 Jan 2010 12:48:06 -0500 (2010-01-01)
parents 82ac88b4e0a7
children 7fc4e0087e50
files include/urweb.h src/c/urweb.c src/cjr_print.sml src/monoize.sml
diffstat 4 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/include/urweb.h	Fri Jan 01 10:49:36 2010 -0500
+++ b/include/urweb.h	Fri Jan 01 12:48:06 2010 -0500
@@ -117,6 +117,7 @@
 uw_unit uw_Basis_urlifyBool_w(uw_context, uw_Basis_bool);
 uw_unit uw_Basis_urlifyChannel_w(uw_context, uw_Basis_channel);
 
+uw_Basis_unit uw_Basis_unurlifyUnit(uw_context ctx, char **s);
 uw_Basis_int uw_Basis_unurlifyInt(uw_context, char **);
 uw_Basis_float uw_Basis_unurlifyFloat(uw_context, char **);
 uw_Basis_string uw_Basis_unurlifyString(uw_context, char **);
--- a/src/c/urweb.c	Fri Jan 01 10:49:36 2010 -0500
+++ b/src/c/urweb.c	Fri Jan 01 12:48:06 2010 -0500
@@ -1793,6 +1793,11 @@
   return r;
 }
 
+uw_Basis_unit uw_Basis_unurlifyUnit(uw_context ctx, char **s) {
+  *s = uw_unurlify_advance(*s);
+  return uw_unit_v;
+}
+
 uw_Basis_string uw_Basis_unurlifyString_fromClient(uw_context ctx, char **s) {
   char *new_s = uw_unurlify_advance(*s);
   char *r, *s1, *s2;
--- a/src/cjr_print.sml	Fri Jan 01 10:49:36 2010 -0500
+++ b/src/cjr_print.sml	Fri Jan 01 12:48:06 2010 -0500
@@ -565,14 +565,14 @@
     let
         fun unurlify' rf t =
             case t of
-                TFfi ("Basis", "unit") => string "uw_unit_v"
+                TFfi ("Basis", "unit") => string "uw_Basis_unurlifyUnit(ctx, &request)"
               | TFfi ("Basis", "string") => string (if fromClient then
                                                         "uw_Basis_unurlifyString_fromClient(ctx, &request)"
                                                     else
                                                         "uw_Basis_unurlifyString(ctx, &request)")
               | TFfi (m, t) => string ("uw_" ^ ident m ^ "_unurlify" ^ capitalize t ^ "(ctx, &request)")
 
-              | TRecord 0 => string "uw_unit_v"
+              | TRecord 0 => string "uw_Basis_unurlifyUnit(ctx, &request)"
               | TRecord i =>
                 let
                     val xts = E.lookupStruct env i
--- a/src/monoize.sml	Fri Jan 01 10:49:36 2010 -0500
+++ b/src/monoize.sml	Fri Jan 01 12:48:06 2010 -0500
@@ -433,7 +433,8 @@
                 end
               | _ =>
                 case t of
-                    L'.TFfi (m, x) => ((L'.EFfiApp (m, fk2s fk ^ "ify" ^ capitalize x, [e]), loc), fm)
+                    L'.TFfi ("Basis", "unit") => ((L'.EPrim (Prim.String ""), loc), fm)
+                  | L'.TFfi (m, x) => ((L'.EFfiApp (m, fk2s fk ^ "ify" ^ capitalize x, [e]), loc), fm)
 
                   | L'.TRecord [] => ((L'.EPrim (Prim.String ""), loc), fm)
                   | L'.TRecord ((x, t) :: xts) =>