[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:44:58 UTC 2010


The following commit has been merged in the master branch:
commit 811cfb455e38a6956d4766d77b257cc6cacfdc40
Author: John Goerzen <jgoerzen at complete.org>
Date:   Thu Oct 21 03:22:52 2004 +0100

    Added mime types parsing
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--1.0--patch-86)

diff --git a/ChangeLog b/ChangeLog
index 620446f..cacf50e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
 #
 
+2004-10-20 21:22:52 GMT	John Goerzen <jgoerzen at complete.org>	patch-86
+
+    Summary:
+      Added mime types parsing
+    Revision:
+      missingh--head--1.0--patch-86
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/MIMETypes.hs
+
+
 2004-10-20 21:09:14 GMT	John Goerzen <jgoerzen at complete.org>	patch-85
 
     Summary:
diff --git a/libsrc/MissingH/MIMETypes.hs b/libsrc/MissingH/MIMETypes.hs
index b9e18b5..7335bdd 100644
--- a/libsrc/MissingH/MIMETypes.hs
+++ b/libsrc/MissingH/MIMETypes.hs
@@ -47,6 +47,7 @@ import Data.FiniteMap
 import qualified System.Directory
 import System.IO
 import System.IO.Error
+import MissingH.IO
 
 ----------------------------------------------------------------------
 -- Basic type decl
@@ -126,8 +127,25 @@ newMIMETypes = makeMIMETypes defaultMIMETypeData
 'MIMETypeData' object. -}
 makeMIMETypes :: MIMETypeData -> MIMETypeFunctions
 makeMIMETypes mtd = 
+    let self = makeMIMETypes mtd in
     -- FIXME
-    let hrmt strict h =  return (makeMIMETypes mtd)
+    let hrmt strict h = 
+            let parseline :: MIMETypeFunctions -> String -> MIMETypeFunctions
+                parseline obj line =
+                    let l1 = words line 
+                        procwords [] = []
+                        procwords (('#':_) :_) = []
+                        procwords (x:xs) = x : procwords xs
+                        l2 = procwords l1
+                        thetype = head l2
+                        suffixlist = tail l2
+                        in
+                        foldl (\o suff -> (addType o) strict thetype suff) obj suffixlist
+                in
+                do
+                lines <- hGetLines h
+                return (foldl parseline self lines)
+
         in
         MIMETypeFunctions 
         {

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list