[project @ 2002-04-26 13:34:05 by simonmar]
[haskell-directory.git] / Foreign / C / String.hs
index eddf5ab..d5463a0 100644 (file)
@@ -1,15 +1,13 @@
 {-# OPTIONS -fno-implicit-prelude #-}
 -----------------------------------------------------------------------------
--- 
+-- |
 -- Module      :  Foreign.C.String
 -- Copyright   :  (c) The FFI task force 2001
 -- License     :  BSD-style (see the file libraries/core/LICENSE)
 -- 
 -- Maintainer  :  ffi@haskell.org
--- Stability   :  experimental
--- Portability :  non-portable
---
--- $Id: String.hs,v 1.1 2001/06/28 14:15:03 simonmar Exp $
+-- Stability   :  provisional
+-- Portability :  portable
 --
 -- Utilities for primitive marshaling
 --
@@ -40,14 +38,6 @@ module Foreign.C.String (   -- representation of strings in C
   castCharToCChar,   -- :: Char -> CChar
   castCCharToChar,   -- :: CChar -> Char
 
-  -- UnsafeCString: these might be more efficient than CStrings when
-  -- passing the string to an "unsafe" foreign import.  NOTE: this
-  -- feature might be removed in favour of a more general approach in
-  -- the future.
-  --
-  UnsafeCString,     -- abstract
-  withUnsafeCString, -- :: String -> (UnsafeCString -> IO a) -> IO a
-
   ) where
 
 import Foreign.Marshal.Array
@@ -57,8 +47,6 @@ import Foreign.Ptr
 import Data.Word
 
 #ifdef __GLASGOW_HASKELL__
-import GHC.ByteArr
-import GHC.Pack
 import GHC.List
 import GHC.Real
 import GHC.Num
@@ -164,16 +152,3 @@ castCCharToChar ch = unsafeChr (fromIntegral (fromIntegral ch :: Word8))
 
 castCharToCChar :: Char -> CChar
 castCharToCChar ch = fromIntegral (ord ch)
-
-
--- unsafe CStrings
--- ---------------
-
-withUnsafeCString :: String -> (UnsafeCString -> IO a) -> IO a
-#if __GLASGOW_HASKELL__
-newtype UnsafeCString = UnsafeCString (ByteArray Int)
-withUnsafeCString s f = f (UnsafeCString (packString s))
-#else
-newtype UnsafeCString = UnsafeCString (Ptr CChar)
-withUnsafeCString s f = withCString s (\p -> f (UnsafeCString p))
-#endif