Basic HTML documentation generation
[hcoop/domtool2.git] / src / main.sml
index 734b10a..87a1b73 100644 (file)
@@ -53,7 +53,7 @@ fun basis () =
                    loop files
 
        val files = loop []
                    loop files
 
        val files = loop []
-       val files = Order.order files
+       val (_, files) = Order.order files
     in
        if !ErrorMsg.anyErrors then
            Env.empty
     in
        if !ErrorMsg.anyErrors then
            Env.empty
@@ -277,10 +277,35 @@ fun slave () =
                            OpenSSL.close bio;
                            loop ()
                        end
                            OpenSSL.close bio;
                            loop ()
                        end
-               end
+               end handle OpenSSL.OpenSSL s =>
+                          (print ("OpenSSL error: "^ s ^ "\n");
+                           OpenSSL.close bio
+                                         handle OpenSSL.OpenSSL _ => ();
+                           loop ())
     in
        loop ();
        OpenSSL.shutdown sock
     end
 
     in
        loop ();
        OpenSSL.shutdown sock
     end
 
+fun autodocBasis outdir =
+    let
+       val dir = Posix.FileSys.opendir Config.libRoot
+
+       fun loop files =
+           case Posix.FileSys.readdir dir of
+               NONE => (Posix.FileSys.closedir dir;
+                        files)
+             | SOME fname =>
+               if String.isSuffix ".dtl" fname then
+                   loop (OS.Path.joinDirFile {dir = Config.libRoot,
+                                              file = fname}
+                         :: files)
+               else
+                   loop files
+
+       val files = loop []
+    in
+       Autodoc.autodoc {outdir = outdir, infiles = files}
+    end
+
 end
 end