Mercurial > urweb
comparison src/cjr_print.sml @ 121:91027db5a07c
Multiple arguments to web functions
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 13 Jul 2008 20:24:05 -0400 |
parents | 6230bdd122e7 |
children | 78d59cf0a0cc |
comparison
equal
deleted
inserted
replaced
120:6230bdd122e7 | 121:91027db5a07c |
---|---|
147 space, | 147 space, |
148 string "=", | 148 string "=", |
149 space, | 149 space, |
150 p_exp env e, | 150 p_exp env e, |
151 string ";"] | 151 string ";"] |
152 | DFun (fx, n, x, dom, ran, e) => | 152 | DFun (fx, n, args, ran, e) => |
153 let | 153 let |
154 val env' = E.pushERel env x dom | 154 val nargs = length args |
155 val env' = foldl (fn ((x, dom), env) => E.pushERel env x dom) env args | |
155 in | 156 in |
156 box [string "static", | 157 box [string "static", |
157 space, | 158 space, |
158 p_typ env ran, | 159 p_typ env ran, |
159 space, | 160 space, |
160 string ("__lwn_" ^ fx ^ "_" ^ Int.toString n), | 161 string ("__lwn_" ^ fx ^ "_" ^ Int.toString n), |
161 string "(lw_context ctx, ", | 162 string "(", |
162 p_typ env dom, | 163 p_list_sep (box [string ",", space]) (fn x => x) |
163 space, | 164 (string "lw_context ctx" :: ListUtil.mapi (fn (i, (_, dom)) => |
164 p_rel env' 0, | 165 box [p_typ env dom, |
166 space, | |
167 p_rel env' (nargs - i - 1)]) args), | |
165 string ")", | 168 string ")", |
166 space, | 169 space, |
167 string "{", | 170 string "{", |
168 newline, | 171 newline, |
169 box[string "return(", | 172 box[string "return(", |