[MLton-commit] r6540

Matthew Fluet fluet at mlton.org
Mon Apr 7 11:33:22 PDT 2008


Abstract OS.IO.iodesc with MkAbsRepEq.

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

U   mlton/trunk/basis-library/posix/file-sys.sml
U   mlton/trunk/basis-library/system/io.sml
U   mlton/trunk/basis-library/system/pre-os.sml

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

Modified: mlton/trunk/basis-library/posix/file-sys.sml
===================================================================
--- mlton/trunk/basis-library/posix/file-sys.sml	2008-04-07 18:33:19 UTC (rev 6539)
+++ mlton/trunk/basis-library/posix/file-sys.sml	2008-04-07 18:33:21 UTC (rev 6540)
@@ -35,8 +35,8 @@
 
       val fdToWord = C_Fd.castToSysWord
       val wordToFD = C_Fd.castFromSysWord
-      val fdToIOD = fn x => x
-      val iodToFD = SOME o (fn x => x)
+      val fdToIOD = fn x => PreOS.IO.IODesc.fromRep x
+      val iodToFD = SOME o (fn x => PreOS.IO.IODesc.toRep x)
 
       (*------------------------------------*)
       (*             dirstream              *)

Modified: mlton/trunk/basis-library/system/io.sml
===================================================================
--- mlton/trunk/basis-library/system/io.sml	2008-04-07 18:33:19 UTC (rev 6539)
+++ mlton/trunk/basis-library/system/io.sml	2008-04-07 18:33:21 UTC (rev 6540)
@@ -2,6 +2,7 @@
 (* modified by Matthew Fluet 2002-10-11 *)
 (* modified by Matthew Fluet 2002-11-21 *)
 (* modified by Matthew Fluet 2006-04-30 *)
+(* modified by Matthew Fluet 2008-04-06 *)
 
 (* os-io.sml
  *
@@ -23,10 +24,10 @@
 
     datatype iodesc_kind = K of string
 
-    val iodToFd = fn x => x
-    val fdToIod = fn x => x
+    val iodToFd = fn x => PreOS.IO.IODesc.toRep x
+    val fdToIod = fn x => PreOS.IO.IODesc.fromRep x
 
-    val iodescToWord = C_Fd.castToSysWord
+    val iodescToWord = C_Fd.castToSysWord o PreOS.IO.IODesc.toRep
 
   (* return a hash value for the I/O descriptor. *)
     val hash = SysWord.toWord o iodescToWord

Modified: mlton/trunk/basis-library/system/pre-os.sml
===================================================================
--- mlton/trunk/basis-library/system/pre-os.sml	2008-04-07 18:33:19 UTC (rev 6539)
+++ mlton/trunk/basis-library/system/pre-os.sml	2008-04-07 18:33:21 UTC (rev 6540)
@@ -19,12 +19,11 @@
                end
             type status = Status.t
          end
-      structure IO :
-         sig
-            eqtype iodesc
-         end =
+      structure IO =
          struct
-            type iodesc = C_Fd.t
+            structure IODesc =
+               MkAbsRepEq(type rep = C_Fd.t)
+            type iodesc = IODesc.t
          end
    end
 




More information about the MLton-commit mailing list