From: simonmar Date: Mon, 20 Oct 2003 15:56:52 +0000 (+0000) Subject: [project @ 2003-10-20 15:56:52 by simonmar] X-Git-Tag: nhc98-1-18-release~468 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=fed6da8693ae3c1f6059970b694ef0adf1204477;p=ghc-base.git [project @ 2003-10-20 15:56:52 by simonmar] Convert Unicode.hsc to a plain .hs file to fix bootstrapping problems. --- diff --git a/GHC/Unicode.hsc b/GHC/Unicode.hs similarity index 96% rename from GHC/Unicode.hsc rename to GHC/Unicode.hs index d664a13..5da3541 100644 --- a/GHC/Unicode.hsc +++ b/GHC/Unicode.hs @@ -112,7 +112,7 @@ toLower :: Char -> Char -- ----------------------------------------------------------------------------- -- Win32 implementation -#if (defined(HAVE_WCTYPE_H) && HAVE_ISWSPACE) || mingw32_TARGET_OS +#if (defined(HAVE_WCTYPE_H) && HAVE_ISWSPACE && defined(HTYPE_WINT_T) || mingw32_TARGET_OS -- Use the wide-char classification functions if available. Glibc -- seems to implement these properly, even for chars > 0xffff, as long @@ -123,8 +123,8 @@ toLower :: Char -> Char -- friends won't work properly with characters > 0xffff. These -- characters are represented as surrogate pairs in UTF-16. -type WInt = (#type wint_t) -type CInt = (#type int) +type WInt = HTYPE_WINT_T +type CInt = HTYPE_INT isDigit c = iswdigit (fromIntegral (ord c)) /= 0 isAlpha c = iswalpha (fromIntegral (ord c)) /= 0 @@ -193,8 +193,8 @@ isAlphaNum c = isAlpha c || isDigit c -- Case-changing operations -toUpper c@(C## c##) - | isAsciiLower c = C## (chr## (ord## c## -## 32##)) +toUpper c@(C# c#) + | isAsciiLower c = C# (chr# (ord# c# -# 32#)) | isAscii c = c -- fall-through to the slower stuff. | isLower c && c /= '\xDF' && c /= '\xFF' @@ -203,8 +203,8 @@ toUpper c@(C## c##) = c -toLower c@(C## c##) - | isAsciiUpper c = C## (chr## (ord## c## +## 32##)) +toLower c@(C# c#) + | isAsciiUpper c = C# (chr# (ord# c# +# 32#)) | isAscii c = c | isUpper c = unsafeChr (ord c `minusInt` ord 'A' `plusInt` ord 'a') | otherwise = c