[MLton-commit] r4426

Matthew Fluet MLton@mlton.org
Sun, 30 Apr 2006 12:13:22 -0700


Vert minor refactoring of {Bin,Text}IO; it was already very well factored
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/arrays-and-vectors/mono-array.sig
U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/build/sources.mlb
U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/bin-io.sml
U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/imperative-io.fun
U   mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/text-io.sml

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

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/arrays-and-vectors/mono-array.sig
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/arrays-and-vectors/mono-array.sig	2006-04-30 18:58:08 UTC (rev 4425)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/arrays-and-vectors/mono-array.sig	2006-04-30 19:13:21 UTC (rev 4426)
@@ -39,6 +39,8 @@
           and type vector = vector
           and type vector_slice = vector_slice
 
+      val arrayUninit: int -> array
+
       val concat: array list -> array
       val duplicate: array -> array
       val fromPoly: elem Array.array -> array

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/build/sources.mlb
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/build/sources.mlb	2006-04-30 18:58:08 UTC (rev 4425)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/build/sources.mlb	2006-04-30 19:13:21 UTC (rev 4426)
@@ -238,20 +238,20 @@
    ../posix/posix.sig
    ../posix/posix.sml
 
-(*
-      ../../platform/cygwin.sml
+   (* ../platform/cygwin.sml *)
 
-      ../../io/stream-io.sig
-      ../../io/stream-io.fun
-      ../../io/imperative-io.sig
-      ../../io/imperative-io.fun
-      ../../io/bin-stream-io.sig
-      ../../io/bin-io.sig
-      ../../io/bin-io.sml
-      ../../io/text-stream-io.sig
-      ../../io/text-io.sig
-      ../../io/text-io.sml
+   ../io/stream-io.sig
+   ../io/stream-io.fun
+   ../io/imperative-io.sig
+   ../io/imperative-io.fun
+   ../io/bin-stream-io.sig
+   ../io/bin-io.sig
+   ../io/bin-io.sml
+   ../io/text-stream-io.sig
+   ../io/text-io.sig
+   ../io/text-io.sml
 
+(*
       ../../system/path.sig
       ../../system/path.sml
       ../../system/file-sys.sig

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/bin-io.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/bin-io.sml	2006-04-30 18:58:08 UTC (rev 4425)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/bin-io.sml	2006-04-30 19:13:21 UTC (rev 4426)
@@ -12,8 +12,8 @@
     structure PrimIO = BinPrimIO
     structure Vector = Word8Vector
     structure VectorSlice = Word8VectorSlice
-    val chunkSize = Primitive.TextIO.bufSize
-    val fileTypeFlags = [SysWord.fromInt PrimitiveFFI.Posix.FileSys.O.BINARY]
+    val chunkSize = Int32.toInt (Primitive.Controls.bufSize)
+    val fileTypeFlags = [PrimitiveFFI.Posix.FileSys.O.BINARY]
     val line = NONE
     val mkReader = Posix.IO.mkBinReader
     val mkWriter = Posix.IO.mkBinWriter

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/imperative-io.fun
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/imperative-io.fun	2006-04-30 18:58:08 UTC (rev 4425)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/imperative-io.fun	2006-04-30 19:13:21 UTC (rev 4426)
@@ -9,7 +9,7 @@
    sig
       structure Array: sig
                           include MONO_ARRAY
-                          val rawArray: int -> array
+                          val arrayUninit: int -> array
                           val unsafeSub: array * int -> elem
                        end
       structure ArraySlice: MONO_ARRAY_SLICE
@@ -218,7 +218,7 @@
 
 local
    val augmentedReader = PIO.nullRd ()
-   val buf = A.rawArray 0
+   val buf = A.arrayUninit 0
    val first = ref 0
    val last = ref 0
    val reader = PIO.nullRd ()
@@ -373,7 +373,7 @@
                         (ib, "inputN", fn () =>
                          let
                             val readArr = readArr ib
-                            val inp = A.rawArray n
+                            val inp = A.arrayUninit n
                             fun fill k =
                                if k >= size
                                   then ()

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/text-io.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/text-io.sml	2006-04-30 18:58:08 UTC (rev 4425)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/io/text-io.sml	2006-04-30 19:13:21 UTC (rev 4426)
@@ -15,8 +15,8 @@
           structure PrimIO = TextPrimIO
           structure Vector = CharVector
           structure VectorSlice = CharVectorSlice
-          val chunkSize = Primitive.TextIO.bufSize
-          val fileTypeFlags = [SysWord.fromInt PrimitiveFFI.Posix.FileSys.O.TEXT]
+          val chunkSize = Int32.toInt (Primitive.Controls.bufSize)
+          val fileTypeFlags = [PrimitiveFFI.Posix.FileSys.O.TEXT]
           val line = SOME {isLine = fn c => c = #"\n",
                            lineElem = #"\n"}
           val mkReader = Posix.IO.mkTextReader