From 1fb39ac3825e3db3824eed5e2359a676f260cbd3 Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 13 Feb 2002 20:14:42 +0000 Subject: [PATCH] [project @ 2002-02-13 20:14:41 by sof] The days of main/rawSystem.c and (its use in) main/SysTools.lhs are almost up..for now, don't bother copying it in if we're booting with 5.02 or later (which we are under mingw, which is the only plat. where this hack matters). --- ghc/compiler/Makefile | 6 +++--- ghc/compiler/main/SysTools.lhs | 20 +++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index fbf266c..3839546 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.210 2002/02/12 15:17:13 simonmar Exp $ +# $Id: Makefile,v 1.211 2002/02/13 20:14:42 sof Exp $ TOP = .. @@ -156,12 +156,12 @@ HS_OBJS += $(C_OBJS) # into main/ (where it'll be compiled and linked with the compiler) # (the Haskell-side code is ifdefed into main/SysTools.lhs) -ifneq "$(bootstrapped)" "YES" +ifeq "$(bootstrapped)/$(ghc_502_at_least)" "NO/NO" SRC_CC_OPTS += -I$(GHC_LIB_DIR)/std/cbits SRC_MKDEPENDC_OPTS += -I$(GHC_LIB_DIR)/std/cbits ALL_SRCS += main/rawSystem.c main/rawSystem.c : $(FPTOOLS_TOP)/hslibs/lang/cbits/rawSystem.c - $(CP) $< main + $(CP) $< main/ else EXCLUDED_SRCS = main/rawSystem.c endif diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index f8818ba..2754cfb 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -89,14 +89,14 @@ import MarshalArray -- use the line below when we can be sure of compiling with GHC >= -- 5.02, and remove the implementation of rawSystem at the end of this -- file -#if __GLASGOW_HASKELL__ >= 503 +# if __GLASGOW_HASKELL__ >= 503 import GHC.IOBase -#else +# else import PrelIOBase -- this can be removed when SystemExts is used -#endif -import CError ( throwErrnoIfMinus1 ) -- as can this --- import SystemExts ( rawSystem ) +# endif +import SystemExts ( rawSystem ) #else +import CError ( throwErrnoIfMinus1 ) -- as can this import System ( system ) #endif @@ -410,7 +410,7 @@ initSysTools minusB_args } #if defined(mingw32_TARGET_OS) -foreign import stdcall "GetTempPathA" getTempPath :: Int -> CString -> IO Int32 +foreign import stdcall "GetTempPathA" unsafe getTempPath :: Int -> CString -> IO Int32 #endif \end{code} @@ -848,20 +848,20 @@ getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32. return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s))))) -foreign import stdcall "GetModuleFileNameA" getModuleFileName :: Addr -> CString -> Int -> IO Int32 +foreign import stdcall "GetModuleFileNameA" unsafe getModuleFileName :: Addr -> CString -> Int -> IO Int32 #else getExecDir :: IO (Maybe String) = do return Nothing #endif #ifdef mingw32_TARGET_OS -foreign import "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows +foreign import "_getpid" unsafe getProcessID :: IO Int -- relies on Int == Int32 on Windows #else getProcessID :: IO Int getProcessID = Posix.getProcessID #endif +#if defined(mingw32_TARGET_OS) && (__GLASGOW_HASKELL__ <= 408) rawSystem :: String -> IO ExitCode -#if __GLASGOW_HASKELL__ > 408 rawSystem "" = ioException (IOError Nothing InvalidArgument "rawSystem" "null command" Nothing) rawSystem cmd = withCString cmd $ \s -> do @@ -871,8 +871,6 @@ rawSystem cmd = n -> return (ExitFailure n) foreign import ccall "rawSystemCmd" unsafe primRawSystem :: CString -> IO Int -#else -rawSystem = System.system #endif -- 1.7.10.4