diff 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
line wrap: on
line diff
--- a/src/compiler.sml	Wed Nov 25 08:38:12 2009 -0500
+++ b/src/compiler.sml	Wed Nov 25 08:52:32 2009 -0500
@@ -927,17 +927,13 @@
 
         val link = foldl (fn (s, link) => link ^ " " ^ s) link link'
     in
-        if not (OS.Process.isSuccess (OS.Process.system compile)) then
-            OS.Process.exit OS.Process.failure
-        else if not (OS.Process.isSuccess (OS.Process.system link)) then
-            OS.Process.exit OS.Process.failure
-        else
-            ()
+        OS.Process.isSuccess (OS.Process.system compile)
+        andalso OS.Process.isSuccess (OS.Process.system link)
     end
 
 fun compile job =
     case run toChecknest job of
-        NONE => OS.Process.exit OS.Process.failure
+        NONE => false
       | SOME file =>
         let
             val job = valOf (run (transform parseUrp "parseUrp") job)
@@ -991,11 +987,17 @@
                     end;
 
                 compileC {cname = cname, oname = oname, ename = ename, libs = libs,
-                          profile = #profile job, debug = #debug job, link = #link job};
+                          profile = #profile job, debug = #debug job, link = #link job}
                 
-                cleanup ()
+                before cleanup ()
             end
             handle ex => (((cleanup ()) handle _ => ()); raise ex)
         end
 
+fun compiler job =
+    if compile job then
+        ()
+    else
+        OS.Process.exit OS.Process.failure
+
 end