[MLton-commit] r6947

Vesa Karvonen vesak at mlton.org
Fri Oct 17 13:01:49 PDT 2008


Silence output from the evaluation of the use-lib implementation by
creating a silencer wrapper for it.

----------------------------------------------------------------------

_U  mltonlib/trunk/org/mlton/vesak/use-lib/unstable/
U   mltonlib/trunk/org/mlton/vesak/use-lib/unstable/Make.sh

----------------------------------------------------------------------


Property changes on: mltonlib/trunk/org/mlton/vesak/use-lib/unstable
___________________________________________________________________
Name: svn:ignore
   - *.use

   + *.sml
*.use


Modified: mltonlib/trunk/org/mlton/vesak/use-lib/unstable/Make.sh
===================================================================
--- mltonlib/trunk/org/mlton/vesak/use-lib/unstable/Make.sh	2008-10-17 19:40:39 UTC (rev 6946)
+++ mltonlib/trunk/org/mlton/vesak/use-lib/unstable/Make.sh	2008-10-17 20:01:48 UTC (rev 6947)
@@ -7,19 +7,22 @@
 
 set -e
 
-MLTON_LIB=`cd ../../../../.. && pwd`
+CURRENT_DIR="$(pwd)"
+MLTON_LIB="$(cd ../../../../.. && pwd)"
 
 sources="public/use-lib.sig detail/use-lib.sml public/export.sml"
 
-function gen {
-    echo "(* Copyright (C) 2007-2008 Vesa Karvonen
+copyright="(* Copyright (C) 2007-2008 Vesa Karvonen
  *
  * This code is released under the MLton license, a BSD-style license.
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-(* WARNING: This file was generated by the $(basename $0) script. *)" > .tmp
+(* WARNING: This file was generated by the $(basename $0) script. *)"
 
+function gen {
+    echo "$copyright" > .tmp
+
     workarounds=detail/ml/$1/workarounds.sml
 
     if test -f $workarounds ; then
@@ -34,6 +37,25 @@
         -e "s|\\\${VERBOSE}|$(echo -n $3)|g"      \
   >> .tmp
 
+    if test ! -f $1.sml ; then
+        mv .tmp $1.sml
+        echo "Created $1.sml"
+    elif test "$(cat $1.sml)" != "$(cat .tmp)" ; then
+        mv .tmp $1.sml
+        echo "Updated $1.sml"
+    else
+        rm .tmp
+    fi
+
+    echo "${copyright}
+
+val () = let
+   val x = $2
+in
+   use \"${CURRENT_DIR}/$1.sml\"
+ ; $3 x
+end" > .tmp
+
     if test ! -f $1.use ; then
         mv .tmp $1.use
         echo "Created $1.use"
@@ -49,25 +71,25 @@
 
 gen mosml '()' 'ignore'
 
-gen polyml                                      \
-    '(!PolyML.Compiler.printDepth               \
-      before PolyML.print_depth 0)'             \
+gen polyml \
+    '(!PolyML.Compiler.printDepth
+      before PolyML.print_depth 0)' \
     'PolyML.print_depth'
 
-gen smlnj                                       \
-    'let                                        \
-        open Control.Print                      \
-     in                                         \
-        {depth = !printDepth,                   \
-         sigs  = !signatures}                   \
-        before (printDepth := 0                 \
-              ; signatures := 0)                \
-     end'                                       \
-    'let                                        \
-        open Control.Print                      \
-     in                                         \
-        fn old => (printDepth := #depth old     \
-                 ; signatures := #sigs old)     \
+gen smlnj \
+    'let
+        open Control.Print
+     in
+        {depth = !printDepth,
+         sigs  = !signatures}
+        before (printDepth := 0
+              ; signatures := 0)
+     end' \
+    'let
+        open Control.Print
+     in
+        fn old => (printDepth := #depth old
+                 ; signatures := #sigs old)
      end'
 
 if which poly > /dev/null ; then




More information about the MLton-commit mailing list