Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- create :: Int -> (forall s. MBA s -> ST s ()) -> ShortByteString
- asBA :: ShortByteString -> BA
- data BA = BA# ByteArray#
- data MBA s = MBA# (MutableByteArray# s)
- newPinnedByteArray :: Int -> ST s (MBA s)
- newByteArray :: Int -> ST s (MBA s)
- copyByteArray :: BA -> Int -> MBA s -> Int -> Int -> ST s ()
- unsafeFreezeByteArray :: MBA s -> ST s BA
- copyAddrToByteArray :: Ptr a -> MBA RealWorld -> Int -> Int -> ST RealWorld ()
- packCWString :: Ptr Word16 -> IO ShortByteString
- packCWStringLen :: (Ptr Word16, Int) -> IO ShortByteString
- useAsCWString :: ShortByteString -> (Ptr Word16 -> IO a) -> IO a
- useAsCWStringLen :: ShortByteString -> ((Ptr Word16, Int) -> IO a) -> IO a
- newCWString :: ShortByteString -> IO (Ptr Word16)
- moduleErrorIO :: String -> String -> IO a
- moduleErrorMsg :: String -> String -> String
- packWord16 :: [Word16] -> ShortByteString
- packLenWord16 :: Int -> [Word16] -> ShortByteString
- unpackWord16 :: ShortByteString -> [Word16]
- packWord16Rev :: [Word16] -> ShortByteString
- packLenWord16Rev :: Int -> [Word16] -> ShortByteString
- writeWord16Array :: MBA s -> Int -> Word16 -> ST s ()
- indexWord16Array :: BA -> Int -> Word16
- encodeWord16LE# :: Word# -> (# Word#, Word# #)
- decodeWord16LE# :: (# Word#, Word# #) -> Word#
Documentation
asBA :: ShortByteString -> BA Source #
packCWString :: Ptr Word16 -> IO ShortByteString Source #
O(n). Construct a new ShortByteString
from a CWString
. The
resulting ShortByteString
is an immutable copy of the original
CWString
, and is managed on the Haskell heap. The original
CWString
must be null terminated.
Since: 0.10.10.0
packCWStringLen :: (Ptr Word16, Int) -> IO ShortByteString Source #
O(n). Construct a new ShortByteString
from a CWStringLen
. The
resulting ShortByteString
is an immutable copy of the original CWStringLen
.
The ShortByteString
is a normal Haskell value and will be managed on the
Haskell heap.
Since: 0.10.10.0
useAsCWString :: ShortByteString -> (Ptr Word16 -> IO a) -> IO a Source #
O(n) construction. Use a ShortByteString
with a function requiring a
null-terminated CWString
. The CWString
is a copy and will be freed
automatically; it must not be stored or used after the
subcomputation finishes.
Since: 0.10.10.0
useAsCWStringLen :: ShortByteString -> ((Ptr Word16, Int) -> IO a) -> IO a Source #
O(n) construction. Use a ShortByteString
with a function requiring a CWStringLen
.
As for useAsCWString
this function makes a copy of the original ShortByteString
.
It must not be stored or used after the subcomputation finishes.
Since: 0.10.10.0
newCWString :: ShortByteString -> IO (Ptr Word16) Source #
O(n) construction. Use a ShortByteString
with a function requiring a CWStringLen
.
As for useAsCWString
this function makes a copy of the original ShortByteString
.
It must not be stored or used after the subcomputation finishes.
Since: 0.10.10.0
packWord16 :: [Word16] -> ShortByteString Source #
packLenWord16 :: Int -> [Word16] -> ShortByteString Source #
unpackWord16 :: ShortByteString -> [Word16] Source #
packWord16Rev :: [Word16] -> ShortByteString Source #
packLenWord16Rev :: Int -> [Word16] -> ShortByteString Source #
This isn't strictly Word16 array write. Instead it's two consecutive Word8 array writes to avoid endianness issues due to primops doing automatic alignment based on host platform. We want to always write LE to the byte array.
This isn't strictly Word16 array read. Instead it's two Word8 array reads to avoid endianness issues due to primops doing automatic alignment based on host platform. We expect the byte array to be LE always.