-{-# OPTIONS_GHC -fno-implicit-prelude -funbox-strict-fields #-}
+{-# OPTIONS_GHC -XNoImplicitPrelude -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns #-}
-----------------------------------------------------------------------------
-- |
import GHC.Base
import GHC.Real
import GHC.Num
-import GHC.IO
+-- import GHC.IO
import GHC.IO.Exception
import GHC.IO.Buffer
import GHC.IO.Encoding.Types
-- The UTF-32 codec: either UTF-32BE or UTF-32LE with a BOM
utf32 :: TextEncoding
-utf32 = TextEncoding { mkTextDecoder = utf32_DF,
+utf32 = TextEncoding { textEncodingName = "UTF-32",
+ mkTextDecoder = utf32_DF,
mkTextEncoder = utf32_EF }
utf32_DF :: IO (TextDecoder (Maybe DecodeBuffer))
-- UTF32LE and UTF32BE
utf32be :: TextEncoding
-utf32be = TextEncoding { mkTextDecoder = utf32be_DF,
+utf32be = TextEncoding { textEncodingName = "UTF-32BE",
+ mkTextDecoder = utf32be_DF,
mkTextEncoder = utf32be_EF }
utf32be_DF :: IO (TextDecoder ())
utf32le :: TextEncoding
-utf32le = TextEncoding { mkTextDecoder = utf32le_DF,
+utf32le = TextEncoding { textEncodingName = "UTF-32LE",
+ mkTextDecoder = utf32le_DF,
mkTextEncoder = utf32le_EF }
utf32le_DF :: IO (TextDecoder ())
c3 <- readWord8Buf iraw (ir+3)
let x1 = chr4 c0 c1 c2 c3
if not (validate x1) then invalid else do
- writeCharBuf oraw ow x1
- loop (ir+4) (ow+1)
+ ow' <- writeCharBuf oraw ow x1
+ loop (ir+4) ow'
where
invalid = if ir > ir0 then done ir ow else ioe_decodingError
c3 <- readWord8Buf iraw (ir+3)
let x1 = chr4 c3 c2 c1 c0
if not (validate x1) then invalid else do
- writeCharBuf oraw ow x1
- loop (ir+4) (ow+1)
+ ow' <- writeCharBuf oraw ow x1
+ loop (ir+4) ow'
where
invalid = if ir > ir0 then done ir ow else ioe_decodingError