comparison src/cjr_print.sml @ 1023:e46227efcbba

Bidding interface
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 10:20:20 -0500
parents 16f7cb0891b6
children dcc6093e9575
comparison
equal deleted inserted replaced
1022:4de35df3d545 1023:e46227efcbba
559 if s = "" then 559 if s = "" then
560 "" 560 ""
561 else 561 else
562 str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE) 562 str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE)
563 563
564 fun unurlify env (t, loc) = 564 fun unurlify fromClient env (t, loc) =
565 let 565 let
566 fun unurlify' rf t = 566 fun unurlify' rf t =
567 case t of 567 case t of
568 TFfi ("Basis", "unit") => string ("uw_unit_v") 568 TFfi ("Basis", "unit") => string "uw_unit_v"
569 | TFfi ("Basis", "string") => string (if fromClient then
570 "uw_Basis_unurlifyString_fromClient(ctx, &request)"
571 else
572 "uw_Basis_unurlifyString(ctx, &request)")
569 | TFfi (m, t) => string ("uw_" ^ ident m ^ "_unurlify" ^ capitalize t ^ "(ctx, &request)") 573 | TFfi (m, t) => string ("uw_" ^ ident m ^ "_unurlify" ^ capitalize t ^ "(ctx, &request)")
570 574
571 | TRecord 0 => string "uw_unit_v" 575 | TRecord 0 => string "uw_unit_v"
572 | TRecord i => 576 | TRecord i =>
573 let 577 let
1833 1837
1834 | EUnurlify (e, t) => 1838 | EUnurlify (e, t) =>
1835 let 1839 let
1836 fun getIt () = 1840 fun getIt () =
1837 if isUnboxable t then 1841 if isUnboxable t then
1838 unurlify env t 1842 unurlify false env t
1839 else 1843 else
1840 box [string "({", 1844 box [string "({",
1841 newline, 1845 newline,
1842 p_typ env t, 1846 p_typ env t,
1843 string " *tmp = uw_malloc(ctx, sizeof(", 1847 string " *tmp = uw_malloc(ctx, sizeof(",
1844 p_typ env t, 1848 p_typ env t,
1845 string "));", 1849 string "));",
1846 newline, 1850 newline,
1847 string "*tmp = ", 1851 string "*tmp = ",
1848 unurlify env t, 1852 unurlify false env t,
1849 string ";", 1853 string ";",
1850 newline, 1854 newline,
1851 string "tmp;", 1855 string "tmp;",
1852 newline, 1856 newline,
1853 string "})"] 1857 string "})"]
2439 string "uw_input_", 2443 string "uw_input_",
2440 p_ident x, 2444 p_ident x,
2441 space, 2445 space,
2442 string "=", 2446 string "=",
2443 space, 2447 space,
2444 unurlify env t, 2448 unurlify true env t,
2445 string ";", 2449 string ";",
2446 newline] 2450 newline]
2447 end 2451 end
2448 2452
2449 fun p_page (ek, s, n, ts, ran, side) = 2453 fun p_page (ek, s, n, ts, ran, side) =
2597 string "arg", 2601 string "arg",
2598 string (Int.toString i), 2602 string (Int.toString i),
2599 space, 2603 space,
2600 string "=", 2604 string "=",
2601 space, 2605 space,
2602 unurlify env t, 2606 unurlify false env t,
2603 string ";", 2607 string ";",
2604 newline]) ts), 2608 newline]) ts),
2605 defInputs, 2609 defInputs,
2606 box (case ek of 2610 box (case ek of
2607 Core.Rpc _ => [p_typ env ran, 2611 Core.Rpc _ => [p_typ env ran,