Mercurial > urweb
comparison src/compiler.sml @ 102:5f04adf47f48
Writing HTML
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 10 Jul 2008 14:02:54 -0400 |
parents | 82aaa1c406d3 |
children | 813e5a52063d |
comparison
equal
deleted
inserted
replaced
101:717b6f8d8505 | 102:5f04adf47f48 |
---|---|
343 fun compile job = | 343 fun compile job = |
344 case cjrize job of | 344 case cjrize job of |
345 NONE => () | 345 NONE => () |
346 | SOME file => | 346 | SOME file => |
347 let | 347 let |
348 val outf = TextIO.openOut "/tmp/lacweb.c" | 348 val cname = "/tmp/lacweb.c" |
349 val oname = "/tmp/lacweb.o" | |
350 val ename = "/tmp/webapp" | |
351 | |
352 val compile = "gcc -I include -c " ^ cname ^ " -o " ^ oname | |
353 val link = "gcc clib/lacweb.o " ^ oname ^ " clib/driver.o -o " ^ ename | |
354 | |
355 val outf = TextIO.openOut cname | |
349 val s = TextIOPP.openOut {dst = outf, wid = 80} | 356 val s = TextIOPP.openOut {dst = outf, wid = 80} |
350 in | 357 in |
351 Print.fprint s (CjrPrint.p_file CjrEnv.empty file); | 358 Print.fprint s (CjrPrint.p_file CjrEnv.empty file); |
352 TextIO.closeOut outf | 359 TextIO.closeOut outf; |
360 | |
361 if not (OS.Process.isSuccess (OS.Process.system compile)) then | |
362 print "C compilation failed\n" | |
363 else if not (OS.Process.isSuccess (OS.Process.system link)) then | |
364 print "C linking failed\n" | |
365 else | |
366 print "Success\n" | |
353 end | 367 end |
354 | 368 |
355 end | 369 end |