convert tabs to spaces. strip trailing whitespace.

This commit is contained in:
Jeremy Shaw 2015-10-09 19:35:06 -05:00
parent da0b010b33
commit 7c50a8cb6c
11 changed files with 129 additions and 134 deletions

View File

@ -22,4 +22,3 @@ module System.Eval (
) where ) where
import System.Eval.Haskell {-all-} import System.Eval.Haskell {-all-}

View File

@ -93,4 +93,3 @@ mkUniqueWith wrapper src mods = do
-- --
cleanup :: String -> String -> IO () cleanup :: String -> String -> IO ()
cleanup a b = mapM_ removeFile [a, b, replaceSuffix b ".hi"] cleanup a b = mapM_ removeFile [a, b, replaceSuffix b ".hi"]

View File

@ -34,4 +34,3 @@ import System.Plugins.Load {-all-}
-- --
-- [@NAME@] hs-plugins library : compile and load Haskell code at runtime -- [@NAME@] hs-plugins library : compile and load Haskell code at runtime
-- --

View File

@ -429,37 +429,37 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p
#else #else
libdirs = libraryDirs pkg ++ ldOptsPaths libdirs = libraryDirs pkg ++ ldOptsPaths
#endif #endif
-- If we're loading dynamic libs we need the cbits to appear before the -- If we're loading dynamic libs we need the cbits to appear before the
-- real packages. -- real packages.
libs <- mapM (findHSlib libdirs) (cbits ++ hslibs) libs <- mapM (findHSlib libdirs) (cbits ++ hslibs)
#if defined(CYGWIN) || defined(__MINGW32__) #if defined(CYGWIN) || defined(__MINGW32__)
windowsos <- catch (getEnv "OS") windowsos <- catch (getEnv "OS")
(\e -> if isDoesNotExistError e then return "Windows_98" else ioError e) (\e -> if isDoesNotExistError e then return "Windows_98" else ioError e)
windowsdir <- windowsdir <-
if windowsos == "Windows_9X" -- I don't know Windows 9X has OS system variable if windowsos == "Windows_9X" -- I don't know Windows 9X has OS system variable
then return "C:/windows" then return "C:/windows"
else return "C:/winnt" else return "C:/winnt"
sysroot <- catch (getEnv "SYSTEMROOT") sysroot <- catch (getEnv "SYSTEMROOT")
(\e -> if isDoesNotExistError e then return windowsdir else ioError e) -- guess at a reasonable default (\e -> if isDoesNotExistError e then return windowsdir else ioError e) -- guess at a reasonable default
let syslibdir = sysroot ++ (if windowsos == "Windows_9X" then "/SYSTEM" else "/SYSTEM32") let syslibdir = sysroot ++ (if windowsos == "Windows_9X" then "/SYSTEM" else "/SYSTEM32")
libs' <- mapM (findDLL $ syslibdir : libdirs) dlls libs' <- mapM (findDLL $ syslibdir : libdirs) dlls
#else #else
libs' <- mapM (findDLL libdirs) dlls libs' <- mapM (findDLL libdirs) dlls
#endif #endif
let slibs = [ lib | Right (Static lib) <- libs ] let slibs = [ lib | Right (Static lib) <- libs ]
dlibs = [ lib | Right (Dynamic lib) <- libs ] dlibs = [ lib | Right (Dynamic lib) <- libs ]
return (deppkgs, (slibs,map (either id id) libs' ++ dlibs) ) return (deppkgs, (slibs,map (either id id) libs' ++ dlibs) )
#if defined(CYGWIN) || defined(__MINGW32__) #if defined(CYGWIN) || defined(__MINGW32__)
-- replace $topdir -- replace $topdir
fix_topdir [] = [] fix_topdir [] = []
fix_topdir (x:xs) = replace_topdir x : fix_topdir xs fix_topdir (x:xs) = replace_topdir x : fix_topdir xs
replace_topdir [] = [] replace_topdir [] = []
replace_topdir ('$':xs) replace_topdir ('$':xs)
| take 6 xs == "topdir" = ghcLibraryPath ++ (drop 6 xs) | take 6 xs == "topdir" = ghcLibraryPath ++ (drop 6 xs)
| otherwise = '$' : replace_topdir xs | otherwise = '$' : replace_topdir xs
replace_topdir (x:xs) = x : replace_topdir xs replace_topdir (x:xs) = x : replace_topdir xs
#endif #endif
-- a list elimination form for the Maybe type -- a list elimination form for the Maybe type
--filterRight :: [Either left right] -> [right] --filterRight :: [Either left right] -> [right]
@ -477,31 +477,31 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p
if b then return $ Just l -- found it! if b then return $ Just l -- found it!
else findHSlib' dirs lib else findHSlib' dirs lib
findHSslib dirs lib = findHSlib' dirs $ lib ++ sysPkgSuffix findHSslib dirs lib = findHSlib' dirs $ lib ++ sysPkgSuffix
findHSdlib dirs lib = findHSlib' dirs $ mkDynPkgName lib findHSdlib dirs lib = findHSlib' dirs $ mkDynPkgName lib
-- Problem: sysPkgSuffix is ".o", but extra libraries could be -- Problem: sysPkgSuffix is ".o", but extra libraries could be
-- ".so" -- ".so"
-- Solution: first look for static library, if we don't find it -- Solution: first look for static library, if we don't find it
-- look for a dynamic version. -- look for a dynamic version.
findHSlib :: [FilePath] -> String -> IO (Either String HSLib) findHSlib :: [FilePath] -> String -> IO (Either String HSLib)
findHSlib dirs lib = do findHSlib dirs lib = do
static <- findHSslib dirs lib static <- findHSslib dirs lib
case static of case static of
Just file -> return $ Right $ Static file Just file -> return $ Right $ Static file
Nothing -> do Nothing -> do
dynamic <- findHSdlib dirs lib dynamic <- findHSdlib dirs lib
case dynamic of case dynamic of
Just file -> return $ Right $ Dynamic file Just file -> return $ Right $ Dynamic file
Nothing -> return $ Left lib Nothing -> return $ Left lib
findDLL :: [FilePath] -> String -> IO (Either String FilePath) findDLL :: [FilePath] -> String -> IO (Either String FilePath)
findDLL [] lib = return (Left lib) findDLL [] lib = return (Left lib)
findDLL (dir:dirs) lib = do findDLL (dir:dirs) lib = do
let l = dir </> lib let l = dir </> lib
b <- doesFileExist l b <- doesFileExist l
if b then return $ Right l if b then return $ Right l
else findDLL dirs lib else findDLL dirs lib
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- do we have a Module name for this merge? -- do we have a Module name for this merge?

View File

@ -610,7 +610,7 @@ loadPackage p = do
putStr (' ':show libs) >> hFlush stdout putStr (' ':show libs) >> hFlush stdout
putStr (' ':show dlls) >> hFlush stdout putStr (' ':show dlls) >> hFlush stdout
#endif #endif
mapM_ loadShared dlls mapM_ loadShared dlls

View File

@ -446,4 +446,3 @@ readFile' f = do
length s `seq` return () length s `seq` return ()
hClose h hClose h
return s return s

View File

@ -154,7 +154,7 @@ hMkUnique = do (t,h) <- mkTemp
mkUniqueIn :: FilePath -> IO FilePath mkUniqueIn :: FilePath -> IO FilePath
mkUniqueIn dir = do (t,h) <- hMkUniqueIn dir mkUniqueIn dir = do (t,h) <- hMkUniqueIn dir
hClose h >> return t hClose h >> return t
hMkUniqueIn :: FilePath -> IO (FilePath,Handle) hMkUniqueIn :: FilePath -> IO (FilePath,Handle)
hMkUniqueIn dir = do (t,h) <- mkTempIn dir hMkUniqueIn dir = do (t,h) <- mkTempIn dir
@ -505,4 +505,3 @@ isSublistOf _ [] = False
isSublistOf x y@(_:ys) isSublistOf x y@(_:ys)
| isPrefixOf x y = True | isPrefixOf x y = True
| otherwise = isSublistOf x ys | otherwise = isSublistOf x ys