lvmlib 1.0 → 1.1
raw patch · 3 files changed
+40/−18 lines, 3 filesdep +filepathdep ~base
Dependencies added: filepath
Dependency ranges changed: base
Files
- Lvm/Core/Main.hs +9/−6
- Lvm/Path.hs +27/−8
- lvmlib.cabal +4/−4
Lvm/Core/Main.hs view
@@ -3,7 +3,7 @@ -- is distributed under the terms of the BSD3 License. For more information, -- see the file "LICENSE.txt", which is included in the distribution. ----------------------------------------------------------------------------------- $Id: Main.hs 291 2012-11-08 11:27:33Z heere112 $+-- $Id: Main.hs 300 2014-08-21 10:43:02Z hage0101 $ module Main (main) where @@ -13,6 +13,7 @@ import System.Console.GetOpt import System.Environment import System.Exit+import System.FilePath import Text.PrettyPrint.Leijen import Lvm.Asm.Inline (asmInline) -- optimize Asm (ie. local inlining)@@ -50,7 +51,7 @@ exitFailure versionText :: String-versionText = "version 1.7" -- $Id: Main.hs 291 2012-11-08 11:27:33Z heere112 $"+versionText = "version 1.7" -- $Id: Main.hs 300 2014-08-21 10:43:02Z hage0101 $" header :: String header = @@ -103,11 +104,13 @@ findSrc paths = searchPath paths ".core" compile :: [Flag] -> FilePath -> IO ()-compile flags src = do+compile flags srcraw = do -- searching- message flags $ "Compiling " ++ showFile src- lvmPath <- getLvmPath- let path = "." : lvmPath+ message flags $ "Compiling " ++ showFile srcraw+ let (srcPath, srcFile, srcExt) = splitFilePath srcraw+ let src = joinPath [srcFile, srcExt]+ + let path = [srcPath, "."] source <- findSrc path src verbose $ "Source file: " ++ showFile source
Lvm/Path.hs view
@@ -3,19 +3,36 @@ -- is distributed under the terms of the BSD3 License. For more information, -- see the file "LICENSE.txt", which is included in the distribution. ----------------------------------------------------------------------------------- $Id: Path.hs 291 2012-11-08 11:27:33Z heere112 $+-- $Id: Path.hs 300 2014-08-21 10:43:02Z hage0101 $ module Lvm.Path - ( getLvmPath, searchPath- , searchPathMaybe, splitPath+ ( searchPath, searchPathMaybe, + explodePath, slashify, splitFilePath, getLvmPath ) where import qualified Control.Exception as CE (catch, IOException) import Data.List+import System.FilePath import System.Directory import System.Environment import System.Exit +slash :: Char+slash = pathSeparator++slashify :: String -> String+slashify xs = if last xs == slash then xs else xs ++ [slash]++-- Split file name+-- e.g. /docs/haskell/Hello.hs =>+-- filePath = /docs/haskell baseName = Hello ext = hs+splitFilePath :: String -> (String, String, String)+splitFilePath filePath = + let slashes = [slash]+ (revFileName, revPath) = span (`notElem` slashes) (reverse filePath)+ (baseName, ext) = span (/= '.') (reverse revFileName)+ in (reverse revPath, baseName, dropWhile (== '.') ext)+ ---------------------------------------------------------------- -- file searching ----------------------------------------------------------------@@ -45,28 +62,30 @@ else walk xs } - makeFName dir- | null dir = nameext+ makeFName dir = slashify dir ++ nameext+{- | null dir = nameext | last dir == '/' || last dir == '\\' = dir ++ nameext | otherwise = dir ++ "/" ++ nameext+-} nameext | ext `isSuffixOf` name = name | otherwise = name ++ ext + getLvmPath :: IO [String] getLvmPath = do{ xs <- getEnv "LVMPATH"- ; return (splitPath xs)+ ; return (explodePath xs) } `CE.catch` handler where handler :: CE.IOException -> IO [String] handler _ = return [] -splitPath :: String -> [String]-splitPath = walk [] ""+explodePath :: String -> [String]+explodePath = walk [] "" where walk ps p xs = case xs of
lvmlib.cabal view
@@ -1,5 +1,5 @@ name: lvmlib-version: 1.0+version: 1.1 synopsis: The Lazy Virtual Machine (LVM). homepage: http://www.cs.uu.nl/wiki/bin/view/Helium/WebHome description:@@ -22,7 +22,7 @@ extra-source-files: CREDITS.txt build-type: Simple cabal-version: >= 1.10.1.0-tested-with: GHC == 7.0.2, GHC == 7.0.3, GHC == 7.4.1+tested-with: GHC == 7.0.2, GHC == 7.0.3, GHC == 7.4.1, GHC == 7.6.3 source-repository head type: svn@@ -31,14 +31,14 @@ -------------------------------------------------------------------------------- Executable coreasm- Build-Depends: base >= 3 && < 5, array, containers, directory, parsec, wl-pprint+ Build-Depends: base >= 3 && < 5, array, containers, directory, filepath, parsec, wl-pprint ghc-options: -Wall default-language: Haskell98 hs-source-dirs: . Main-is: Lvm/Core/Main.hs Library- Build-Depends: base >= 3 && < 5, array, containers, directory, parsec, wl-pprint+ Build-Depends: base >= 3 && < 5, array, containers, directory, filepath, parsec, wl-pprint ghc-options: -Wall default-language: Haskell98 hs-source-dirs: .