diff options
Diffstat (limited to 'libraries/base/Foreign/Ptr.hs')
-rw-r--r-- | libraries/base/Foreign/Ptr.hs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/libraries/base/Foreign/Ptr.hs b/libraries/base/Foreign/Ptr.hs index 9c8267ed2b..808fff636a 100644 --- a/libraries/base/Foreign/Ptr.hs +++ b/libraries/base/Foreign/Ptr.hs @@ -5,9 +5,7 @@ , MagicHash , GeneralizedNewtypeDeriving #-} -#ifdef __GLASGOW_HASKELL__ {-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} -#endif ----------------------------------------------------------------------------- -- | @@ -56,7 +54,6 @@ module Foreign.Ptr ( wordPtrToPtr ) where -#ifdef __GLASGOW_HASKELL__ import GHC.Ptr import GHC.Base import GHC.Num @@ -64,28 +61,21 @@ import GHC.Read import GHC.Real import GHC.Show import GHC.Enum -#else -import Control.Monad ( liftM ) -import Foreign.C.Types -#endif import Data.Bits import Data.Typeable import Foreign.Storable ( Storable(..) ) -#ifdef __GLASGOW_HASKELL__ -- | Release the storage associated with the given 'FunPtr', which -- must have been obtained from a wrapper stub. This should be called -- whenever the return value from a foreign import wrapper function is -- no longer required; otherwise, the storage it uses will leak. foreign import ccall unsafe "freeHaskellFunctionPtr" freeHaskellFunPtr :: FunPtr a -> IO () -#endif #include "HsBaseConfig.h" #include "CTypes.h" -#ifdef __GLASGOW_HASKELL__ -- | An unsigned integral type that can be losslessly converted to and from -- @Ptr@. This type is also compatible with the C99 type @uintptr_t@, and -- can be marshalled to and from that type safely. @@ -113,25 +103,3 @@ ptrToIntPtr (Ptr a#) = IntPtr (I# (addr2Int# a#)) -- | casts an @IntPtr@ to a @Ptr@ intPtrToPtr :: IntPtr -> Ptr a intPtrToPtr (IntPtr (I# i#)) = Ptr (int2Addr# i#) - -#else /* !__GLASGOW_HASKELL__ */ - -INTEGRAL_TYPE(WordPtr,tyConWordPtr,"WordPtr",CUIntPtr) -INTEGRAL_TYPE(IntPtr,tyConIntPtr,"IntPtr",CIntPtr) - -{-# CFILES cbits/PrelIOUtils.c #-} - -foreign import ccall unsafe "__hscore_to_uintptr" - ptrToWordPtr :: Ptr a -> WordPtr - -foreign import ccall unsafe "__hscore_from_uintptr" - wordPtrToPtr :: WordPtr -> Ptr a - -foreign import ccall unsafe "__hscore_to_intptr" - ptrToIntPtr :: Ptr a -> IntPtr - -foreign import ccall unsafe "__hscore_from_intptr" - intPtrToPtr :: IntPtr -> Ptr a - -#endif /* !__GLASGOW_HASKELL__ */ - |