-{-# 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
-- Latin1
latin1 :: TextEncoding
-latin1 = TextEncoding { mkTextDecoder = latin1_DF,
+latin1 = TextEncoding { textEncodingName = "ISO8859-1",
+ mkTextDecoder = latin1_DF,
mkTextEncoder = latin1_EF }
latin1_DF :: IO (TextDecoder ())
})
latin1_checked :: TextEncoding
-latin1_checked = TextEncoding { mkTextDecoder = latin1_DF,
+latin1_checked = TextEncoding { textEncodingName = "ISO8859-1(checked)",
+ mkTextDecoder = latin1_DF,
mkTextEncoder = latin1_checked_EF }
latin1_checked_EF :: IO (TextEncoder ())
| ow >= os || ir >= iw = done ir ow
| otherwise = do
c0 <- readWord8Buf iraw ir
- writeCharBuf oraw ow (unsafeChr (fromIntegral c0))
- loop (ir+1) (ow+1)
+ ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0))
+ loop (ir+1) ow'
-- lambda-lifted, to avoid thunks being built in the inner-loop:
done !ir !ow = return (if ir == iw then input{ bufL=0, bufR=0 }