comparison src/cjr_print.sml @ 471:20fab0e96217

Tree demo working (and other assorted regressions fixed)
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 19:43:48 -0500
parents 7cb418e9714f
children c9566d49ecfe
comparison
equal deleted inserted replaced
470:7cb418e9714f 471:20fab0e96217
797 string "();", 797 string "();",
798 newline, 798 newline,
799 string "})"] 799 string "})"]
800 end 800 end
801 801
802 | TOption t =>
803 box [string "(request[0] == '/' ? ++request : request, ",
804 string "((!strncmp(request, \"None\", 4) ",
805 string "&& (request[4] == 0 || request[4] == '/')) ",
806 string "? (request += 4, NULL) ",
807 string ": ((!strncmp(request, \"Some\", 4) ",
808 string "&& request[4] == '/') ",
809 string "? (request += 5, ",
810 if isUnboxable t then
811 unurlify' rf (#1 t)
812 else
813 box [string "({",
814 newline,
815 p_typ env t,
816 space,
817 string "*tmp",
818 space,
819 string "=",
820 space,
821 string "uw_malloc(ctx, sizeof(",
822 p_typ env t,
823 string "));",
824 newline,
825 string "*tmp",
826 space,
827 string "=",
828 space,
829 unurlify' rf (#1 t),
830 string ";",
831 newline,
832 string "tmp;",
833 newline,
834 string "})"],
835 string ") :",
836 space,
837 string "(uw_error(ctx, FATAL, \"Error unurlifying option type\"), NULL))))"]
838
802 | _ => (ErrorMsg.errorAt loc "Unable to choose a URL decoding function"; 839 | _ => (ErrorMsg.errorAt loc "Unable to choose a URL decoding function";
803 space) 840 space)
804 in 841 in
805 unurlify' IS.empty t 842 unurlify' IS.empty t
806 end 843 end