[MLton-commit] r6476

Matthew Fluet fluet at mlton.org
Fri Mar 14 05:48:57 PST 2008


Feature request of John Reppy:

  It would be helpful if the Unsafe structure were fleshed out to
  include unsafe versions of all of the monomorphic array and vector
  structures (I particularly need an Unsafe.Real32Array, but I can see
  using things like Unsafe.Int16Array).


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

U   mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sig
U   mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sml
U   mlton/trunk/basis-library/sml-nj/unsafe.sig
U   mlton/trunk/basis-library/sml-nj/unsafe.sml

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

Modified: mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sig
===================================================================
--- mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sig	2008-03-14 12:12:05 UTC (rev 6475)
+++ mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sig	2008-03-14 13:48:56 UTC (rev 6476)
@@ -118,6 +118,7 @@
       structure VectorSlice : VECTOR_SLICE      
       structure Vector : VECTOR 
       structure Word : WORD     
+      structure Word8: WORD
       structure Word8Array : MONO_ARRAY 
       structure Word8Array2 : MONO_ARRAY2       
       structure Word8ArraySlice : MONO_ARRAY_SLICE      
@@ -135,6 +136,11 @@
       structure FixedInt : INTEGER
       structure GenericSock : GENERIC_SOCK
       structure INetSock : INET_SOCK
+      structure IntArray : MONO_ARRAY
+      structure IntArray2 : MONO_ARRAY2
+      structure IntArraySlice : MONO_ARRAY_SLICE
+      structure IntVector : MONO_VECTOR
+      structure IntVectorSlice : MONO_VECTOR_SLICE
       structure Int1: INTEGER
       structure Int2: INTEGER
       structure Int3: INTEGER
@@ -188,12 +194,12 @@
       structure Int64ArraySlice : MONO_ARRAY_SLICE
       structure Int64Vector : MONO_VECTOR
       structure Int64VectorSlice : MONO_VECTOR_SLICE
-      structure IntArray : MONO_ARRAY
-      structure IntArray2 : MONO_ARRAY2
-      structure IntArraySlice : MONO_ARRAY_SLICE
-      structure IntVector : MONO_VECTOR
-      structure IntVectorSlice : MONO_VECTOR_SLICE
       structure IntInf : INT_INF
+      structure IntInfArray : MONO_ARRAY
+      structure IntInfArray2 : MONO_ARRAY2
+      structure IntInfArraySlice : MONO_ARRAY_SLICE
+      structure IntInfVector : MONO_VECTOR
+      structure IntInfVectorSlice : MONO_VECTOR_SLICE
       structure LargeIntArray : MONO_ARRAY
       structure LargeIntArray2 : MONO_ARRAY2
       structure LargeIntArraySlice : MONO_ARRAY_SLICE
@@ -225,6 +231,11 @@
       structure PackWord64Big : PACK_WORD
       structure PackWord64Little : PACK_WORD
       structure Posix : POSIX
+      structure RealArray : MONO_ARRAY
+      structure RealArray2 : MONO_ARRAY2
+      structure RealArraySlice : MONO_ARRAY_SLICE
+      structure RealVector : MONO_VECTOR
+      structure RealVectorSlice : MONO_VECTOR_SLICE
       structure Real32 : REAL
       structure Real32Array : MONO_ARRAY
       structure Real32Array2 : MONO_ARRAY2
@@ -237,11 +248,6 @@
       structure Real64ArraySlice : MONO_ARRAY_SLICE
       structure Real64Vector : MONO_VECTOR
       structure Real64VectorSlice : MONO_VECTOR_SLICE
-      structure RealArray : MONO_ARRAY
-      structure RealArray2 : MONO_ARRAY2
-      structure RealArraySlice : MONO_ARRAY_SLICE
-      structure RealVector : MONO_VECTOR
-      structure RealVectorSlice : MONO_VECTOR_SLICE
       structure Socket : SOCKET
       structure SysWord : WORD
       structure Unix : UNIX
@@ -262,6 +268,11 @@
 (*
       structure Windows : WINDOWS
 *)
+      structure WordArray : MONO_ARRAY
+      structure WordArray2 : MONO_ARRAY2
+      structure WordArraySlice : MONO_ARRAY_SLICE
+      structure WordVector : MONO_VECTOR
+      structure WordVectorSlice : MONO_VECTOR_SLICE
       structure Word1: WORD
       structure Word2: WORD
       structure Word3: WORD
@@ -269,7 +280,7 @@
       structure Word5: WORD
       structure Word6: WORD
       structure Word7: WORD
-      structure Word8: WORD
+      (* structure Word8: WORD (* Word8 is a required structure *)*)
       structure Word9: WORD
       structure Word10: WORD
       structure Word11: WORD
@@ -295,11 +306,6 @@
       structure Word31: WORD
       structure Word32: WORD
       structure Word64: WORD
-      structure WordArray : MONO_ARRAY
-      structure WordArray2 : MONO_ARRAY2
-      structure WordArraySlice : MONO_ARRAY_SLICE
-      structure WordVector : MONO_VECTOR
-      structure WordVectorSlice : MONO_VECTOR_SLICE
       structure Word16Array : MONO_ARRAY
       structure Word16Array2 : MONO_ARRAY2
       structure Word16ArraySlice : MONO_ARRAY_SLICE
@@ -336,11 +342,44 @@
       sharing type MLton.Word16.t = Word16.word
       sharing type MLton.Word32.t = Word32.word
       sharing type MLton.Word64.t = Word64.word
+      sharing Unsafe.BoolArray = BoolArray
+      sharing Unsafe.BoolVector = BoolVector
       sharing Unsafe.CharArray = CharArray
       sharing Unsafe.CharVector = CharVector
+      sharing Unsafe.IntArray = IntArray
+      sharing Unsafe.IntVector = IntVector
+      sharing Unsafe.Int8Array = Int8Array
+      sharing Unsafe.Int8Vector = Int8Vector
+      sharing Unsafe.Int16Array = Int16Array
+      sharing Unsafe.Int16Vector = Int16Vector
+      sharing Unsafe.Int32Array = Int32Array
+      sharing Unsafe.Int32Vector = Int32Vector
+      sharing Unsafe.Int64Array = Int64Array
+      sharing Unsafe.Int64Vector = Int64Vector
+      sharing Unsafe.IntInfArray = IntInfArray
+      sharing Unsafe.IntInfVector = IntInfVector
+      sharing Unsafe.LargeIntArray = LargeIntArray
+      sharing Unsafe.LargeIntVector = LargeIntVector
+      sharing Unsafe.LargeRealArray = LargeRealArray
+      sharing Unsafe.LargeRealVector = LargeRealVector
+      sharing Unsafe.LargeWordArray = LargeWordArray
+      sharing Unsafe.LargeWordVector = LargeWordVector
+      sharing Unsafe.RealArray = RealArray
+      sharing Unsafe.RealVector = RealVector
+      sharing Unsafe.Real32Array = Real32Array
+      sharing Unsafe.Real32Vector = Real32Vector
       sharing Unsafe.Real64Array = Real64Array
+      sharing Unsafe.Real64Vector = Real64Vector
+      sharing Unsafe.WordArray = WordArray
+      sharing Unsafe.WordVector = WordVector
       sharing Unsafe.Word8Array = Word8Array
       sharing Unsafe.Word8Vector = Word8Vector
+      sharing Unsafe.Word16Array = Word16Array
+      sharing Unsafe.Word16Vector = Word16Vector
+      sharing Unsafe.Word32Array = Word32Array
+      sharing Unsafe.Word32Vector = Word32Vector
+      sharing Unsafe.Word64Array = Word64Array
+      sharing Unsafe.Word64Vector = Word64Vector
 
       (* ************************************************** *)
       (* ************************************************** *)

Modified: mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sml
===================================================================
--- mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sml	2008-03-14 12:12:05 UTC (rev 6475)
+++ mlton/trunk/basis-library/libs/basis-extra/top-level/basis.sml	2008-03-14 13:48:56 UTC (rev 6476)
@@ -123,6 +123,11 @@
       structure Int64Vector = Int64Vector
       structure Int64VectorSlice = Int64VectorSlice
       structure IntInf = IntInf
+      structure IntInfArray = IntInfArray
+      structure IntInfArray2 = IntInfArray2
+      structure IntInfArraySlice = IntInfArraySlice
+      structure IntInfVector = IntInfVector
+      structure IntInfVectorSlice = IntInfVectorSlice
       structure LargeIntArray = LargeIntArray
       structure LargeIntArray2 = LargeIntArray2
       structure LargeIntArraySlice = LargeIntArraySlice

Modified: mlton/trunk/basis-library/sml-nj/unsafe.sig
===================================================================
--- mlton/trunk/basis-library/sml-nj/unsafe.sig	2008-03-14 12:12:05 UTC (rev 6475)
+++ mlton/trunk/basis-library/sml-nj/unsafe.sig	2008-03-14 13:48:56 UTC (rev 6476)
@@ -23,7 +23,9 @@
       type elem
       type vector
 
+      (* val create: int -> vector *)
       val sub: vector * int -> elem
+      (* val update: vector * int * elem -> unit *)
    end
 
 signature UNSAFE =
@@ -34,13 +36,47 @@
             val sub: 'a array * int -> 'a
             val update: 'a array * int * 'a -> unit
          end
+      structure BoolArray: UNSAFE_MONO_ARRAY
+      structure BoolVector: UNSAFE_MONO_VECTOR
       structure CharArray: UNSAFE_MONO_ARRAY
       structure CharVector: UNSAFE_MONO_VECTOR
+      structure IntArray: UNSAFE_MONO_ARRAY
+      structure IntVector: UNSAFE_MONO_VECTOR
+      structure Int8Array: UNSAFE_MONO_ARRAY
+      structure Int8Vector: UNSAFE_MONO_VECTOR
+      structure Int16Array: UNSAFE_MONO_ARRAY
+      structure Int16Vector: UNSAFE_MONO_VECTOR
+      structure Int32Array: UNSAFE_MONO_ARRAY
+      structure Int32Vector: UNSAFE_MONO_VECTOR
+      structure Int64Array: UNSAFE_MONO_ARRAY
+      structure Int64Vector: UNSAFE_MONO_VECTOR
+      structure IntInfArray: UNSAFE_MONO_ARRAY
+      structure IntInfVector: UNSAFE_MONO_VECTOR
+      structure LargeIntArray: UNSAFE_MONO_ARRAY
+      structure LargeIntVector: UNSAFE_MONO_VECTOR
+      structure LargeRealArray: UNSAFE_MONO_ARRAY
+      structure LargeRealVector: UNSAFE_MONO_VECTOR
+      structure LargeWordArray: UNSAFE_MONO_ARRAY
+      structure LargeWordVector: UNSAFE_MONO_VECTOR
+      structure RealArray: UNSAFE_MONO_ARRAY
+      structure RealVector: UNSAFE_MONO_VECTOR
+      structure Real32Array: UNSAFE_MONO_ARRAY
+      structure Real32Vector: UNSAFE_MONO_VECTOR
       structure Real64Array: UNSAFE_MONO_ARRAY
+      structure Real64Vector: UNSAFE_MONO_VECTOR
       structure Vector:
          sig
+            (* val create: int -> 'a vector *)
             val sub: 'a vector * int -> 'a
          end
+      structure WordArray: UNSAFE_MONO_ARRAY
+      structure WordVector: UNSAFE_MONO_VECTOR
       structure Word8Array: UNSAFE_MONO_ARRAY
       structure Word8Vector: UNSAFE_MONO_VECTOR
+      structure Word16Array: UNSAFE_MONO_ARRAY
+      structure Word16Vector: UNSAFE_MONO_VECTOR
+      structure Word32Array: UNSAFE_MONO_ARRAY
+      structure Word32Vector: UNSAFE_MONO_VECTOR
+      structure Word64Array: UNSAFE_MONO_ARRAY
+      structure Word64Vector: UNSAFE_MONO_VECTOR
    end

Modified: mlton/trunk/basis-library/sml-nj/unsafe.sml
===================================================================
--- mlton/trunk/basis-library/sml-nj/unsafe.sml	2008-03-14 12:12:05 UTC (rev 6475)
+++ mlton/trunk/basis-library/sml-nj/unsafe.sml	2008-03-14 13:48:56 UTC (rev 6476)
@@ -31,13 +31,46 @@
             val update = Array.unsafeUpdate
             val create = Array.array
          end
+      structure BoolArray = UnsafeMonoArray (BoolArray)
+      structure BoolVector = UnsafeMonoVector (BoolVector)
       structure CharArray = UnsafeMonoArray (CharArray)
       structure CharVector = UnsafeMonoVector (CharVector)
+      structure IntArray = UnsafeMonoArray (IntArray)
+      structure IntVector = UnsafeMonoVector (IntVector)
+      structure Int8Array = UnsafeMonoArray (Int8Array)
+      structure Int8Vector = UnsafeMonoVector (Int8Vector)
+      structure Int16Array = UnsafeMonoArray (Int16Array)
+      structure Int16Vector = UnsafeMonoVector (Int16Vector)
+      structure Int32Array = UnsafeMonoArray (Int32Array)
+      structure Int32Vector = UnsafeMonoVector (Int32Vector)
+      structure Int64Array = UnsafeMonoArray (Int64Array)
+      structure Int64Vector = UnsafeMonoVector (Int64Vector)
+      structure IntInfArray = UnsafeMonoArray (IntInfArray)
+      structure IntInfVector = UnsafeMonoVector (IntInfVector)
+      structure LargeIntArray = UnsafeMonoArray (LargeIntArray)
+      structure LargeIntVector = UnsafeMonoVector (LargeIntVector)
+      structure LargeRealArray = UnsafeMonoArray (LargeRealArray)
+      structure LargeRealVector = UnsafeMonoVector (LargeRealVector)
+      structure LargeWordArray = UnsafeMonoArray (LargeWordArray)
+      structure LargeWordVector = UnsafeMonoVector (LargeWordVector)
+      structure RealArray = UnsafeMonoArray (RealArray)
+      structure RealVector = UnsafeMonoVector (RealVector)
+      structure Real32Array = UnsafeMonoArray (Real32Array)
+      structure Real32Vector = UnsafeMonoVector (Real32Vector)
       structure Real64Array = UnsafeMonoArray (Real64Array)
+      structure Real64Vector = UnsafeMonoVector (Real64Vector)
       structure Vector =
          struct
             val sub = Vector.unsafeSub
          end
+      structure WordArray = UnsafeMonoArray (WordArray)
+      structure WordVector = UnsafeMonoVector (WordVector)
       structure Word8Array = UnsafeMonoArray (Word8Array)
       structure Word8Vector = UnsafeMonoVector (Word8Vector)
+      structure Word16Array = UnsafeMonoArray (Word16Array)
+      structure Word16Vector = UnsafeMonoVector (Word16Vector)
+      structure Word32Array = UnsafeMonoArray (Word32Array)
+      structure Word32Vector = UnsafeMonoVector (Word32Vector)
+      structure Word64Array = UnsafeMonoArray (Word64Array)
+      structure Word64Vector = UnsafeMonoVector (Word64Vector)
    end




More information about the MLton-commit mailing list