X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FEncoding.hs;h=2943768d56a607b85b69a4e9c7492d081a1ab255;hb=21a85c38819cfc951c6c8b440d9ea74f3fa02d55;hp=5afe870934a1a42a3dae0ae5141637e7a9e09b9d;hpb=159689198a04d62643028ebd9a49ccb91552337e;p=ghc-hetmet.git diff --git a/compiler/utils/Encoding.hs b/compiler/utils/Encoding.hs index 5afe870..2943768 100644 --- a/compiler/utils/Encoding.hs +++ b/compiler/utils/Encoding.hs @@ -134,8 +134,9 @@ countUTF8Chars ptr bytes = go ptr 0 | ptr >= end = return n | otherwise = do case utf8DecodeChar# (unPtr ptr) of - (# c, a #) -> go (Ptr a) (n+1) + (# _, a #) -> go (Ptr a) (n+1) +unPtr :: Ptr a -> Addr# unPtr (Ptr a) = a utf8EncodeChar :: Char -> Ptr Word8 -> IO (Ptr Word8) @@ -166,7 +167,7 @@ utf8EncodeChar c ptr = utf8EncodeString :: Ptr Word8 -> String -> IO () utf8EncodeString ptr str = go ptr str where STRICT2(go) - go ptr [] = return () + go _ [] = return () go ptr (c:cs) = do ptr' <- utf8EncodeChar c ptr go ptr' cs @@ -327,6 +328,7 @@ decode_lower 'v' = '%' decode_lower ch = {-pprTrace "decode_lower" (char ch)-} ch -- Characters not having a specific code are coded as z224U (in hex) +decode_num_esc :: Char -> EncodedString -> UserString decode_num_esc d rest = go (digitToInt d) rest where @@ -364,13 +366,13 @@ maybe_tuple :: UserString -> Maybe EncodedString maybe_tuple "(# #)" = Just("Z1H") maybe_tuple ('(' : '#' : cs) = case count_commas (0::Int) cs of - (n, '#' : ')' : cs) -> Just ('Z' : shows (n+1) "H") - other -> Nothing + (n, '#' : ')' : _) -> Just ('Z' : shows (n+1) "H") + _ -> Nothing maybe_tuple "()" = Just("Z0T") maybe_tuple ('(' : cs) = case count_commas (0::Int) cs of - (n, ')' : cs) -> Just ('Z' : shows (n+1) "T") - other -> Nothing -maybe_tuple other = Nothing + (n, ')' : _) -> Just ('Z' : shows (n+1) "T") + _ -> Nothing +maybe_tuple _ = Nothing count_commas :: Int -> String -> (Int, String) count_commas n (',' : cs) = count_commas (n+1) cs