pugs-compat 0.0.6.20120717.204800 → 0.0.6.20130209.0
raw patch · 3 files changed
+33/−28 lines, 3 filesdep ~regex-pcre-builtin
Dependency ranges changed: regex-pcre-builtin
Files
- LICENSE +7/−17
- pugs-compat.cabal +3/−3
- src/Pugs/Compat/Posix.hs +23/−8
LICENSE view
@@ -1,18 +1,8 @@-Copyright 2008 by Audrey Tang+# CC0 1.0 Universal -Permission is hereby granted, free of charge, to any person obtaining a copy-of this software and associated documentation files (the "Software"), to-deal in the Software without restriction, including without limitation the-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or-sell copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:- -The above copyright notice and this permission notice shall be included in-all copies or substantial portions of the Software.- -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+To the extent possible under law, 唐鳳 has waived all copyright+and related or neighboring rights to pugs-compat.++This work is published from Taiwan.++http://creativecommons.org/publicdomain/zero/1.0
pugs-compat.cabal view
@@ -1,8 +1,8 @@ Name : pugs-compat-Version : 0.0.6.20120717.204800+Version : 0.0.6.20130209.0 Build-type : Simple Category : Pugs-License : BSD3+License : PublicDomain License-file : LICENSE Maintainer : audreyt@audreyt.org Synopsis : Portable Haskell/POSIX layer for Pugs@@ -16,7 +16,7 @@ TypeSynonymInstances, FlexibleInstances, PatternGuards, UndecidableInstances, FlexibleContexts, OverlappingInstances, TypeOperators - Build-depends : base >=4 && < 5, time, directory, process, regex-pcre-builtin, regex-base,+ Build-depends : base >=4 && < 5, time, directory, process, regex-pcre-builtin >= 0.94.4.4.8.31, regex-base, random, network, containers, bytestring, array, mtl >= 2.0.0.0, stm, utf8-string, syb, stringtable-atom >= 0.0.6.1 Exposed-modules : Pugs.Compat
src/Pugs/Compat/Posix.hs view
@@ -131,7 +131,6 @@ import Debug.Trace import qualified System.Environment import System.Directory (getCurrentDirectory, setCurrentDirectory, doesFileExist, doesDirectoryExist)-import IO import System.IO import System.Exit import Foreign.C.String@@ -139,6 +138,7 @@ import Foreign.C.Types import Data.Ratio import Data.Typeable+import System.Posix.Types import System.Posix.Internals import Foreign.C.Error @@ -166,7 +166,7 @@ setEnv k v _ = withCWString k $ withCWString v . win32SetEnv getEnv :: String -> IO (Maybe String)-getEnv k = (fmap Just (System.Environment.getEnv k)) `Control.Exception.catch` (const $ return Nothing)+getEnv k = (fmap Just (System.Environment.getEnv k)) `Control.Exception.catch` (\(e :: Control.Exception.SomeException) -> return Nothing) unsetEnv :: String -> IO () unsetEnv k = withCWString k $ \ key -> withCWString "" $ \ v -> do@@ -194,17 +194,24 @@ setFileMode :: FilePath -> FileMode -> IO () setFileMode _ _ = warnWith "chmod" +{- newtype DirStream = DirStream (Ptr CDir) deriving (Typeable)+-} +type DirStream = ()+ openDirStream :: FilePath -> IO DirStream-openDirStream name =- withCString name $ \s -> do- dirp <- c_opendir s- return (DirStream dirp)+openDirStream name = warnWith "opendir"+-- withCString name $ \s -> do+-- dirp <- c_opendir s+-- return (DirStream dirp) readDirStream :: DirStream -> IO FilePath-readDirStream (DirStream dirp) =+readDirStream _ = undefined++{-+readDirStream dirp = alloca $ \ptr_dEnt -> loop ptr_dEnt where loop ptr_dEnt = do@@ -235,6 +242,14 @@ c_closedir dirp return () +-}++rewindDirStream :: DirStream -> IO ()+rewindDirStream _ = undefined++closeDirStream :: DirStream -> IO ()+closeDirStream _ = undefined+ -- Win32 specific type FILETIME = CULLong -- we'll keep the accuracy as long as possible@@ -272,7 +287,7 @@ -- This is Win32 specific, dunno about other non POSIX platforms statFileSize :: FilePath -> IO Integer-statFileSize n = bracket (openFile n ReadMode) hClose hFileSize+statFileSize n = Control.Exception.bracket (openFile n ReadMode) hClose hFileSize -- statFileSize _ = failWith "-s" -- Again, Win32 specific magic, as stolen from GHC