Mercurial > urweb
comparison src/prepare.sml @ 1663:0577be31a435
First part of changes to avoid depending on C function call argument order of evaluation (omitting normal Ur function calls, so far)
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 07 Jan 2012 15:56:22 -0500 |
parents | 8a169fc0838b |
children | 98895243b5b6 |
comparison
equal
deleted
inserted
replaced
1662:edf86cef0dba | 1663:0577be31a435 |
---|---|
65 SOME (#p_blank (Settings.currentDbms ()) (n + 1, t) :: ss, n + 1) | 65 SOME (#p_blank (Settings.currentDbms ()) (n + 1, t) :: ss, n + 1) |
66 in | 66 in |
67 case #1 e of | 67 case #1 e of |
68 EPrim (Prim.String s) => | 68 EPrim (Prim.String s) => |
69 SOME (s :: ss, n) | 69 SOME (s :: ss, n) |
70 | EFfiApp ("Basis", "strcat", [e1, e2]) => | 70 | EFfiApp ("Basis", "strcat", [(e1, _), (e2, _)]) => |
71 (case prepString' (e1, ss, n) of | 71 (case prepString' (e1, ss, n) of |
72 NONE => NONE | 72 NONE => NONE |
73 | SOME (ss, n) => prepString' (e2, ss, n)) | 73 | SOME (ss, n) => prepString' (e2, ss, n)) |
74 | EFfiApp ("Basis", "sqlifyInt", [e]) => doOne Int | 74 | EFfiApp ("Basis", "sqlifyInt", [_]) => doOne Int |
75 | EFfiApp ("Basis", "sqlifyFloat", [e]) => doOne Float | 75 | EFfiApp ("Basis", "sqlifyFloat", [_]) => doOne Float |
76 | EFfiApp ("Basis", "sqlifyString", [e]) => doOne String | 76 | EFfiApp ("Basis", "sqlifyString", [_]) => doOne String |
77 | EFfiApp ("Basis", "sqlifyBool", [e]) => doOne Bool | 77 | EFfiApp ("Basis", "sqlifyBool", [_]) => doOne Bool |
78 | EFfiApp ("Basis", "sqlifyTime", [e]) => doOne Time | 78 | EFfiApp ("Basis", "sqlifyTime", [_]) => doOne Time |
79 | EFfiApp ("Basis", "sqlifyBlob", [e]) => doOne Blob | 79 | EFfiApp ("Basis", "sqlifyBlob", [_]) => doOne Blob |
80 | EFfiApp ("Basis", "sqlifyChannel", [e]) => doOne Channel | 80 | EFfiApp ("Basis", "sqlifyChannel", [_]) => doOne Channel |
81 | EFfiApp ("Basis", "sqlifyClient", [e]) => doOne Client | 81 | EFfiApp ("Basis", "sqlifyClient", [_]) => doOne Client |
82 | 82 |
83 | ECase (e, | 83 | ECase (e, |
84 [((PNone _, _), | 84 [((PNone _, _), |
85 (EPrim (Prim.String "NULL"), _)), | 85 (EPrim (Prim.String "NULL"), _)), |
86 ((PSome (_, (PVar _, _)), _), | 86 ((PSome (_, (PVar _, _)), _), |
87 (EFfiApp (m, x, [(ERel 0, _)]), _))], | 87 (EFfiApp (m, x, [((ERel 0, _), _)]), _))], |
88 _) => prepString' ((EFfiApp (m, x, [e]), #2 e), ss, n) | 88 {disc = t, ...}) => prepString' ((EFfiApp (m, x, [(e, t)]), #2 e), ss, n) |
89 | 89 |
90 | ECase (e, | 90 | ECase (e, |
91 [((PCon (_, PConFfi {mod = "Basis", con = "True", ...}, _), _), | 91 [((PCon (_, PConFfi {mod = "Basis", con = "True", ...}, _), _), |
92 (EPrim (Prim.String "TRUE"), _)), | 92 (EPrim (Prim.String "TRUE"), _)), |
93 ((PCon (_, PConFfi {mod = "Basis", con = "False", ...}, _), _), | 93 ((PCon (_, PConFfi {mod = "Basis", con = "False", ...}, _), _), |
128 ((ESome (t, e), loc), st) | 128 ((ESome (t, e), loc), st) |
129 end | 129 end |
130 | EFfi _ => (e, st) | 130 | EFfi _ => (e, st) |
131 | EFfiApp (m, x, es) => | 131 | EFfiApp (m, x, es) => |
132 let | 132 let |
133 val (es, st) = ListUtil.foldlMap prepExp st es | 133 val (es, st) = ListUtil.foldlMap (fn ((e, t), st) => |
134 let | |
135 val (e, st) = prepExp (e, st) | |
136 in | |
137 ((e, t), st) | |
138 end) st es | |
134 in | 139 in |
135 ((EFfiApp (m, x, es), loc), st) | 140 ((EFfiApp (m, x, es), loc), st) |
136 end | 141 end |
137 | EApp (e1, es) => | 142 | EApp (e1, es) => |
138 let | 143 let |
258 val s = case seq of | 263 val s = case seq of |
259 (EPrim (Prim.String s), loc) => | 264 (EPrim (Prim.String s), loc) => |
260 (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) | 265 (EPrim (Prim.String ("SELECT NEXTVAL('" ^ s ^ "')")), loc) |
261 | _ => | 266 | _ => |
262 let | 267 let |
263 val s' = (EFfiApp ("Basis", "strcat", [seq, (EPrim (Prim.String "')"), loc)]), loc) | 268 val t = (TFfi ("Basis", "string"), loc) |
269 val s' = (EFfiApp ("Basis", "strcat", [(seq, t), ((EPrim (Prim.String "')"), loc), t)]), loc) | |
264 in | 270 in |
265 (EFfiApp ("Basis", "strcat", [(EPrim (Prim.String "SELECT NEXTVAL('"), loc), s']), loc) | 271 (EFfiApp ("Basis", "strcat", [((EPrim (Prim.String "SELECT NEXTVAL('"), loc), t), (s', t)]), loc) |
266 end | 272 end |
267 in | 273 in |
268 case prepString (s, st) of | 274 case prepString (s, st) of |
269 NONE => (e, st) | 275 NONE => (e, st) |
270 | SOME (id, s, st) => | 276 | SOME (id, s, st) => |