diff --git a/src-3.0/GF.hs b/src-3.0/GF.hs index 50afeb8e9..34585ef8f 100644 --- a/src-3.0/GF.hs +++ b/src-3.0/GF.hs @@ -33,7 +33,6 @@ import GF.System.Signal import GF.Text.UTF8 import GF.Today (today,version,libdir) -import GF.System.Arch import System (getArgs,system,getEnv) import System.FilePath import Control.Monad (foldM,liftM) diff --git a/src-3.0/GF/Devel/Arch.hs b/src-3.0/GF/Devel/Arch.hs deleted file mode 100644 index dedb1b4f5..000000000 --- a/src-3.0/GF/Devel/Arch.hs +++ /dev/null @@ -1,89 +0,0 @@ ----------------------------------------------------------------------- --- | --- Module : Arch --- Maintainer : AR --- Stability : (stable) --- Portability : (portable) --- --- > CVS $Date: 2005/05/10 14:55:01 $ --- > CVS $Author: bringert $ --- > CVS $Revision: 1.8 $ --- --- architecture\/compiler dependent definitions for unix\/hbc ------------------------------------------------------------------------------ - -module GF.Devel.Arch ( - myStdGen, prCPU, selectLater, modifiedFiles, ModTime, getModTime,getNowTime, - welcomeArch, laterModTime) where - -import System.Time -import System.Random -import System.CPUTime -import Control.Monad (filterM) -import System.Directory - - ----- import qualified UnicodeF as U --(fudlogueWrite) - --- architecture/compiler dependent definitions for unix/hbc - -myStdGen :: Int -> IO StdGen --- ---- myStdGen _ = newStdGen --- gives always the same result -myStdGen int0 = do - t0 <- getClockTime - cal <- toCalendarTime t0 - let int = int0 + ctSec cal + fromInteger (div (ctPicosec cal) 10000000) - return $ mkStdGen int - -prCPU :: Integer -> IO Integer -prCPU cpu = do - cpu' <- getCPUTime - putStrLn (show ((cpu' - cpu) `div` 1000000000) ++ " msec") - return cpu' - -welcomeArch :: String -welcomeArch = "This is the system compiled with ghc." - --- | selects the one with the later modification time of two -selectLater :: FilePath -> FilePath -> IO FilePath -selectLater x y = do - ex <- doesFileExist x - if not ex - then return y --- which may not exist - else do - ey <- doesFileExist y - if not ey - then return x - else do - tx <- getModificationTime x - ty <- getModificationTime y - return $ if tx < ty then y else x - --- | a file is considered modified also if it has not been read yet --- --- new 23\/2\/2004: the environment ofs has just module names -modifiedFiles :: [(FilePath,ModTime)] -> [FilePath] -> IO [FilePath] -modifiedFiles ofs fs = do - filterM isModified fs - where - isModified file = case lookup (justModName file) ofs of - Just to -> do - t <- getModificationTime file - return $ to < t - _ -> return True - - justModName = - reverse . takeWhile (/='/') . tail . dropWhile (/='.') . reverse - -type ModTime = ClockTime - -laterModTime :: ModTime -> ModTime -> Bool -laterModTime = (>) - -getModTime :: FilePath -> IO (Maybe ModTime) -getModTime f = do - b <- doesFileExist f - if b then (getModificationTime f >>= return . Just) else return Nothing - -getNowTime :: IO ModTime -getNowTime = getClockTime diff --git a/src-3.0/GF/Devel/Compile.hs b/src-3.0/GF/Devel/Compile.hs index 0655913e1..b746812f7 100644 --- a/src-3.0/GF/Devel/Compile.hs +++ b/src-3.0/GF/Devel/Compile.hs @@ -29,7 +29,6 @@ import qualified GF.Source.PrintGF as P import GF.Data.Operations import GF.Devel.UseIO -import GF.Devel.Arch import Control.Monad import System.Directory diff --git a/src-3.0/GF/Devel/GFI.hs b/src-3.0/GF/Devel/GFI.hs index 04c567aa3..f78e576cf 100644 --- a/src-3.0/GF/Devel/GFI.hs +++ b/src-3.0/GF/Devel/GFI.hs @@ -6,10 +6,11 @@ import GF.Command.Commands import GF.GFCC.API import GF.Devel.UseIO -import GF.Devel.Arch -import GF.System.Arch (fetchCommand) +import GF.System.Readline (fetchCommand) import GF.Infra.Option ---- Haskell's option lib +import System.CPUTime + mainGFI :: [String] -> IO () mainGFI xx = do @@ -39,8 +40,9 @@ loop gfenv0 = do loopNewCPU gfenv loopNewCPU gfenv = do - cpu <- prCPU $ cputime gfenv - loop $ gfenv {cputime = cpu} + cpu' <- getCPUTime + putStrLn (show ((cpu' - cputime gfenv) `div` 1000000000) ++ " msec") + loop $ gfenv {cputime = cpu'} importInEnv mgr0 xx = do let (opts,files) = getOptions "-" xx