Mercurial > urweb
comparison src/cjr_print.sml @ 117:94856a3b4752
Serving pages
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 13 Jul 2008 15:44:00 -0400 |
parents | c5d7ce9ddd57 |
children | 7fdc146b2bc2 |
comparison
equal
deleted
inserted
replaced
116:c5d7ce9ddd57 | 117:94856a3b4752 |
---|---|
78 | EFfi (m, x) => box [string "lw_", string m, string "_", string x] | 78 | EFfi (m, x) => box [string "lw_", string m, string "_", string x] |
79 | EFfiApp (m, x, es) => box [string "lw_", | 79 | EFfiApp (m, x, es) => box [string "lw_", |
80 string m, | 80 string m, |
81 string "_", | 81 string "_", |
82 string x, | 82 string x, |
83 string "(", | 83 string "(ctx, ", |
84 p_list (p_exp env) es, | 84 p_list (p_exp env) es, |
85 string ")"] | 85 string ")"] |
86 | EApp (e1, e2) => parenIf par (box [p_exp' true env e1, | 86 | EApp (e1, e2) => parenIf par (box [p_exp' true env e1, |
87 string "(", | 87 string "(", |
88 p_exp env e2, | 88 p_exp env e2, |
109 | EField (e, x) => | 109 | EField (e, x) => |
110 box [p_exp' true env e, | 110 box [p_exp' true env e, |
111 string ".", | 111 string ".", |
112 string x] | 112 string x] |
113 | 113 |
114 | EWrite e => box [string "(lw_write(", | 114 | EWrite e => box [string "(lw_write(ctx, ", |
115 p_exp env e, | 115 p_exp env e, |
116 string "), lw_unit_v)"] | 116 string "), lw_unit_v)"] |
117 | 117 |
118 | ESeq (e1, e2) => box [string "(", | 118 | ESeq (e1, e2) => box [string "(", |
119 p_exp env e1, | 119 p_exp env e1, |
156 box [string "static", | 156 box [string "static", |
157 space, | 157 space, |
158 p_typ env ran, | 158 p_typ env ran, |
159 space, | 159 space, |
160 string ("__lwn_" ^ fx ^ "_" ^ Int.toString n), | 160 string ("__lwn_" ^ fx ^ "_" ^ Int.toString n), |
161 string "(", | 161 string "(lw_context ctx, ", |
162 p_typ env dom, | 162 p_typ env dom, |
163 space, | 163 space, |
164 p_rel env' 0, | 164 p_rel env' 0, |
165 string ")", | 165 string ")", |
166 space, | 166 space, |
177 box [string "if (!strcmp(request, \"", | 177 box [string "if (!strcmp(request, \"", |
178 string (String.toString s), | 178 string (String.toString s), |
179 string "\")) {", | 179 string "\")) {", |
180 newline, | 180 newline, |
181 p_enamed env n, | 181 p_enamed env n, |
182 string "(lw_unit_v);", | 182 string "(ctx, lw_unit_v);", |
183 newline, | 183 newline, |
184 string "}", | 184 string "}", |
185 newline] | 185 newline] |
186 | 186 |
187 fun p_file env (ds, ps) = | 187 fun p_file env (ds, ps) = |
195 box [string "#include \"lacweb.h\"", | 195 box [string "#include \"lacweb.h\"", |
196 newline, | 196 newline, |
197 newline, | 197 newline, |
198 p_list_sep newline (fn x => x) pds, | 198 p_list_sep newline (fn x => x) pds, |
199 newline, | 199 newline, |
200 string "void lw_handle(char *request) {", | 200 string "void lw_handle(lw_context ctx, char *request) {", |
201 newline, | 201 newline, |
202 p_list_sep newline (fn x => x) pds', | 202 p_list_sep newline (fn x => x) pds', |
203 newline, | 203 newline, |
204 string "}", | 204 string "}", |
205 newline] | 205 newline] |