Some docs. Update .cabal file and Makefile.
authorIlya V. Portnov <i.portnov@compassplus.ru>
Tue, 4 Oct 2011 06:10:25 +0000 (12:10 +0600)
committerIlya V. Portnov <i.portnov@compassplus.ru>
Tue, 4 Oct 2011 06:10:25 +0000 (12:10 +0600)
Java/ClassPath.hs
Makefile
TestGen.hs
hs-java.cabal

index 944cc36f812d8beefb0cf48da31ec417b54931c7..2dbff6749a2064c0944ee19529e660120a0dddf2 100644 (file)
@@ -24,9 +24,11 @@ glob dir patterns = do
   (matches, _) <- globDir (map compile patterns) dir
   return $ concat matches
 
+-- | Append one file to ClassPath forest
 appendPath :: FilePath -> [Tree CPEntry] -> [Tree CPEntry]
 appendPath path forest = merge $ forest ++ (mapF NotLoaded $ buildTree [path])
 
+-- | Add one directory to current ClassPath
 addDirectory :: FilePath -> ClassPath ()
 addDirectory dir = do
   files <- liftIO $ glob dir ["*.class"]
@@ -34,12 +36,15 @@ addDirectory dir = do
   let cp' = foldr appendPath cp files
   St.put cp'
 
+-- | Run ClassPath monad
 runClassPath :: ClassPath a -> IO a
 runClassPath m = St.evalStateT m []
 
+-- | Run ClassPath monad and return resulting ClassPath
 execClassPath :: ClassPath () -> IO [Tree CPEntry]
 execClassPath m = St.execStateT m []
 
+-- | Load one class in current ClassPath
 loadClass :: String -> ClassPath ()
 loadClass path = do
     cp <- St.get
@@ -65,6 +70,7 @@ loadClass path = do
       | otherwise = return t
     load ps (File _) = fail $ "Found file when expecting directory! " ++ show ps
 
+-- | Get one ClassPath entry
 getEntry :: [Tree CPEntry] -> String -> IO (Maybe CPEntry)
 getEntry cp path = get cp (split "/" path)
   where
index a2aa34c4b40f0b0d058b3717e6ada48cb4496334..e6ccba8eba3546ece75678fc114771c1d3eb9b45 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
 GHC=ghc --make -fwarn-unused-imports
 
-all: dump-class rebuild-class TestGen
+all: Hello.class dump-class rebuild-class TestGen
+
+Hello.class: Hello.java
+       javac $<
 
 dump-class: dump-class.hs */*.hs
        $(GHC) $<
index c8cd0ef3c91578696e3db0355efc384f76225343..f21912c58e863481124923c72bbb70eddac2dea5 100644 (file)
@@ -45,6 +45,7 @@ test = do
       invokeStatic Java.Lang.integer Java.Lang.valueOfInteger
       aastore
       invokeVirtual Java.IO.printStream Java.IO.printf
+      -- Call Hello.hello()
       invokeStatic "Hello" helloJava
       pop
       i0 RETURN
index 43a8d09dbe3cda98af50be90840c6119389e15a1..50b5f5723b4cad166520ca3004a1b229370b5d28 100644 (file)
@@ -28,11 +28,16 @@ library
                    JVM.Exceptions
                    Java.Lang
                    Java.IO
+                   Java.ClassPath
+                   Java.ClassPath.Types
+                   Java.ClassPath.Common
+                   Java.JAR.Archive
 
   Build-Depends:  base >= 3 && <= 5, containers, binary,
                   mtl, directory, filepath, utf8-string, array,
                   bytestring, data-binary-ieee754, binary-state,
-                  control-monad-exception, data-default
+                  control-monad-exception, data-default, MissingH,
+                  LibZip, Glob
 
   ghc-options: -fwarn-unused-imports