[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:54:42 UTC 2010


The following commit has been merged in the master branch:
commit 1e102a8cbf15bb03480c85f04100a63a07d01273
Author: John Goerzen <jgoerzen at complete.org>
Date:   Wed Feb 2 11:03:46 2005 +0100

    checkpointing
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-187)

diff --git a/ChangeLog b/ChangeLog
index 2ebcd77..d196d34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2005-02-02 04:03:46 GMT	John Goerzen <jgoerzen at complete.org>	patch-187
+
+    Summary:
+      checkpointing
+    Revision:
+      missingh--head--0.7--patch-187
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/AnyDBM/StringDBM.hs
+
+
 2005-02-01 23:00:11 GMT	John Goerzen <jgoerzen at complete.org>	patch-186
 
     Summary:
diff --git a/libsrc/MissingH/AnyDBM/StringDBM.hs b/libsrc/MissingH/AnyDBM/StringDBM.hs
index 8685377..4ccef9d 100644
--- a/libsrc/MissingH/AnyDBM/StringDBM.hs
+++ b/libsrc/MissingH/AnyDBM/StringDBM.hs
@@ -35,7 +35,8 @@ The data is written out during a call to 'flush' or 'close'.
 -}
 
 module MissingH.AnyDBM.StringDBM (StringDBM,
-                                  openStringDBM
+                                  openStringDBM,
+                                  SystemFS(..)
                                  )
 where
 import MissingH.AnyDBM
@@ -45,34 +46,44 @@ import MissingH.IO.HVIO
 import Data.HashTable
 
 {- | The type of the StringDBM instances. -}
-data StringDBM = StringDBM (HashTable String String) IOMode FilePath
+data StringDBM = forall a. HVFSOpenable a => StringDBM (HashTable String String) IOMode a FilePath
 
+{-
 {- | Opens a 'StringDBM' file.  Please note: only ReadMode, WriteMode,
 and ReadWriteMode are supported for the IOMode.  AppendMode is not supported. 
 -}
 openStringDBM :: FilePath -> IOMode -> IO StringDBM
-openStringDBM _ AppendMode = fail "openStringDBM: AppendMode is not supported"
-openStringDBM fp ReadMode =
+openStringDBM = openStringHVDBM SystemFS
+-}
+{- | Opens a 'StringDBM' file.  Please note: only ReadMode, WriteMode,
+and ReadWriteMode are supported for the IOMode.  AppendMode is not supported.
+
+To work on your system's normal (real) filesystem, just specify
+'SystemFS' for the first argument.
+-}
+openStringDBM :: HVFSOpenable a => a -> FilePath -> IOMode -> IO StringDBM
+openStringDBM _ _ AppendMode = fail "openStringDBM: AppendMode is not supported"
+openStringDBM h fp ReadMode =
     do ht <- new (==) hashString
-       readFile fp >>= strToA ht
-       return $ StringDBM ht ReadMode fp
-openStringDBM fp WriteMode =
+       vReadFile h fp >>= strToA ht
+       return $ StringDBM ht ReadMode h fp
+openStringDBM h fp WriteMode =
     do ht <- new (==) hashString
-       return $ StringDBM ht WriteMode fp
-openStringDBM fp ReadWriteMode =
+       return $ StringDBM ht WriteMode h fp
+openStringDBM h fp ReadWriteMode =
     -- Nothing different to start with.  Later, we emulate WriteMode.
     -- Nothing is ever read after the object is created.
-    do o <- openStringDBM fp ReadMode
+    do o <- openStringDBM h fp ReadMode
        case o of
-              StringDBM x _ y -> return $ StringDBM x WriteMode y
+              StringDBM x _ y z -> return $ StringDBM x WriteMode y z
 
 g :: StringDBM -> HashTable String String
-g (StringDBM ht _ _) = ht
+g (StringDBM ht _ _ _) = ht
 
 instance AnyDBM StringDBM where
-    flushA (StringDBM ht WriteMode fp) = 
+    flushA (StringDBM ht WriteMode h fp) = 
         do s <- strFromA ht
-           writeFile fp s
+           vWriteFile h fp s
     flushA _ = return ()
 
     insertA = insertA . g

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list