in stage1, we should get isPrint and isUpper from Compat.Unicode, not Data.Char
authorSimon Marlow <simonmar@microsoft.com>
Wed, 29 Mar 2006 11:59:13 +0000 (11:59 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 29 Mar 2006 11:59:13 +0000 (11:59 +0000)
ghc/compiler/parser/Lexer.x
ghc/lib/compat/Compat/Unicode.hs

index 31acaa0..4c1b48e 100644 (file)
@@ -44,14 +44,14 @@ import Ctype
 import Util            ( maybePrefixMatch, readRational )
 
 import DATA_BITS
 import Util            ( maybePrefixMatch, readRational )
 
 import DATA_BITS
-import Data.Char
+import Data.Char       ( chr )
 import Ratio
 --import TRACE
 
 #if __GLASGOW_HASKELL__ >= 605
 import Ratio
 --import TRACE
 
 #if __GLASGOW_HASKELL__ >= 605
-import Data.Char       ( GeneralCategory(..), generalCategory )
+import Data.Char       ( GeneralCategory(..), generalCategory, isPrint, isUpper )
 #else
 #else
-import Compat.Unicode  ( GeneralCategory(..), generalCategory )
+import Compat.Unicode  ( GeneralCategory(..), generalCategory, isPrint, isUpper )
 #endif
 }
 
 #endif
 }
 
index 4765511..3c8bfc6 100644 (file)
@@ -1,6 +1,6 @@
 {-# OPTIONS -cpp #-}
 module Compat.Unicode (
 {-# OPTIONS -cpp #-}
 module Compat.Unicode (
-    GeneralCategory(..), generalCategory,
+    GeneralCategory(..), generalCategory, isPrint, isUpper
   ) where
 
 #if __GLASGOW_HASKELL__ > 604
   ) where
 
 #if __GLASGOW_HASKELL__ > 604
@@ -54,4 +54,13 @@ generalCategory c = toEnum (wgencat (fromIntegral (ord c)))
 
 foreign import ccall unsafe "u_gencat"
   wgencat :: CInt -> Int
 
 foreign import ccall unsafe "u_gencat"
   wgencat :: CInt -> Int
+
+isPrint c = iswprint (fromIntegral (ord c)) /= 0
+isUpper c = iswupper (fromIntegral (ord c)) /= 0
+
+foreign import ccall unsafe "u_iswprint"
+  iswprint :: CInt -> CInt
+
+foreign import ccall unsafe "u_iswupper"
+  iswupper :: CInt -> CInt
 #endif
 #endif