X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=Foreign%2FC%2FString.hs;h=6f465e5111bb3e967f0312a42f9c5f4163a349a8;hb=9fa9bc17072a58c0bae2cce4764d38677e96ac29;hp=000bd2f41e5d7ab77ea2322b3a3fe14f93645c3d;hpb=5545727d5a6a1fc6d5d00f32a92a8fdf0fb7ca77;p=ghc-base.git diff --git a/Foreign/C/String.hs b/Foreign/C/String.hs index 000bd2f..6f465e5 100644 --- a/Foreign/C/String.hs +++ b/Foreign/C/String.hs @@ -1,6 +1,6 @@ {-# OPTIONS -fno-implicit-prelude #-} ----------------------------------------------------------------------------- --- +-- | -- Module : Foreign.C.String -- Copyright : (c) The FFI task force 2001 -- License : BSD-style (see the file libraries/core/LICENSE) @@ -9,7 +9,7 @@ -- Stability : provisional -- Portability : portable -- --- $Id: String.hs,v 1.2 2001/07/03 11:37:50 simonmar Exp $ +-- $Id: String.hs,v 1.5 2002/04/24 16:31:44 simonmar Exp $ -- -- Utilities for primitive marshaling -- @@ -40,14 +40,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 +49,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 +154,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