summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 53587ff7..1fdb45d9 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -482,6 +482,11 @@ fun isFile (t : typ) =
TFfi ("Basis", "file") => true
| _ => false
+fun isString (t : typ) =
+ case #1 t of
+ TFfi ("Basis", "string") => true
+ | _ => false
+
fun p_sql_type t = string (Settings.p_sql_ctype t)
fun getPargs (e, _) =
@@ -2789,7 +2794,7 @@ fun p_file env (ds, ps) =
string "}"]
end
- fun getInput (x, t) =
+ fun getInput includesFile (x, t) =
let
val n = case SM.find (fnums, x) of
NONE => raise Fail ("CjrPrint: Can't find " ^ x ^ " in fnums")
@@ -2839,7 +2844,7 @@ fun p_file env (ds, ps) =
xts,
newline,
p_list_sep (box []) (fn (x, t) =>
- box [getInput (x, t),
+ box [getInput includesFile (x, t),
string "result.__uwf_",
string x,
space,
@@ -2902,7 +2907,7 @@ fun p_file env (ds, ps) =
xts,
newline,
p_list_sep (box []) (fn (x, t) =>
- box [getInput (x, t),
+ box [getInput includesFile (x, t),
string "result->__uwf_1.__uwf_",
string x,
space,
@@ -2955,7 +2960,10 @@ fun p_file env (ds, ps) =
space,
string "=",
space,
- unurlify true env t,
+ if includesFile andalso isString t then
+ string "request"
+ else
+ unurlify true env t,
string ";",
newline]
end
@@ -2975,6 +2983,7 @@ fun p_file env (ds, ps) =
(TRecord i, _) =>
let
val xts = E.lookupStruct env i
+ val includesFile = List.exists (fn (_, t) => isFile t) xts
in
(List.take (ts, length ts - 2),
box [box (map (fn (x, t) => box [p_typ env t,
@@ -2984,7 +2993,7 @@ fun p_file env (ds, ps) =
string ";",
newline]) xts),
newline,
- box (map getInput xts),
+ box (map (getInput includesFile) xts),
case i of
0 => string "uw_unit uw_inputs;"
| _ => box [string "struct __uws_",