[project @ 2005-03-15 12:15:15 by malcolm]
authormalcolm <unknown>
Tue, 15 Mar 2005 12:15:16 +0000 (12:15 +0000)
committermalcolm <unknown>
Tue, 15 Mar 2005 12:15:16 +0000 (12:15 +0000)
nhc98 can use the WCsubst.c stuff for Unicode as well.

Data/Char.hs
Makefile.nhc98

index fa0e899..546edfa 100644 (file)
@@ -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
index 051d631..63edf52 100644 (file)
@@ -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