Skip to content
Snippets Groups Projects
Commit 9065404a authored by sof's avatar sof
Browse files

[project @ 1998-09-29 15:50:13 by sof]

merged from HEAD
parent f589a1b3
No related merge requests found
......@@ -54,10 +54,7 @@ module CString
import PrelPack
import GlaExts
import Addr
import PrelIOBase ( IO(..), IOResult(..))
import PrelArr ( StateAndMutableByteArray#(..),
StateAndByteArray#(..)
)
import PrelIOBase ( IO(..) )
\end{code}
......@@ -164,21 +161,21 @@ out the bounds - use with care.
allocChars :: Int -> IO (MutableByteArray RealWorld Int)
allocChars (I# size#) = IO $ \ s# ->
case newCharArray# size# s# of
StateAndMutableByteArray# s2# barr# ->
IOok s2# (MutableByteArray (I# 1#, I# size#) barr#)
(# s2#, barr# #) ->
(# s2#, (MutableByteArray (I# 1#, I# size#) barr#) #)
allocWords :: Int -> IO (MutableByteArray RealWorld Int)
allocWords (I# size#) = IO $ \ s# ->
case newIntArray# size# s# of
StateAndMutableByteArray# s2# barr# ->
IOok s2# (MutableByteArray (I# 1#, I# size#) barr#)
(# s2#, barr# #) ->
(# s2#, (MutableByteArray (I# 1#, I# size#) barr#) #)
-- Freeze these index-free mutable arrays
freeze :: MutableByteArray RealWorld Int -> IO (ByteArray Int)
freeze (MutableByteArray ixs arr#) = IO $ \ s# ->
case unsafeFreezeByteArray# arr# s# of
StateAndByteArray# s2# frozen# ->
IOok s2# (ByteArray ixs frozen#)
(# s2#, frozen# #) ->
(# s2#, (ByteArray ixs frozen#) #)
-- Copy a null-terminated string from outside the heap to
-- Haskellized nonsense inside the heap
......
......@@ -8,8 +8,9 @@
#endif
#define NON_POSIX_SOURCE
#include "rtsdefs.h"
#include "Rts.h"
#include "ghcSockets.h"
#include "stgio.h"
StgInt
getSocketOption__ (fd, opt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment