Mercurial > urweb
comparison src/cjr_print.sml @ 143:4b9c2bd6157c
Almost ready to have a form work
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 20 Jul 2008 13:30:19 -0400 |
parents | 133fa2d51bb4 |
children | f0d3402184d1 |
comparison
equal
deleted
inserted
replaced
142:6f9e224692ec | 143:4b9c2bd6157c |
---|---|
206 newline, | 206 newline, |
207 p_list_sep newline (p_fun env) vis, | 207 p_list_sep newline (p_fun env) vis, |
208 newline] | 208 newline] |
209 end | 209 end |
210 | 210 |
211 fun unurlify (t, loc) = | 211 fun unurlify env (t, loc) = |
212 case t of | 212 case t of |
213 TFfi ("Basis", "int") => string "lw_unurlifyInt(&request)" | 213 TFfi ("Basis", "int") => string "lw_unurlifyInt(&request)" |
214 | TFfi ("Basis", "float") => string "lw_unurlifyFloat(&request)" | 214 | TFfi ("Basis", "float") => string "lw_unurlifyFloat(&request)" |
215 | TFfi ("Basis", "string") => string "lw_unurlifyString(ctx, &request)" | 215 | TFfi ("Basis", "string") => string "lw_unurlifyString(ctx, &request)" |
216 | 216 |
217 | TRecord 0 => string "lw_unit_v" | 217 | TRecord 0 => string "lw_unit_v" |
218 | TRecord i => | |
219 let | |
220 val xts = E.lookupStruct env i | |
221 in | |
222 box [string "({", | |
223 newline, | |
224 box (map (fn (x, t) => | |
225 box [p_typ env t, | |
226 space, | |
227 string x, | |
228 space, | |
229 string "=", | |
230 space, | |
231 unurlify env t, | |
232 string ";", | |
233 newline]) xts), | |
234 string "struct", | |
235 space, | |
236 string "__lws_", | |
237 string (Int.toString i), | |
238 space, | |
239 string "__lw_tmp", | |
240 space, | |
241 string "=", | |
242 space, | |
243 string "{", | |
244 space, | |
245 p_list_sep (box [string ",", space]) (fn (x, _) => string x) xts, | |
246 space, | |
247 string "};", | |
248 newline, | |
249 string "__lw_tmp;", | |
250 newline, | |
251 string "})"] | |
252 end | |
218 | 253 |
219 | _ => (ErrorMsg.errorAt loc "Unable to choose a URL decoding function"; | 254 | _ => (ErrorMsg.errorAt loc "Unable to choose a URL decoding function"; |
220 space) | 255 space) |
221 | 256 |
222 fun p_page env (s, n, ts) = | 257 fun p_page env (s, n, ts) = |
239 string "arg", | 274 string "arg", |
240 string (Int.toString i), | 275 string (Int.toString i), |
241 space, | 276 space, |
242 string "=", | 277 string "=", |
243 space, | 278 space, |
244 unurlify t, | 279 unurlify env t, |
245 string ";", | 280 string ";", |
246 newline]) ts), | 281 newline]) ts), |
247 p_enamed env n, | 282 p_enamed env n, |
248 string "(", | 283 string "(", |
249 p_list_sep (box [string ",", space]) | 284 p_list_sep (box [string ",", space]) |