From: malcolm Date: Tue, 15 Mar 2005 12:15:16 +0000 (+0000) Subject: [project @ 2005-03-15 12:15:15 by malcolm] X-Git-Tag: arity-anal-branch-point~25 X-Git-Url: http://git.megacz.com/?p=ghc-base.git;a=commitdiff_plain;h=8f298c3539c4786f48ae89d8ca754115210106cf [project @ 2005-03-15 12:15:15 by malcolm] nhc98 can use the WCsubst.c stuff for Unicode as well. --- diff --git a/Data/Char.hs b/Data/Char.hs index fa0e899..546edfa 100644 --- a/Data/Char.hs +++ b/Data/Char.hs @@ -70,6 +70,8 @@ import Hugs.Char import Prelude import Prelude(Char,String) import Char +import NHC.FFI (CInt) +foreign import ccall unsafe "WCsubst.h u_gencat" wgencat :: CInt -> Int #endif -- | Convert a single digit 'Char' to the corresponding 'Int'. @@ -89,7 +91,6 @@ isAsciiLower c = c >= 'a' && c <= 'z' isAsciiUpper c = c >= 'A' && c <= 'Z' #endif -#ifndef __NHC__ -- | Unicode General Categories (column 2 of the UnicodeData table) -- in the order they are listed in the Unicode standard. @@ -128,7 +129,7 @@ data GeneralCategory -- | Retrieves the general Unicode category of the character. generalCategory :: Char -> GeneralCategory -#ifdef __GLASGOW_HASKELL__ +#if defined(__GLASGOW_HASKELL__) || defined(__NHC__) generalCategory c = toEnum (wgencat (fromIntegral (ord c))) #endif #ifdef __HUGS__ @@ -185,7 +186,6 @@ isSeparator c = case generalCategory c of LineSeparator -> True ParagraphSeparator -> True _ -> False -#endif /* !__NHC__ */ #ifdef __NHC__ -- dummy implementation diff --git a/Makefile.nhc98 b/Makefile.nhc98 index 051d631..63edf52 100644 --- a/Makefile.nhc98 +++ b/Makefile.nhc98 @@ -31,7 +31,8 @@ SRCS = \ Text/Html/BlockTable.hs Text/Html.hs Text/Printf.hs \ Text/Read.hs Text/Show.hs Text/Show/Functions.hs \ Text/ParserCombinators/ReadP.hs Data/Version.hs \ - Text/Regex/Posix.hsc Text/Regex.hs + Text/Regex/Posix.hsc Text/Regex.hs \ + WCsubst.c # Text/ParserCombinators/ReadPrec.hs