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/Sockets/unix-socket.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/Sockets/unix-socket.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 199  Line 199 
199    
200      type 'a buf = {buf : 'a, i : int, sz : int option}      type 'a buf = {buf : 'a, i : int, sz : int option}
201    
202      local      val vbuf = Word8VectorSlice.base
203        fun chk (len, buf, i, NONE) =      val abuf = Word8ArraySlice.base
             if ((i < 0) orelse (len < i))  
               then raise Subscript  
               else (buf, i, len - i)  
         | chk (len, buf, i, SOME sz) =  
             if ((i < 0) orelse (sz < 0) orelse (len-i < sz))  
               then raise Subscript  
               else (buf, i, sz)  
     in  
     fun vbuf {buf, i, sz} = chk (W8V.length buf, buf, i, sz)  
     fun abuf {buf, i, sz} = chk (W8A.length buf, buf, i, sz)  
     end (* local *)  
204    
205    (* default flags *)    (* default flags *)
206      val dfltDon'tRoute = false      val dfltDon'tRoute = false
# Line 289  Line 278 
278              = sockFn "recv"              = sockFn "recv"
279        fun recvV (_, 0, _, _) = W8V.fromList[]        fun recvV (_, 0, _, _) = W8V.fromList[]
280          | recvV (SOCK fd, nbytes, peek, oob) = if (nbytes < 0)          | recvV (SOCK fd, nbytes, peek, oob) = if (nbytes < 0)
281              then raise Subscript              then raise Size
282              else recvV' (fd, nbytes, peek, oob)              else recvV' (fd, nbytes, peek, oob)
283        val recvA : (int * w8array * int * int * bool * bool) -> int        val recvA : (int * w8array * int * int * bool * bool) -> int
284              = sockFn "recvBuf"              = sockFn "recvBuf"
# Line 325  Line 314 
314              = sockFn "recvBufFrom"              = sockFn "recvBufFrom"
315      in      in
316      fun recvVecFrom (sock, sz) = recvFromV (sock, sz, dfltPeek, dfltOOB)      fun recvVecFrom (sock, sz) = recvFromV (sock, sz, dfltPeek, dfltOOB)
317      fun recvArrFrom (SOCK fd, {buf, i}) = let      fun recvArrFrom (SOCK fd, asl) = let
318            val (buf, i, sz) = abuf{buf=buf, i=i, sz=NONE}          val (buf, i, sz) = abuf asl
319            in            in
320              if (sz > 0)          if sz > 0 then let
               then let  
321                  val (n, addr) = recvFromA(fd, buf, i, sz, dfltPeek, dfltOOB)                  val (n, addr) = recvFromA(fd, buf, i, sz, dfltPeek, dfltOOB)
322                  in                  in
323                    (n, ADDR addr)                    (n, ADDR addr)
324                  end                  end
325                else (0, (ADDR(W8V.fromList[])))          else (0, ADDR(W8V.fromList[]))
326            end            end
327      fun recvVecFrom' (sock, sz, {peek, oob}) = recvFromV (sock, sz, peek, oob)      fun recvVecFrom' (sock, sz, {peek, oob}) = recvFromV (sock, sz, peek, oob)
328      fun recvArrFrom' (SOCK fd, {buf, i}, {peek, oob}) = let      fun recvArrFrom' (SOCK fd, asl, {peek, oob}) = let
329            val (buf, i, sz) = abuf{buf=buf, i=i, sz=NONE}            val (buf, i, sz) = abuf asl
330            in            in
331              if (sz > 0)              if (sz > 0)
332                then let val (n, addr) = recvFromA(fd, buf, i, sz, peek, oob)                then let val (n, addr) = recvFromA(fd, buf, i, sz, peek, oob)

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