Convert to new cabal and bytestring interfaces
darcs-hash:20071210234921-a4fee-251367abbc4d99d72f425b2d1b69ce2c36f32572
This commit is contained in:
parent
5b02009636
commit
7e291fcefe
@ -20,7 +20,13 @@ import Data.Array(array)
|
||||
import Data.ByteString (ByteString,unfoldrN,unfoldr,length,index,unpack)
|
||||
import qualified Data.ByteString.Lazy as LBS
|
||||
import Data.Encoding.Helper.Template
|
||||
|
||||
#if __GLASGOW_HASKELL__>=608
|
||||
import Data.ByteString.Unsafe(unsafeIndex)
|
||||
#else
|
||||
import Data.ByteString.Base(unsafeIndex)
|
||||
#endif
|
||||
|
||||
import Data.Map (Map,fromList,lookup)
|
||||
import Data.Char(chr)
|
||||
import Data.Maybe(mapMaybe)
|
||||
|
||||
@ -13,7 +13,12 @@ import Data.Bits
|
||||
import Data.Encoding.Base
|
||||
import Data.ByteString (ByteString)
|
||||
import qualified Data.ByteString as BS
|
||||
|
||||
#if __GLASGOW_HASKELL__>=608
|
||||
import Data.ByteString.Unsafe (unsafeIndex)
|
||||
#else
|
||||
import Data.ByteString.Base (unsafeIndex)
|
||||
#endif
|
||||
|
||||
import Data.Encoding.GB18030Data
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -63,7 +63,16 @@ createModuleFromFile name str = createModule (readDecodeTable name str)
|
||||
|
||||
createModule :: [(Char,[Word8])] -> [(Char,Char)] -> [(Int,Int)] -> String
|
||||
createModule mp ranges rranges = unlines $
|
||||
["module Data.Encoding.GB18030Data where","","import Data.ByteString.Base"]
|
||||
["{-# OPTIONS -fglasgow-exts #-}"
|
||||
,"module Data.Encoding.GB18030Data where"
|
||||
,""
|
||||
,"import Data.ByteString(ByteString)"
|
||||
,"#if __GLASGOW_HASKELL__>=608"
|
||||
,"import Data.ByteString.Unsafe(unsafePackAddressLen)"
|
||||
,"#else"
|
||||
,"import Data.ByteString.Base(unsafePackAddressLen)"
|
||||
,"#endif"
|
||||
,"import System.IO.Unsafe(unsafePerformIO)"]
|
||||
++ (createAddrVars "arr" (map (uncurry $ createAddr mp) ranges))
|
||||
++ (createAddrVars "rarr" (map (uncurry $ createRAddr4 mp) rranges))
|
||||
++ (createAddrVar "rrarr" (createRAddr2 mp))
|
||||
@ -76,7 +85,7 @@ createAddrVar :: String -> [Word8] -> [String]
|
||||
createAddrVar name cont =
|
||||
[""
|
||||
,name++" :: ByteString"
|
||||
,name++" = unsafePackAddress "++show (length cont)++" \""++addr cont++"\"#"
|
||||
,name++" = unsafePerformIO $ unsafePackAddressLen "++show (length cont)++" \""++addr cont++"\"#"
|
||||
]
|
||||
|
||||
createAddr :: [(Char,[Word8])] -> Char -> Char -> [Word8]
|
||||
|
||||
152
encoding.cabal
152
encoding.cabal
@ -1,5 +1,5 @@
|
||||
Name: encoding
|
||||
Version: 0.2
|
||||
Version: 0.3
|
||||
Author: Henning Günther
|
||||
Maintainer: h.guenther@tu-bs.de
|
||||
License: BSD3
|
||||
@ -9,74 +9,84 @@ Description:
|
||||
Haskell has excellect handling of unicode, the Char type covers all unicode chars. Unfortunatly, there's no possibility to read or write something to the outer world in an encoding other than ascii due to the lack of support for encodings. This library should help with that.
|
||||
Category: Codec
|
||||
Homepage: http://code.haskell.org/encoding/
|
||||
Build-Depends: base, template-haskell
|
||||
Extensions: TemplateHaskell,CPP,ExistentialQuantification
|
||||
C-Sources: system_encoding.c
|
||||
Include-Dirs: .
|
||||
Install-Includes: system_encoding.h
|
||||
Exposed-Modules:
|
||||
Data.Encoding
|
||||
Data.Encoding.ASCII
|
||||
Data.Encoding.UTF8
|
||||
Data.Encoding.UTF16
|
||||
Data.Encoding.UTF32
|
||||
Data.Encoding.ISO88591
|
||||
Data.Encoding.ISO88592
|
||||
Data.Encoding.ISO88593
|
||||
Data.Encoding.ISO88594
|
||||
Data.Encoding.ISO88595
|
||||
Data.Encoding.ISO88596
|
||||
Data.Encoding.ISO88597
|
||||
Data.Encoding.ISO88598
|
||||
Data.Encoding.ISO88599
|
||||
Data.Encoding.ISO885910
|
||||
Data.Encoding.ISO885911
|
||||
Data.Encoding.ISO885913
|
||||
Data.Encoding.ISO885914
|
||||
Data.Encoding.ISO885915
|
||||
Data.Encoding.ISO885916
|
||||
Data.Encoding.BootString
|
||||
Data.Encoding.CP1250
|
||||
Data.Encoding.CP1251
|
||||
Data.Encoding.CP1252
|
||||
Data.Encoding.CP1253
|
||||
Data.Encoding.CP1254
|
||||
Data.Encoding.CP1255
|
||||
Data.Encoding.CP1256
|
||||
Data.Encoding.CP1257
|
||||
Data.Encoding.CP1258
|
||||
Data.Encoding.KOI8R
|
||||
Data.Encoding.GB18030
|
||||
System.IO.Encoding
|
||||
Other-Modules:
|
||||
Data.Encoding.Base
|
||||
Data.Encoding.GB18030Data
|
||||
Data.Encoding.Helper.Template
|
||||
Cabal-Version: >=1.2
|
||||
Extra-Source-Files:
|
||||
8859-2.TXT
|
||||
8859-3.TXT
|
||||
8859-4.TXT
|
||||
8859-5.TXT
|
||||
8859-6.TXT
|
||||
8859-7.TXT
|
||||
8859-8.TXT
|
||||
8859-9.TXT
|
||||
8859-10.TXT
|
||||
8859-11.TXT
|
||||
8859-13.TXT
|
||||
8859-14.TXT
|
||||
8859-15.TXT
|
||||
8859-16.TXT
|
||||
CP1250.TXT
|
||||
CP1251.TXT
|
||||
CP1252.TXT
|
||||
CP1253.TXT
|
||||
CP1254.TXT
|
||||
CP1255.TXT
|
||||
CP1256.TXT
|
||||
CP1257.TXT
|
||||
CP1258.TXT
|
||||
gb-18030-2000.xml
|
||||
system_encoding.h
|
||||
create_gb18030_data.sh
|
||||
NEWS
|
||||
8859-2.TXT
|
||||
8859-3.TXT
|
||||
8859-4.TXT
|
||||
8859-5.TXT
|
||||
8859-6.TXT
|
||||
8859-7.TXT
|
||||
8859-8.TXT
|
||||
8859-9.TXT
|
||||
8859-10.TXT
|
||||
8859-11.TXT
|
||||
8859-13.TXT
|
||||
8859-14.TXT
|
||||
8859-15.TXT
|
||||
8859-16.TXT
|
||||
CP1250.TXT
|
||||
CP1251.TXT
|
||||
CP1252.TXT
|
||||
CP1253.TXT
|
||||
CP1254.TXT
|
||||
CP1255.TXT
|
||||
CP1256.TXT
|
||||
CP1257.TXT
|
||||
CP1258.TXT
|
||||
gb-18030-2000.xml
|
||||
system_encoding.h
|
||||
create_gb18030_data.sh
|
||||
NEWS
|
||||
|
||||
Flag splitBase
|
||||
description: Choose the new smaller, split-up base package.
|
||||
|
||||
Library
|
||||
if flag(splitBase)
|
||||
Build-Depends: bytestring, base >= 3, template-haskell, containers, array
|
||||
else
|
||||
Build-Depends: base < 3, template-haskell
|
||||
Extensions: TemplateHaskell,CPP,ExistentialQuantification,ForeignFunctionInterface
|
||||
C-Sources: system_encoding.c
|
||||
Include-Dirs: .
|
||||
Install-Includes: system_encoding.h
|
||||
Exposed-Modules:
|
||||
Data.Encoding
|
||||
Data.Encoding.ASCII
|
||||
Data.Encoding.UTF8
|
||||
Data.Encoding.UTF16
|
||||
Data.Encoding.UTF32
|
||||
Data.Encoding.ISO88591
|
||||
Data.Encoding.ISO88592
|
||||
Data.Encoding.ISO88593
|
||||
Data.Encoding.ISO88594
|
||||
Data.Encoding.ISO88595
|
||||
Data.Encoding.ISO88596
|
||||
Data.Encoding.ISO88597
|
||||
Data.Encoding.ISO88598
|
||||
Data.Encoding.ISO88599
|
||||
Data.Encoding.ISO885910
|
||||
Data.Encoding.ISO885911
|
||||
Data.Encoding.ISO885913
|
||||
Data.Encoding.ISO885914
|
||||
Data.Encoding.ISO885915
|
||||
Data.Encoding.ISO885916
|
||||
Data.Encoding.BootString
|
||||
Data.Encoding.CP1250
|
||||
Data.Encoding.CP1251
|
||||
Data.Encoding.CP1252
|
||||
Data.Encoding.CP1253
|
||||
Data.Encoding.CP1254
|
||||
Data.Encoding.CP1255
|
||||
Data.Encoding.CP1256
|
||||
Data.Encoding.CP1257
|
||||
Data.Encoding.CP1258
|
||||
Data.Encoding.KOI8R
|
||||
Data.Encoding.GB18030
|
||||
System.IO.Encoding
|
||||
Other-Modules:
|
||||
Data.Encoding.Base
|
||||
Data.Encoding.GB18030Data
|
||||
Data.Encoding.Helper.Template
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user