diff --git a/Main.hs b/Main.hs index 43eca9a..b0897e5 100644 --- a/Main.hs +++ b/Main.hs @@ -15,6 +15,7 @@ import Control.Monad import System.Environment import System.FilePath.Posix import System.IO +import qualified Paths_hs2bf import Util import qualified Front @@ -101,7 +102,8 @@ execCommand (Compile opt from)=partialChain opt from $ where f g=runProcessWithIO (putStr . g) partialChain opt from (c0,c1,g0,g1,s0,s1,b)=do - let (mod,env)=analyzeName from + dir<-liftM takeDirectory $ Paths_hs2bf.getDataFileName "Prelude.hs" + let (mod,env)=analyzeName from dir xs<-Front.collectModules env mod let cr =xs >>= Front.compile cr' =cr >>= Core.simplify @@ -154,8 +156,8 @@ help=unlines $ -analyzeName :: String -> (String,Front.ModuleEnv) -analyzeName n=(takeBaseName n,Front.ModuleEnv [dirPrefix++takeDirectory n,"./test"]) +analyzeName :: String -> FilePath -> (String,Front.ModuleEnv) +analyzeName n lib=(takeBaseName n,Front.ModuleEnv [dirPrefix++takeDirectory n,lib]) where dirPrefix=if isAbsolute n then "" else "./" diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..311d8fb --- /dev/null +++ b/Setup.hs @@ -0,0 +1,3 @@ +import Distribution.Simple +main=defaultMain + diff --git a/gendoc b/gendoc index 658483a..fcefaf6 100755 --- a/gendoc +++ b/gendoc @@ -2,8 +2,15 @@ HsColour -print-css > doc/hscolour.css +# generate file list for i in *.hs + if test $i != Setup.hs + set FLIST $FLIST $i + end +end + +for i in $FLIST HsColour -odoc/$i.html -css -anchor $i end -haddock -h --source-module="%F.html" --source-entity="%F.html#line-%L" -o doc *.hs +haddock -h --source-module="%F.html" --source-entity="%F.html#line-%L" -o doc $FLIST diff --git a/hs2bf.cabal b/hs2bf.cabal new file mode 100644 index 0000000..4dbc694 --- /dev/null +++ b/hs2bf.cabal @@ -0,0 +1,23 @@ +name: hs2bf +cabal-version: >=1.2 +version: 0.5 +author: xanxys +maintainer: xanxys@gmail.com +synopsis: Haskell to Brainfu*k compiler +license: BSD3 +license-File: LICENSE +category: Compiler +description: Haskell to Brainfu*k compiler. +build-type: Simple +data-files: Prelude.hs +data-dir: test +tested-with: GHC==6.10.4 +extra-source-files: + Front.hs Core.hs GMachine.hs SAM.hs SCGR.hs Brainfuck.hs + Util.hs SRuntime.hs +executable hs2bf + main-is: Main.hs + build-depends: + containers>=0.1, base>=4, mtl>=1, array>=0.2, + filepath>=1, directory>=1, haskell-src>=1 +