Un-hard code some things
authorAdam Chlipala <adamc@hcoop.net>
Wed, 22 Sep 2004 02:27:21 +0000 (02:27 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Wed, 22 Sep 2004 02:27:21 +0000 (02:27 +0000)
BUILDING
build
install
src/compiler.sml
src/config.sml
src/main.sml
src/settings.sml [new file with mode: 0644]
src/sources.cm

index 41164d4..38265e5 100644 (file)
--- a/BUILDING
+++ b/BUILDING
@@ -13,6 +13,8 @@ internals, and they may change often.
 Configuration
 =============
 
+Modify the parameters in settings.sml as appropriate for your system.
+
 If it is possible for you to modify a file /etc/mlt.conf, then you
 can edit this file to set various options related to locations of
 important files on your file system. In particular, you may want to
diff --git a/build b/build
index 49811e7..98b1f5c 100755 (executable)
--- a/build
+++ b/build
@@ -1,11 +1,12 @@
 #!/bin/sh
 
 SMLBIN=/usr/local/sml/bin
+PLATFORM=x86-linux
 
 cd src
 
-if [ -f mlt.x86-linux ] ; then
-    rm mlt.x86-linux
+if [ -f mlt.$PLATFORM ] ; then
+    rm mlt.$PLATFORM
 fi
 if [ -d CM ] ; then
     rm -rf CM
diff --git a/install b/install
index 853a70d..8a5b10c 100755 (executable)
--- a/install
+++ b/install
@@ -1,2 +1,5 @@
-cp src/mlt /usr/local/bin/
-cp src/mlt.x86-linux /usr/local/bin/
\ No newline at end of file
+BIN=/usr/local/bin
+PLATFORM=x86-linux
+
+cp src/mlt $BIN/
+cp src/mlt.$PLATFORM $BIN/
\ No newline at end of file
index b335cd9..16d66f8 100644 (file)
@@ -21,6 +21,8 @@
 
 structure Compiler :> COMPILER =
 struct
+    open Settings
+
     exception Error
 
     val cgiMode = Posix.FileSys.S.flags [Posix.FileSys.S.irwxu,
@@ -169,7 +171,6 @@ struct
            val outPath = Config.outPath config 
            val pubPath = Config.pubPath config
            val sml = Config.sml config
-           val arch = "x86-linux"
 
            val loc = Environment.staticPart (#get (EnvRef.loc ()) ())
            val base = Environment.staticPart (#get (EnvRef.base ()) ())
index 45253ac..3ddc0d7 100644 (file)
@@ -1,6 +1,6 @@
 (*
  * Dynamic web page generation with Standard ML
- * Copyright (C) 2003  Adam Chlipala
+ * Copyright (C) 2003-2004  Adam Chlipala
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,7 @@
 
 structure Config :> CONFIG =
 struct
-    val defaultFile = "/etc/mlt.conf"
+    open Settings
 
     datatype config =
             CONFIG of {inPath : string, (* Directory for input sources *)
index 80b8eaf..d9950fa 100644 (file)
@@ -34,4 +34,6 @@ struct
                            print msg;
                            print "\n";
                            OS.Process.failure)
+            | Io => (print "FATAL ERROR: Io\n";
+                           OS.Process.failure)
 end
\ No newline at end of file
diff --git a/src/settings.sml b/src/settings.sml
new file mode 100644 (file)
index 0000000..39a96a4
--- /dev/null
@@ -0,0 +1,26 @@
+(*
+ * Dynamic web page generation with Standard ML
+ * Copyright (C) 2003-2004  Adam Chlipala
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *)
+
+(* Configuration parameters *)
+
+structure Settings =
+struct
+    val arch = "x86-linux"
+    val defaultFile = "/etc/mlt.conf"
+end
\ No newline at end of file
index f59dcb2..0631a65 100644 (file)
@@ -28,6 +28,8 @@ is
 
        $smlnj/compiler/current.cm
 
+       settings.sml
+
        string_map.sml
        common.sml