From: wolfgang Date: Wed, 23 Jul 2003 10:27:49 +0000 (+0000) Subject: [project @ 2003-07-23 10:27:49 by wolfgang] X-Git-Tag: nhc98-1-18-release~582 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0305f4e365b5b96be0f5b28d04b424ffb07a4bb1;p=ghc-base.git [project @ 2003-07-23 10:27:49 by wolfgang] Fix regular expressions for Mac OS X. For some reason, Apple uses 64-bit offsets in regmatch_t, so we have to use (#type regoff_t) instead of CInt. MERGE TO STABLE. --- diff --git a/Text/Regex/Posix.hsc b/Text/Regex/Posix.hsc index 865398d..9cc06f7 100644 --- a/Text/Regex/Posix.hsc +++ b/Text/Regex/Posix.hsc @@ -103,8 +103,8 @@ regexec (Regex regex_fptr) str = do matched_parts :: String -> Ptr CRegMatch -> IO (String, String, String) matched_parts string p_match = do - start <- (#peek regmatch_t, rm_so) p_match :: IO CInt - end <- (#peek regmatch_t, rm_eo) p_match :: IO CInt + start <- (#peek regmatch_t, rm_so) p_match :: IO (#type regoff_t) + end <- (#peek regmatch_t, rm_eo) p_match :: IO (#type regoff_t) let s = fromIntegral start; e = fromIntegral end return ( take s string, take (e-s) (drop s string), @@ -112,8 +112,8 @@ matched_parts string p_match = do unpack :: String -> Ptr CRegMatch -> IO (String) unpack string p_match = do - start <- (#peek regmatch_t, rm_so) p_match :: IO CInt - end <- (#peek regmatch_t, rm_eo) p_match :: IO CInt + start <- (#peek regmatch_t, rm_so) p_match :: IO (#type regoff_t) + end <- (#peek regmatch_t, rm_eo) p_match :: IO (#type regoff_t) -- the subexpression may not have matched at all, perhaps because it -- was optional. In this case, the offsets are set to -1. if (start == -1) then return "" else do