Full regeneration
[hcoop/domtool2.git] / src / domain.sml
index 0354944..9913dfc 100644 (file)
@@ -276,6 +276,27 @@ fun registerAfter f =
        afters := (fn x => (old x; f x))
     end
 
+val globals = ref (fn () => ())
+val locals = ref (fn () => ())
+
+fun registerResetGlobal f =
+    let
+       val old = !globals
+    in
+       globals := (fn x => (old x; f x))
+    end
+
+fun registerResetLocal f =
+    let
+       val old = !locals
+    in
+       locals := (fn x => (old x; f x))
+    end
+
+fun resetGlobal () = (!globals ();
+                     ignore (OS.Process.system (Config.rm ^ " -rf " ^ Config.resultRoot ^ "/*")))
+fun resetLocal () = !locals ()
+
 val current = ref ""
 val currentPath = ref (fn (_ : string) => "")