comparison src/cjr_print.sml @ 116:c5d7ce9ddd57

Basic web server
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 13:38:23 -0400
parents ff13d390ec60
children 94856a3b4752
comparison
equal deleted inserted replaced
115:ff13d390ec60 116:c5d7ce9ddd57
172 newline, 172 newline,
173 string "}"] 173 string "}"]
174 end 174 end
175 175
176 fun p_page env (s, n) = 176 fun p_page env (s, n) =
177 box [string "/* ", 177 box [string "if (!strcmp(request, \"",
178 string s, 178 string (String.toString s),
179 string " */ ", 179 string "\")) {",
180 newline,
180 p_enamed env n, 181 p_enamed env n,
181 string "(lw_unit_v);"] 182 string "(lw_unit_v);",
183 newline,
184 string "}",
185 newline]
182 186
183 fun p_file env (ds, ps) = 187 fun p_file env (ds, ps) =
184 let 188 let
185 val (pds, env) = ListUtil.foldlMap (fn (d, env) => 189 val (pds, env) = ListUtil.foldlMap (fn (d, env) =>
186 (p_decl env d, 190 (p_decl env d,
191 box [string "#include \"lacweb.h\"", 195 box [string "#include \"lacweb.h\"",
192 newline, 196 newline,
193 newline, 197 newline,
194 p_list_sep newline (fn x => x) pds, 198 p_list_sep newline (fn x => x) pds,
195 newline, 199 newline,
196 string "void lw_handle(void) {", 200 string "void lw_handle(char *request) {",
197 newline, 201 newline,
198 p_list_sep newline (fn x => x) pds', 202 p_list_sep newline (fn x => x) pds',
199 newline, 203 newline,
200 string "}", 204 string "}",
201 newline] 205 newline]