initial import of haddock-0.4, from Don Stewart <dons at cse.unsw.edu.au>

--

Haddock is a tool for automatically generating documentation from
annotated Haskell source code. It is primary intended for documenting
libraries, but it should be useful for any kind of Haskell code.

Like other systems, Haddock lets you write documentation annotations
next to the definitions of functions and types in the source code, in
a syntax that is easy on the eye when writing the source code (no
heavyweight mark-up). The documentation generated by Haddock is fully
hyperlinked.
This commit is contained in:
avsm 2003-07-25 00:26:13 +00:00
parent f3119f35a6
commit 209c2a1a59
5 changed files with 299 additions and 0 deletions

45
devel/haddock/Makefile Normal file
View File

@ -0,0 +1,45 @@
# $OpenBSD: Makefile,v 1.1.1.1 2003/07/25 00:26:13 avsm Exp $
COMMENT= "documentation tool for Haskell"
V= 0.4
DISTNAME= haddock-${V}
CATEGORIES= devel
HOMEPAGE= http://www.haskell.org/haddock/
MAINTAINER= Don Stewart <dons@cse.unsw.edu.au>
MODULES= gettext iconv ghc
MASTER_SITES= http://www.haskell.org/haddock/
DISTFILES= ${DISTNAME}-src.tar.gz
BUILD_DEPENDS+= ::textproc/docbook ::textproc/docbook-dsssl \
::textproc/sgmlformat ::textproc/openjade \
::textproc/iso8879 ::textproc/linuxdoc \
::textproc/html ::print/jadetex \
::textproc/expat
NO_REGRESS= Yes
USE_GMAKE= Yes
CONFIGURE_STYLE=gnu dest
CONFIGURE_ENV= SGML_CATALOG_FILES=${LOCALBASE}/share/sgml/catalog
MAKE_ENV= SGML_CATALOG_FILES=${LOCALBASE}/share/sgml/catalog
DOC_DIR= ${PREFIX}/share/doc/haddock
post-build:
@(cd ${WRKSRC}/haddock/doc ; ${MAKE_ENV} ${GMAKE} html)
post-install:
${INSTALL_DATA_DIR} ${DOC_DIR}
@(cp -R ${WRKSRC}/haddock/doc/haddock/* ${DOC_DIR})
# BSD style w/o advertising clause
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
.include <bsd.port.mk>

3
devel/haddock/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (haddock-0.4-src.tar.gz) = 919e38378b91a223cb1e48178f1a85bd
RMD160 (haddock-0.4-src.tar.gz) = 0fe6a06bb8434c7af93845cbc55461265acd8e14
SHA1 (haddock-0.4-src.tar.gz) = 78a1cb2a52985363a1b9e98253eb4506f5201cb0

View File

@ -0,0 +1,205 @@
Upstream patch to Binary library to make it compile with GHC > 5.03
--- haddock/src/Binary.hs.orig Mon Jun 24 00:54:00 2002
+++ haddock/src/Binary.hs Thu Jul 24 14:13:01 2003
@@ -64,7 +64,6 @@
import Monad
import Exception
import GlaExts hiding (ByteArray, newByteArray, freezeByteArray)
-import Array
import IO
#if __GLASGOW_HASKELL__ < 503
import PrelIOBase -- ( IOError(..), IOErrorType(..) )
@@ -77,11 +76,19 @@
#endif
type BinArray = MutableByteArray RealWorld Int
+newArray_ :: Ix ix => (ix, ix) -> IO (MutableByteArray RealWorld ix)
newArray_ bounds = stToIO (newCharArray bounds)
+
+unsafeWrite :: Ix ix => MutableByteArray RealWorld ix -> ix -> Word8 -> IO ()
unsafeWrite arr ix e = stToIO (writeWord8Array arr ix e)
+
+unsafeRead :: Ix ix => MutableByteArray RealWorld ix -> ix -> IO Word8
unsafeRead arr ix = stToIO (readWord8Array arr ix)
+hPutArray :: Handle -> MutableByteArray RealWorld a -> Int -> IO ()
hPutArray h arr sz = hPutBufBA h arr sz
+
+hGetArray :: Handle -> MutableByteArray RealWorld a -> Int -> IO Int
hGetArray h sz = hGetBufBA h sz
#if __GLASGOW_HASKELL__ < 503
@@ -160,14 +167,15 @@
| size <= 0 = error "Data.Binary.openBinMem: size must be >= 0"
| otherwise = do
arr <- newArray_ (0,size-1)
- arr_r <- newIORef arr
+ arr_r0 <- newIORef arr
ix_r <- newFastMutInt
writeFastMutInt ix_r 0
- sz_r <- newFastMutInt
- writeFastMutInt sz_r size
- return (BinMem undefined ix_r sz_r arr_r)
+ sz_r0 <- newFastMutInt
+ writeFastMutInt sz_r0 size
+ return (BinMem undefined ix_r sz_r0 arr_r0)
-noBinHandleUserData = error "Binary.BinHandle: no user data"
+--noBinHandleUserData :: a
+--noBinHandleUserData = error "Binary.BinHandle: no user data"
--getUserData :: BinHandle -> BinHandleState
--getUserData bh = state bh
@@ -180,24 +188,24 @@
seekBin (BinIO _ ix_r h) (BinPtr p) = do
writeFastMutInt ix_r p
hSeek h AbsoluteSeek (fromIntegral p)
-seekBin h@(BinMem _ ix_r sz_r a) (BinPtr p) = do
- sz <- readFastMutInt sz_r
+seekBin h@(BinMem _ ix_r sz_r0 _) (BinPtr p) = do
+ sz <- readFastMutInt sz_r0
if (p >= sz)
then do expandBin h p; writeFastMutInt ix_r p
else writeFastMutInt ix_r p
isEOFBin :: BinHandle -> IO Bool
-isEOFBin (BinMem _ ix_r sz_r a) = do
+isEOFBin (BinMem _ ix_r sz_r0 _) = do
ix <- readFastMutInt ix_r
- sz <- readFastMutInt sz_r
+ sz <- readFastMutInt sz_r0
return (ix >= sz)
-isEOFBin (BinIO _ ix_r h) = hIsEOF h
+isEOFBin (BinIO _ _ h) = hIsEOF h
writeBinMem :: BinHandle -> FilePath -> IO ()
writeBinMem (BinIO _ _ _) _ = error "Data.Binary.writeBinMem: not a memory handle"
-writeBinMem (BinMem _ ix_r sz_r arr_r) fn = do
+writeBinMem (BinMem _ ix_r _ arr_r0) fn = do
h <- openFileEx fn (BinaryMode WriteMode)
- arr <- readIORef arr_r
+ arr <- readIORef arr_r0
ix <- readFastMutInt ix_r
hPutArray h arr ix
hClose h
@@ -212,24 +220,24 @@
when (count /= filesize)
(error ("Binary.readBinMem: only read " ++ show count ++ " bytes"))
hClose h
- arr_r <- newIORef arr
+ arr_r0 <- newIORef arr
ix_r <- newFastMutInt
writeFastMutInt ix_r 0
- sz_r <- newFastMutInt
- writeFastMutInt sz_r filesize
- return (BinMem undefined {-initReadState-} ix_r sz_r arr_r)
+ sz_r0 <- newFastMutInt
+ writeFastMutInt sz_r0 filesize
+ return (BinMem undefined {-initReadState-} ix_r sz_r0 arr_r0)
-- expand the size of the array to include a specified offset
expandBin :: BinHandle -> Int -> IO ()
-expandBin (BinMem _ ix_r sz_r arr_r) off = do
- sz <- readFastMutInt sz_r
+expandBin (BinMem _ _ sz_r0 arr_r0) off = do
+ sz <- readFastMutInt sz_r0
let sz' = head (dropWhile (<= off) (iterate (* 2) sz))
- arr <- readIORef arr_r
+ arr <- readIORef arr_r0
arr' <- newArray_ (0,sz'-1)
sequence_ [ unsafeRead arr i >>= unsafeWrite arr' i
| i <- [ 0 .. sz-1 ] ]
- writeFastMutInt sz_r sz'
- writeIORef arr_r arr'
+ writeFastMutInt sz_r0 sz'
+ writeIORef arr_r0 arr'
hPutStrLn stderr ("expanding to size: " ++ show sz')
return ()
expandBin (BinIO _ _ _) _ = return ()
@@ -239,14 +247,14 @@
-- Low-level reading/writing of bytes
putWord8 :: BinHandle -> Word8 -> IO ()
-putWord8 h@(BinMem _ ix_r sz_r arr_r) w = do
+putWord8 h@(BinMem _ ix_r sz_r0 arr_r0) w = do
ix <- readFastMutInt ix_r
- sz <- readFastMutInt sz_r
+ sz <- readFastMutInt sz_r0
-- double the size of the array if it overflows
if (ix >= sz)
then do expandBin h ix
putWord8 h w
- else do arr <- readIORef arr_r
+ else do arr <- readIORef arr_r0
unsafeWrite arr ix w
writeFastMutInt ix_r (ix+1)
return ()
@@ -257,12 +265,12 @@
return ()
getWord8 :: BinHandle -> IO Word8
-getWord8 (BinMem _ ix_r sz_r arr_r) = do
+getWord8 (BinMem _ ix_r sz_r0 arr_r0) = do
ix <- readFastMutInt ix_r
- sz <- readFastMutInt sz_r
+ sz <- readFastMutInt sz_r0
when (ix >= sz) $
- throw (mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
- arr <- readIORef arr_r
+ ioError (mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
+ arr <- readIORef arr_r0
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
return w
@@ -363,8 +371,8 @@
-- Instances for standard types
instance Binary () where
- put_ bh () = return ()
- get _ = return ()
+ put_ _ () = return ()
+ get _ = return ()
-- getF bh p = case getBitsF bh 0 p of (_,b) -> ((),b)
instance Binary Bool where
@@ -494,22 +502,23 @@
data MBA = MBA (MutableByteArray# RealWorld)
newByteArray :: Int# -> IO MBA
-newByteArray sz = IO $ \s ->
- case newByteArray# sz s of { (# s, arr #) ->
+newByteArray sz = IO $ \s0 ->
+ case newByteArray# sz s0 of { (# s, arr #) ->
(# s, MBA arr #) }
freezeByteArray :: MutableByteArray# RealWorld -> IO ByteArray
-freezeByteArray arr = IO $ \s ->
- case unsafeFreezeByteArray# arr s of { (# s, arr #) ->
+freezeByteArray arr0 = IO $ \s0 ->
+ case unsafeFreezeByteArray# arr0 s0 of { (# s, arr #) ->
(# s, BA arr #) }
writeByteArray :: MutableByteArray# RealWorld -> Int# -> Word8 -> IO ()
-writeByteArray arr i w8 = IO $ \s ->
- case word8ToWord w8 of { W# w# ->
- case writeCharArray# arr i (chr# (word2Int# w#)) s of { s ->
+writeByteArray arr i w8 = IO $ \s0 ->
+ case fromIntegral w8 of { W# w# ->
+ case writeCharArray# arr i (chr# (word2Int# w#)) s0 of { s ->
(# s , () #) }}
+indexByteArray :: ByteArray# -> Int# -> Word8
indexByteArray a# n# = fromIntegral (I# (ord# (indexCharArray# a# n#)))
instance (Integral a, Binary a) => Binary (Ratio a) where
@@ -530,6 +539,7 @@
word8s :: [Word8]
word8s = map (fromIntegral.ord) str
+getString :: BinHandle -> IO String
getString bh = do
word8s <- get bh
return (map (chr.fromIntegral) (word8s :: [Word8]))

11
devel/haddock/pkg/DESCR Normal file
View File

@ -0,0 +1,11 @@
Haddock is a tool for automatically generating documentation from
annotated Haskell source code. It is primary intended for documenting
libraries, but it should be useful for any kind of Haskell code.
Like other systems, Haddock lets you write documentation annotations
next to the definitions of functions and types in the source code, in
a syntax that is easy on the eye when writing the source code (no
heavyweight mark-up). The documentation generated by Haddock is fully
hyperlinked.
WWW: ${HOMEPAGE}

35
devel/haddock/pkg/PLIST Normal file
View File

@ -0,0 +1,35 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2003/07/25 00:26:13 avsm Exp $
bin/haddock
bin/haddock-0.4
lib/haddock-0.4/haddock.bin
lib/haddock-0.4/haddock.css
lib/haddock-0.4/haskell_icon.gif
share/doc/haddock/docbook.css
share/doc/haddock/haddock.html
share/doc/haddock/introduction.html
share/doc/haddock/invoking.html
share/doc/haddock/license.html
share/doc/haddock/markup.html
share/doc/haddock/module-attributes.html
share/doc/haddock/stylesheet-images/caution.gif
share/doc/haddock/stylesheet-images/home.gif
share/doc/haddock/stylesheet-images/important.gif
share/doc/haddock/stylesheet-images/next.gif
share/doc/haddock/stylesheet-images/note.gif
share/doc/haddock/stylesheet-images/prev.gif
share/doc/haddock/stylesheet-images/tip.gif
share/doc/haddock/stylesheet-images/toc-blank.gif
share/doc/haddock/stylesheet-images/toc-minus.gif
share/doc/haddock/stylesheet-images/toc-plus.gif
share/doc/haddock/stylesheet-images/up.gif
share/doc/haddock/stylesheet-images/warning.gif
share/doc/haddock/x331.html
share/doc/haddock/x355.html
share/doc/haddock/x360.html
share/doc/haddock/x403.html
share/doc/haddock/x418.html
share/doc/haddock/x486.html
share/doc/haddock/x57.html
@dirrm share/doc/haddock/stylesheet-images
@dirrm share/doc/haddock
@dirrm lib/haddock-0.4