-- * The @Regex@ type
Regex, -- abstract
-#if !defined(__HUGS__) || defined(HAVE_REGEX_H)
-- * Compiling a regular expression
regcomp, -- :: String -> Int -> IO Regex
-- String, -- everything after match
-- [String])) -- subexpression matches
-#endif
) where
-#if !defined(__HUGS__) || defined(HAVE_REGEX_H)
#include <sys/types.h>
+
+#if HAVE_REGEX_H && HAVE_REGCOMP
#include "regex.h"
+#else
+#include "regex/regex.h"
+{-# CBITS regex/reallocf.c #-}
+{-# CBITS regex/regcomp.c #-}
+{-# CBITS regex/regerror.c #-}
+{-# CBITS regex/regexec.c #-}
+{-# CBITS regex/regfree.c #-}
#endif
import Prelude
-- | A compiled regular expression
newtype Regex = Regex (ForeignPtr CRegex)
-#if !defined(__HUGS__) || defined(HAVE_REGEX_H)
--- to the end
-- -----------------------------------------------------------------------------
-- regcomp
foreign import ccall unsafe "regexec"
c_regexec :: Ptr CRegex -> CString -> CSize
-> Ptr CRegMatch -> CInt -> IO CInt
-
-#endif /* HAVE_REGEX_H */