From a06351b6250dd456299565f13eba6ed02dd2a07b Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 13 Aug 2014 16:46:11 +0000 Subject: Refactoring in GF.Compile and GF.ReadFiles with an eye to parallel compilation In particular, the function compileOne has been moved to the new module GF.CompileOne and its type has been changed from compileOne :: ... -> CompileEnv -> FilePath -> IOE CompileEnv to compileOne :: ... -> SourceGrammar -> FilePath -> IOE OneCompiledModule making it more suitable for use in a parallel compiler. --- src/compiler/GF/Infra/UseIO.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/compiler/GF/Infra/UseIO.hs') diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs index aa0c7d7ff..17894c682 100644 --- a/src/compiler/GF/Infra/UseIO.hs +++ b/src/compiler/GF/Infra/UseIO.hs @@ -105,9 +105,26 @@ getSubdirs dir = do then return (fpath:fs) else return fs ) [] fs +-------------------------------------------------------------------------------- justModuleName :: FilePath -> String justModuleName = dropExtension . takeFileName +isGFO :: FilePath -> Bool +isGFO = (== ".gfo") . takeExtensions + +gfoFile :: FilePath -> FilePath +gfoFile f = addExtension f "gfo" + +gfFile :: FilePath -> FilePath +gfFile f = addExtension f "gf" + +gf2gfo :: Options -> FilePath -> FilePath +gf2gfo = gf2gfo' . flag optGFODir + +gf2gfo' gfoDir file = maybe (gfoFile (dropExtension file)) + (\dir -> dir gfoFile (takeBaseName file)) + gfoDir +-------------------------------------------------------------------------------- splitInModuleSearchPath :: String -> [FilePath] splitInModuleSearchPath s = case break isPathSep s of (f,_:cs) -> f : splitInModuleSearchPath cs -- cgit v1.2.3