Javasf (empty) → 0.0.1
raw patch · 5 files changed
+120/−0 lines, 5 filesdep +basedep +binarydep +bytestringsetup-changed
Dependencies added: base, binary, bytestring, language-java-classfile
Files
- Javasf.cabal +45/−0
- LICENSE +27/−0
- Language/Java/Javasf.hs +25/−0
- Main.hs +20/−0
- Setup.hs +3/−0
+ Javasf.cabal view
@@ -0,0 +1,45 @@+Name: Javasf+Version: 0.0.1+Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>+Maintainer: Tony Morris+Copyright: Tony Morris+License: BSD3+License-File: LICENSE+Synopsis: A utility to print the SourceFile attribute of one or more Java class files.+Category: Language+Description:+ Installs a javasf executable to print the @SourceFile@ attribute of one or more Java class files.+ .+ For example:+ .+ @+ \> javasf ThisClass.class ThatClass.class++ ThisClass.java++ ThatClass.java+ @+ .+ Java VM Specification 4.7.7 The @SourceFile@ Attribute+ .+ <http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#79868>+Cabal-version: >= 1.2+Build-Type: Simple++Flag small_base+ Description: Choose the new, split-up base package.++Executable javasf+ Main-Is:+ Main.hs+ Build-Depends:+ base < 5 && >= 3+ , language-java-classfile+ , binary+ , bytestring++ GHC-Options:+ -Wall++ Other-Modules:+ Language.Java.Javasf
+ LICENSE view
@@ -0,0 +1,27 @@+Copyright 2009 Tony Morris++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.
+ Language/Java/Javasf.hs view
@@ -0,0 +1,25 @@+module Language.Java.Javasf where++import qualified Data.ByteString.Lazy as B+import Data.Binary.Get+import Language.Java.ClassFile+import Data.Maybe++sourceFile ::+ B.ByteString+ -> Maybe String+sourceFile =+ sourcePath . snd . runGet getClass++showSourceFile ::+ B.ByteString+ -> String+showSourceFile x =+ "?Unknown?" `fromMaybe` sourceFile x++javasf ::+ [FilePath]+ -> IO ()+javasf =+ mapM_ (\file -> putStrLn . showSourceFile =<< B.readFile file)+
+ Main.hs view
@@ -0,0 +1,20 @@+module Main where++import Language.Java.Javasf+import System.Environment++main ::+ IO ()+main =+ do a <- getArgs+ if null a+ then mapM_ putStrLn+ [+ "<javasf> Copyright 2010 Tony Morris"+ , "This software is made available under a BSD3 open source license"+ , []+ , "Prints the SourceFile attribute of one or more Java class files."+ , []+ , "javasf FILE1 [FILE2...]"+ ]+ else javasf a
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple+main = defaultMain+