Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/Posix/posix-io.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/Posix/posix-io.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1380, Wed Sep 17 20:20:51 2003 UTC revision 1381, Wed Sep 17 21:28:41 2003 UTC
# Line 52  Line 52 
52    
53      val read' : int * int -> Word8Vector.vector = cfun "read"      val read' : int * int -> Word8Vector.vector = cfun "read"
54      val readbuf' : int * Word8Array.array * int * int -> int = cfun "readbuf"      val readbuf' : int * Word8Array.array * int * int -> int = cfun "readbuf"
55      fun readArr (fd, {buf, i, sz=NONE}) = let      fun readArr (fd, asl) = let
56            val alen = Word8Array.length buf          val (buf, i, len) = Word8ArraySlice.base asl
57            in            in
58              if 0 <= i andalso i <= alen          readbuf' (FS.intOf fd, buf, len, i)
               then readbuf'(FS.intOf fd, buf, alen - i, i)  
               else raise Subscript  
           end  
       | readArr (fd, {buf, i, sz=SOME sz}) = let  
           val alen = Word8Array.length buf  
           in  
             if 0 <= i andalso 0 <= sz andalso i + sz <= alen  
               then readbuf'(FS.intOf fd, buf, sz, i)  
               else raise Subscript  
59            end            end
60      fun readVec (fd,cnt) =      fun readVec (fd,cnt) =
61            if cnt < 0 then raise Subscript else read'(FS.intOf fd, cnt)            if cnt < 0 then raise Size else read'(FS.intOf fd, cnt)
62    
63      val writevec' : (int * Word8Vector.vector * int * int) -> int = cfun "writebuf"      val writevec' : (int * Word8Vector.vector * int * int) -> int = cfun "writebuf"
64      val writearr' : (int * Word8Array.array * int * int) -> int = cfun "writebuf"      val writearr' : (int * Word8Array.array * int * int) -> int = cfun "writebuf"
65      fun writeArr (fd,{buf, i, sz=NONE}) = let      fun writeArr (fd, asl) = let
66            val alen = Word8Array.length buf          val (buf, i, len) = Word8ArraySlice.base asl
           in  
             if 0 <= i andalso i <= alen  
               then writearr'(FS.intOf fd, buf, alen-i, i)  
               else raise Subscript  
           end  
       | writeArr (fd,{buf, i, sz=SOME sz}) = let  
           val alen = Word8Array.length buf  
67            in            in
68              if 0 <= i andalso 0 <= sz andalso i + sz <= alen          writearr' (FS.intOf fd, buf, len, i)
               then writearr'(FS.intOf fd, buf, sz, i)  
               else raise Subscript  
69            end            end
70    
71      fun writeVec (fd,{buf, i, sz=NONE}) = let      fun writeVec (fd, vsl) = let
72            val vlen = Word8Vector.length buf          val (buf, i, len) = Word8VectorSlice.base vsl
           in  
             if 0 <= i andalso i <= vlen  
               then writevec'(FS.intOf fd, buf, vlen-i, i)  
               else raise Subscript  
           end  
       | writeVec (fd,{buf, i, sz=SOME sz}) = let  
           val vlen = Word8Vector.length buf  
73            in            in
74              if 0 <= i andalso 0 <= sz andalso i + sz <= vlen          writevec' (FS.intOf fd, buf, len, i)
               then writevec'(FS.intOf fd, buf, sz, i)  
               else raise Subscript  
75            end            end
76    
77      datatype whence = SEEK_SET | SEEK_CUR | SEEK_END      datatype whence = SEEK_SET | SEEK_CUR | SEEK_END

Legend:
Removed from v.1380  
changed lines
  Added in v.1381

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0