Mercurial > urweb
comparison src/compiler.sml @ 1045:36efaf119b85
Refactor compile functions; allow empty tag contents
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 25 Nov 2009 08:52:32 -0500 |
parents | 0d916892e39e |
children | eaba663fd6aa |
comparison
equal
deleted
inserted
replaced
1044:0d916892e39e | 1045:36efaf119b85 |
---|---|
925 else | 925 else |
926 (compile, link) | 926 (compile, link) |
927 | 927 |
928 val link = foldl (fn (s, link) => link ^ " " ^ s) link link' | 928 val link = foldl (fn (s, link) => link ^ " " ^ s) link link' |
929 in | 929 in |
930 if not (OS.Process.isSuccess (OS.Process.system compile)) then | 930 OS.Process.isSuccess (OS.Process.system compile) |
931 OS.Process.exit OS.Process.failure | 931 andalso OS.Process.isSuccess (OS.Process.system link) |
932 else if not (OS.Process.isSuccess (OS.Process.system link)) then | |
933 OS.Process.exit OS.Process.failure | |
934 else | |
935 () | |
936 end | 932 end |
937 | 933 |
938 fun compile job = | 934 fun compile job = |
939 case run toChecknest job of | 935 case run toChecknest job of |
940 NONE => OS.Process.exit OS.Process.failure | 936 NONE => false |
941 | SOME file => | 937 | SOME file => |
942 let | 938 let |
943 val job = valOf (run (transform parseUrp "parseUrp") job) | 939 val job = valOf (run (transform parseUrp "parseUrp") job) |
944 | 940 |
945 val (cname, oname, cleanup) = | 941 val (cname, oname, cleanup) = |
989 Print.fprint s (CjrPrint.p_sql CjrEnv.empty file); | 985 Print.fprint s (CjrPrint.p_sql CjrEnv.empty file); |
990 TextIO.closeOut outf | 986 TextIO.closeOut outf |
991 end; | 987 end; |
992 | 988 |
993 compileC {cname = cname, oname = oname, ename = ename, libs = libs, | 989 compileC {cname = cname, oname = oname, ename = ename, libs = libs, |
994 profile = #profile job, debug = #debug job, link = #link job}; | 990 profile = #profile job, debug = #debug job, link = #link job} |
995 | 991 |
996 cleanup () | 992 before cleanup () |
997 end | 993 end |
998 handle ex => (((cleanup ()) handle _ => ()); raise ex) | 994 handle ex => (((cleanup ()) handle _ => ()); raise ex) |
999 end | 995 end |
1000 | 996 |
997 fun compiler job = | |
998 if compile job then | |
999 () | |
1000 else | |
1001 OS.Process.exit OS.Process.failure | |
1002 | |
1001 end | 1003 end |