domtool-doc
authorAdam Chlipala <adamc@hcoop.net>
Sat, 16 Dec 2006 20:38:27 +0000 (20:38 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sat, 16 Dec 2006 20:38:27 +0000 (20:38 +0000)
Makefile
bin/.cvsignore
src/.cvsignore
src/main-doc.sml [new file with mode: 0644]
src/main.sig
src/main.sml

index 70a347c..7cf54fa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,8 @@ COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
 
 .PHONY: all mlton smlnj install
 
-mlton: bin/domtool-server bin/domtool-client bin/domtool-slave bin/domtool-admin
+mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
+       bin/domtool-admin bin/domtool-doc
 
 smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
 
@@ -56,6 +57,10 @@ src/domtool-admin.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
        $(MAKE_MLB_BASE) >src/domtool-admin.mlb
        echo "main-admin.sml" >>src/domtool-admin.mlb
 
+src/domtool-doc.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
+       $(MAKE_MLB_BASE) >src/domtool-doc.mlb
+       echo "main-doc.sml" >>src/domtool-doc.mlb
+
 openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
        cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
        -cm libssl.h.cm -D__builtin_va_list="void*" \
@@ -90,6 +95,9 @@ bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
 bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
        mlton -output bin/domtool-admin -link-opt -ldl src/domtool-admin.mlb
 
+bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
+       mlton -output bin/domtool-doc -link-opt -ldl src/domtool-doc.mlb
+
 install:
        cp scripts/domtool-publish /usr/local/sbin/
        cp scripts/domtool-reset-global /usr/local/sbin/
@@ -103,6 +111,7 @@ install:
        cp bin/domtool-slave /usr/local/sbin/
        cp bin/domtool-client /usr/local/bin/domtool
        cp bin/domtool-admin /usr/local/bin/
+       cp bin/domtool-doc /usr/local/bin/
 
 .PHONY: grab_lib
 
index 27134a3..16e624b 100644 (file)
@@ -2,3 +2,4 @@ domtool-server
 domtool-client
 domtool-slave
 domtool-admin
+domtool-doc
index 29f6762..5356e7a 100644 (file)
@@ -6,3 +6,4 @@ domtool-server.mlb
 domtool-client.mlb
 domtool-slave.mlb
 domtool-admin.mlb
+domtool-doc.mlb
diff --git a/src/main-doc.sml b/src/main-doc.sml
new file mode 100644 (file)
index 0000000..3df2ad3
--- /dev/null
@@ -0,0 +1,42 @@
+(* HCoop Domtool (http://hcoop.sourceforge.net/)
+ * Copyright (c) 2006, Adam Chlipala
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *)
+
+(* Driver for documentation generation *)
+
+fun processArgs (args, basis, outdir, files) =
+    case args of
+       [] => (basis, outdir, files)
+      | "-basis" :: rest => processArgs (rest, true, outdir, files)
+      | "-out" :: dir :: rest => processArgs (rest, basis, dir, files)
+      | file :: rest => processArgs (rest, basis, outdir, file :: files)
+
+val _ =
+    let
+       val (basis, outdir, files) = processArgs (CommandLine.arguments (),
+                                                 false,
+                                                 OS.FileSys.getDir (),
+                                                 [])
+
+       val files = if basis then
+                       Main.listBasis () @ files
+                   else
+                       files
+    in
+       Tycheck.allowExterns ();
+       Autodoc.autodoc {outdir = outdir, infiles = files}
+    end
index 791b357..f8d6b94 100644 (file)
@@ -45,6 +45,7 @@ signature MAIN = sig
     val service : unit -> unit
     val slave : unit -> unit
 
+    val listBasis : unit -> string list
     val autodocBasis : string -> unit
 
 end
index 91ae29e..7457545 100644 (file)
@@ -766,7 +766,7 @@ fun slave () =
        OpenSSL.shutdown sock
     end
 
-fun autodocBasis outdir =
+fun listBasis () =
     let
        val dir = Posix.FileSys.opendir Config.libRoot
 
@@ -781,10 +781,11 @@ fun autodocBasis outdir =
                          :: files)
                else
                    loop files
-
-       val files = loop []
     in
-       Autodoc.autodoc {outdir = outdir, infiles = files}
+       loop []
     end
 
+fun autodocBasis outdir =
+    Autodoc.autodoc {outdir = outdir, infiles = listBasis ()}
+
 end