{-# LANGUAGE MagicHash,DeriveDataTypeable #-}
module Data.Encoding.ISO885911(ISO885911(..)) where
import Data.Encoding.Base
import Data.Encoding.ByteSource
import Data.Encoding.ByteSink
import Data.Encoding.Exception
import Data.CharMap
import Data.Array.Static
import Data.Map.Static
import Control.Throws
import Prelude hiding (lookup)
import Data.Word
import Data.Typeable
data ISO885911 = ISO885911
deriving (Int -> ISO885911 -> ShowS
[ISO885911] -> ShowS
ISO885911 -> String
(Int -> ISO885911 -> ShowS)
-> (ISO885911 -> String)
-> ([ISO885911] -> ShowS)
-> Show ISO885911
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ISO885911] -> ShowS
$cshowList :: [ISO885911] -> ShowS
show :: ISO885911 -> String
$cshow :: ISO885911 -> String
showsPrec :: Int -> ISO885911 -> ShowS
$cshowsPrec :: Int -> ISO885911 -> ShowS
Show,ISO885911 -> ISO885911 -> Bool
(ISO885911 -> ISO885911 -> Bool)
-> (ISO885911 -> ISO885911 -> Bool) -> Eq ISO885911
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ISO885911 -> ISO885911 -> Bool
$c/= :: ISO885911 -> ISO885911 -> Bool
== :: ISO885911 -> ISO885911 -> Bool
$c== :: ISO885911 -> ISO885911 -> Bool
Eq,Typeable)
decoding_array_ISO885911 :: StaticArray Word8 e
decoding_array_ISO885911 = Word8 -> Word8 -> Addr# -> StaticArray Word8 e
forall i e. i -> i -> Addr# -> StaticArray i e
StaticArray (Word8
0) (Word8
251) Addr#
"\0\0\0\0\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\6\0\0\0\7\0\0\0\8\0\0\0\9\0\0\0\10\0\0\0\11\0\0\0\12\0\0\0\13\0\0\0\14\0\0\0\15\0\0\0\16\0\0\0\17\0\0\0\18\0\0\0\19\0\0\0\20\0\0\0\21\0\0\0\22\0\0\0\23\0\0\0\24\0\0\0\25\0\0\0\26\0\0\0\27\0\0\0\28\0\0\0\29\0\0\0\30\0\0\0\31\0\0\0\32\0\0\0\33\0\0\0\34\0\0\0\35\0\0\0\36\0\0\0\37\0\0\0\38\0\0\0\39\0\0\0\40\0\0\0\41\0\0\0\42\0\0\0\43\0\0\0\44\0\0\0\45\0\0\0\46\0\0\0\47\0\0\0\48\0\0\0\49\0\0\0\50\0\0\0\51\0\0\0\52\0\0\0\53\0\0\0\54\0\0\0\55\0\0\0\56\0\0\0\57\0\0\0\58\0\0\0\59\0\0\0\60\0\0\0\61\0\0\0\62\0\0\0\63\0\0\0\64\0\0\0\65\0\0\0\66\0\0\0\67\0\0\0\68\0\0\0\69\0\0\0\70\0\0\0\71\0\0\0\72\0\0\0\73\0\0\0\74\0\0\0\75\0\0\0\76\0\0\0\77\0\0\0\78\0\0\0\79\0\0\0\80\0\0\0\81\0\0\0\82\0\0\0\83\0\0\0\84\0\0\0\85\0\0\0\86\0\0\0\87\0\0\0\88\0\0\0\89\0\0\0\90\0\0\0\91\0\0\0\92\0\0\0\93\0\0\0\94\0\0\0\95\0\0\0\96\0\0\0\97\0\0\0\98\0\0\0\99\0\0\0\100\0\0\0\101\0\0\0\102\0\0\0\103\0\0\0\104\0\0\0\105\0\0\0\106\0\0\0\107\0\0\0\108\0\0\0\109\0\0\0\110\0\0\0\111\0\0\0\112\0\0\0\113\0\0\0\114\0\0\0\115\0\0\0\116\0\0\0\117\0\0\0\118\0\0\0\119\0\0\0\120\0\0\0\121\0\0\0\122\0\0\0\123\0\0\0\124\0\0\0\125\0\0\0\126\0\0\0\127\0\0\0\128\0\0\0\129\0\0\0\130\0\0\0\131\0\0\0\132\0\0\0\133\0\0\0\134\0\0\0\135\0\0\0\136\0\0\0\137\0\0\0\138\0\0\0\139\0\0\0\140\0\0\0\141\0\0\0\142\0\0\0\143\0\0\0\144\0\0\0\145\0\0\0\146\0\0\0\147\0\0\0\148\0\0\0\149\0\0\0\150\0\0\0\151\0\0\0\152\0\0\0\153\0\0\0\154\0\0\0\155\0\0\0\156\0\0\0\157\0\0\0\158\0\0\0\159\0\0\0\160\0\0\0\1\14\0\0\2\14\0\0\3\14\0\0\4\14\0\0\5\14\0\0\6\14\0\0\7\14\0\0\8\14\0\0\9\14\0\0\10\14\0\0\11\14\0\0\12\14\0\0\13\14\0\0\14\14\0\0\15\14\0\0\16\14\0\0\17\14\0\0\18\14\0\0\19\14\0\0\20\14\0\0\21\14\0\0\22\14\0\0\23\14\0\0\24\14\0\0\25\14\0\0\26\14\0\0\27\14\0\0\28\14\0\0\29\14\0\0\30\14\0\0\31\14\0\0\32\14\0\0\33\14\0\0\34\14\0\0\35\14\0\0\36\14\0\0\37\14\0\0\38\14\0\0\39\14\0\0\40\14\0\0\41\14\0\0\42\14\0\0\43\14\0\0\44\14\0\0\45\14\0\0\46\14\0\0\47\14\0\0\48\14\0\0\49\14\0\0\50\14\0\0\51\14\0\0\52\14\0\0\53\14\0\0\54\14\0\0\55\14\0\0\56\14\0\0\57\14\0\0\58\14\0\0\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\63\14\0\0\64\14\0\0\65\14\0\0\66\14\0\0\67\14\0\0\68\14\0\0\69\14\0\0\70\14\0\0\71\14\0\0\72\14\0\0\73\14\0\0\74\14\0\0\75\14\0\0\76\14\0\0\77\14\0\0\78\14\0\0\79\14\0\0\80\14\0\0\81\14\0\0\82\14\0\0\83\14\0\0\84\14\0\0\85\14\0\0\86\14\0\0\87\14\0\0\88\14\0\0\89\14\0\0\90\14\0\0\91\14\0\0"#
encoding_map_ISO885911 :: CharMap
encoding_map_ISO885911 :: CharMap
encoding_map_ISO885911 = StaticMap Char Word8 -> CharMap
LeafMap1 (StaticArray Int Char
-> StaticArray Int Word8 -> StaticMap Char Word8
forall i e. StaticArray Int i -> StaticArray Int e -> StaticMap i e
StaticMap (Int -> Int -> Addr# -> StaticArray Int Char
forall i e. i -> i -> Addr# -> StaticArray i e
StaticArray (Int
1) (Int
248) Addr#
"\127\0\0\0\63\0\0\0\31\14\0\0\31\0\0\0\95\0\0\0\159\0\0\0\67\14\0\0\15\0\0\0\47\0\0\0\79\0\0\0\111\0\0\0\143\0\0\0\15\14\0\0\47\14\0\0\83\14\0\0\7\0\0\0\23\0\0\0\39\0\0\0\55\0\0\0\71\0\0\0\87\0\0\0\103\0\0\0\119\0\0\0\135\0\0\0\151\0\0\0\7\14\0\0\23\14\0\0\39\14\0\0\55\14\0\0\75\14\0\0\88\14\0\0\3\0\0\0\11\0\0\0\19\0\0\0\27\0\0\0\35\0\0\0\43\0\0\0\51\0\0\0\59\0\0\0\67\0\0\0\75\0\0\0\83\0\0\0\91\0\0\0\99\0\0\0\107\0\0\0\115\0\0\0\123\0\0\0\131\0\0\0\139\0\0\0\147\0\0\0\155\0\0\0\3\14\0\0\11\14\0\0\19\14\0\0\27\14\0\0\35\14\0\0\43\14\0\0\51\14\0\0\63\14\0\0\71\14\0\0\79\14\0\0\86\14\0\0\90\14\0\0\1\0\0\0\5\0\0\0\9\0\0\0\13\0\0\0\17\0\0\0\21\0\0\0\25\0\0\0\29\0\0\0\33\0\0\0\37\0\0\0\41\0\0\0\45\0\0\0\49\0\0\0\53\0\0\0\57\0\0\0\61\0\0\0\65\0\0\0\69\0\0\0\73\0\0\0\77\0\0\0\81\0\0\0\85\0\0\0\89\0\0\0\93\0\0\0\97\0\0\0\101\0\0\0\105\0\0\0\109\0\0\0\113\0\0\0\117\0\0\0\121\0\0\0\125\0\0\0\129\0\0\0\133\0\0\0\137\0\0\0\141\0\0\0\145\0\0\0\149\0\0\0\153\0\0\0\157\0\0\0\1\14\0\0\5\14\0\0\9\14\0\0\13\14\0\0\17\14\0\0\21\14\0\0\25\14\0\0\29\14\0\0\33\14\0\0\37\14\0\0\41\14\0\0\45\14\0\0\49\14\0\0\53\14\0\0\57\14\0\0\65\14\0\0\69\14\0\0\73\14\0\0\77\14\0\0\81\14\0\0\85\14\0\0\87\14\0\0\89\14\0\0\91\14\0\0\0\0\0\0\2\0\0\0\4\0\0\0\6\0\0\0\8\0\0\0\10\0\0\0\12\0\0\0\14\0\0\0\16\0\0\0\18\0\0\0\20\0\0\0\22\0\0\0\24\0\0\0\26\0\0\0\28\0\0\0\30\0\0\0\32\0\0\0\34\0\0\0\36\0\0\0\38\0\0\0\40\0\0\0\42\0\0\0\44\0\0\0\46\0\0\0\48\0\0\0\50\0\0\0\52\0\0\0\54\0\0\0\56\0\0\0\58\0\0\0\60\0\0\0\62\0\0\0\64\0\0\0\66\0\0\0\68\0\0\0\70\0\0\0\72\0\0\0\74\0\0\0\76\0\0\0\78\0\0\0\80\0\0\0\82\0\0\0\84\0\0\0\86\0\0\0\88\0\0\0\90\0\0\0\92\0\0\0\94\0\0\0\96\0\0\0\98\0\0\0\100\0\0\0\102\0\0\0\104\0\0\0\106\0\0\0\108\0\0\0\110\0\0\0\112\0\0\0\114\0\0\0\116\0\0\0\118\0\0\0\120\0\0\0\122\0\0\0\124\0\0\0\126\0\0\0\128\0\0\0\130\0\0\0\132\0\0\0\134\0\0\0\136\0\0\0\138\0\0\0\140\0\0\0\142\0\0\0\144\0\0\0\146\0\0\0\148\0\0\0\150\0\0\0\152\0\0\0\154\0\0\0\156\0\0\0\158\0\0\0\160\0\0\0\2\14\0\0\4\14\0\0\6\14\0\0\8\14\0\0\10\14\0\0\12\14\0\0\14\14\0\0\16\14\0\0\18\14\0\0\20\14\0\0\22\14\0\0\24\14\0\0\26\14\0\0\28\14\0\0\30\14\0\0\32\14\0\0\34\14\0\0\36\14\0\0\38\14\0\0\40\14\0\0\42\14\0\0\44\14\0\0\46\14\0\0\48\14\0\0\50\14\0\0\52\14\0\0\54\14\0\0\56\14\0\0\58\14\0\0\64\14\0\0\66\14\0\0\68\14\0\0\70\14\0\0\72\14\0\0\74\14\0\0\76\14\0\0\78\14\0\0\80\14\0\0\82\14\0\0\84\14\0\0"#) (Int -> Int -> Addr# -> StaticArray Int Word8
forall i e. i -> i -> Addr# -> StaticArray i e
StaticArray (Int
1) (Int
248) Addr#
"\127\63\191\31\95\159\227\15\47\79\111\143\175\207\243\7\23\39\55\71\87\103\119\135\151\167\183\199\215\235\248\3\11\19\27\35\43\51\59\67\75\83\91\99\107\115\123\131\139\147\155\163\171\179\187\195\203\211\223\231\239\246\250\1\5\9\13\17\21\25\29\33\37\41\45\49\53\57\61\65\69\73\77\81\85\89\93\97\101\105\109\113\117\121\125\129\133\137\141\145\149\153\157\161\165\169\173\177\181\185\189\193\197\201\205\209\213\217\225\229\233\237\241\245\247\249\251\0\2\4\6\8\10\12\14\16\18\20\22\24\26\28\30\32\34\36\38\40\42\44\46\48\50\52\54\56\58\60\62\64\66\68\70\72\74\76\78\80\82\84\86\88\90\92\94\96\98\100\102\104\106\108\110\112\114\116\118\120\122\124\126\128\130\132\134\136\138\140\142\144\146\148\150\152\154\156\158\160\162\164\166\168\170\172\174\176\178\180\182\184\186\188\190\192\194\196\198\200\202\204\206\208\210\212\214\216\218\224\226\228\230\232\234\236\238\240\242\244"#))
instance Encoding ISO885911 where
decodeChar :: forall (m :: * -> *). ByteSource m => ISO885911 -> m Char
decodeChar ISO885911
_ = do
Word8
w <- m Word8
forall (m :: * -> *). ByteSource m => m Word8
fetchWord8
(if Word8
wWord8 -> Word8 -> Bool
forall a. Ord a => a -> a -> Bool
>Word8
251 then DecodingException -> m ()
forall e (m :: * -> *) a. Throws e m => e -> m a
throwException (DecodingException -> m ()) -> DecodingException -> m ()
forall a b. (a -> b) -> a -> b
$ Word8 -> DecodingException
IllegalCharacter (Word8 -> DecodingException) -> Word8 -> DecodingException
forall a b. (a -> b) -> a -> b
$ Word8 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
w else () -> m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ())
case StaticArray Word8 (Maybe Char)
forall {e}. StaticArray Word8 e
decoding_array_ISO885911StaticArray Word8 (Maybe Char) -> Word8 -> Maybe Char
forall e i. (StaticElement e, Ix i) => StaticArray i e -> i -> e
!Word8
w of
Maybe Char
Nothing -> DecodingException -> m Char
forall e (m :: * -> *) a. Throws e m => e -> m a
throwException (DecodingException -> m Char) -> DecodingException -> m Char
forall a b. (a -> b) -> a -> b
$ Word8 -> DecodingException
IllegalCharacter (Word8 -> DecodingException) -> Word8 -> DecodingException
forall a b. (a -> b) -> a -> b
$ Word8 -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
w
Just Char
c -> Char -> m Char
forall (m :: * -> *) a. Monad m => a -> m a
return Char
c
encodeChar :: forall (m :: * -> *). ByteSink m => ISO885911 -> Char -> m ()
encodeChar ISO885911
_ Char
c = Char -> CharMap -> m ()
forall (m :: * -> *). ByteSink m => Char -> CharMap -> m ()
mapEncode Char
c CharMap
encoding_map_ISO885911
encodeable :: ISO885911 -> Char -> Bool
encodeable ISO885911
_ Char
c = Char -> CharMap -> Bool
mapMember Char
c CharMap
encoding_map_ISO885911