mkModid is fixed, so pdynload works well on Windows

This commit is contained in:
shelarcy 2005-06-19 12:05:49 +00:00
parent d07bb01b48
commit 62b6e31734
3 changed files with 7 additions and 3 deletions

View File

@ -15,12 +15,14 @@ import Control.Monad (when)
import System.Exit (exitWith, ExitCode(ExitSuccess)) import System.Exit (exitWith, ExitCode(ExitSuccess))
import System.IO (getContents, putStrLn) import System.IO (getContents, putStrLn)
#if !defined(CYGWIN) && !defined(__MINGW32__)
import System.Posix.Resource (setResourceLimit, import System.Posix.Resource (setResourceLimit,
Resource(ResourceCPUTime), Resource(ResourceCPUTime),
ResourceLimits(ResourceLimits), ResourceLimits(ResourceLimits),
ResourceLimit(ResourceLimit)) ResourceLimit(ResourceLimit))
rlimit = ResourceLimit 3 rlimit = ResourceLimit 3
#endif
context = prehier ++ datas ++ controls context = prehier ++ datas ++ controls
@ -40,7 +42,9 @@ datas = map ("Data." ++) [
controls = map ("Control." ++) ["Monad", "Arrow"] controls = map ("Control." ++) ["Monad", "Arrow"]
main = do main = do
#if !defined(CYGWIN) && defined(__MINGW32__)
setResourceLimit ResourceCPUTime (ResourceLimits rlimit rlimit) setResourceLimit ResourceCPUTime (ResourceLimits rlimit rlimit)
#endif
s <- getContents s <- getContents
when (not . null $ s) $ do when (not . null $ s) $ do
s <- unsafeEval ("(take 2048 (show ("++s++")))") context s <- unsafeEval ("(take 2048 (show ("++s++")))") context

View File

@ -1,6 +1,6 @@
GHCFLAGS= -O GHCFLAGS= -O $(GHC_EXTRA_OPTS)
PKGFLAGS= -package-conf $(TOP)/plugins.conf.inplace PKGFLAGS= -package-conf $(TOP)/plugins.conf.inplace
PKGFLAGS+= -package plugins -package unix PKGFLAGS+= -package plugins
all: build all: build

View File

@ -283,7 +283,7 @@ dropSuffix f = reverse . tail . dropWhile (/= '.') $ reverse f
-- --
-- | work out the mod name from a filepath -- | work out the mod name from a filepath
mkModid :: String -> String mkModid :: String -> String
mkModid = (takeWhile (/= '.')) . reverse . (takeWhile (/= '/')) . reverse mkModid = (takeWhile (/= '.')) . reverse . (takeWhile (\x -> ('/'/= x) && ('\\' /= x))) . reverse
----------------------------------------------------------- -----------------------------------------------------------