Mercurial > urweb
comparison src/cjr_print.sml @ 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 | 438561303d02 |
children | 3e7c7e200713 |
comparison
equal
deleted
inserted
replaced
1634:f4cb4eebf7ae | 1635:8938f7b31573 |
---|---|
674 [(no_arg, _, NONE), (has_arg, _, SOME t)] => | 674 [(no_arg, _, NONE), (has_arg, _, SOME t)] => |
675 (no_arg, has_arg, t) | 675 (no_arg, has_arg, t) |
676 | [(has_arg, _, SOME t), (no_arg, _, NONE)] => | 676 | [(has_arg, _, SOME t), (no_arg, _, NONE)] => |
677 (no_arg, has_arg, t) | 677 (no_arg, has_arg, t) |
678 | _ => raise Fail "CjrPrint: unfooify misclassified Option datatype" | 678 | _ => raise Fail "CjrPrint: unfooify misclassified Option datatype" |
679 | |
680 val unboxable = isUnboxable t | |
679 in | 681 in |
680 unurlifies := IS.add (!unurlifies, i); | 682 unurlifies := IS.add (!unurlifies, i); |
681 addUrlHandler (box [string "static", | 683 addUrlHandler (box [string "static", |
682 space, | 684 space, |
683 p_typ env t, | 685 p_typ env t, |
684 space, | 686 space, |
685 string "*unurlify_", | 687 if unboxable then |
688 box [] | |
689 else | |
690 string "*", | |
691 string "unurlify_", | |
686 string (Int.toString i), | 692 string (Int.toString i), |
687 string "(uw_context, char **);", | 693 string "(uw_context, char **);", |
688 newline], | 694 newline], |
689 box [string "static", | 695 box [string "static", |
690 space, | 696 space, |
691 p_typ env t, | 697 p_typ env t, |
692 space, | 698 space, |
693 string "*unurlify_", | 699 if unboxable then |
700 box [] | |
701 else | |
702 string "*", | |
703 string "unurlify_", | |
694 string (Int.toString i), | 704 string (Int.toString i), |
695 string "(uw_context ctx, char **request) {", | 705 string "(uw_context ctx, char **request) {", |
696 newline, | 706 newline, |
697 box [string "return ((*request)[0] == '/' ? ++*request : *request,", | 707 box [string "return ((*request)[0] == '/' ? ++*request : *request,", |
698 newline, | 708 newline, |
723 space, | 733 space, |
724 string (Int.toString (size has_arg)), | 734 string (Int.toString (size has_arg)), |
725 string ", ((*request)[0] == '/' ? ++*request : NULL), ", | 735 string ", ((*request)[0] == '/' ? ++*request : NULL), ", |
726 newline, | 736 newline, |
727 | 737 |
728 if isUnboxable t then | 738 if unboxable then |
729 unurlify' "(*request)" (#1 t) | 739 unurlify' "(*request)" (#1 t) |
730 else | 740 else |
731 box [string "({", | 741 box [string "({", |
732 newline, | 742 newline, |
733 p_typ env t, | 743 p_typ env t, |