X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FStorable.hs;h=78e2d4f020e645bcf2ac9c1ba78d95ec561fa058;hb=674a63cc5d56510d79ca46dce381af01f64cb2b9;hp=43fae6840628e2e3dc59caba2a3f37f3c87fb09a;hpb=efc37fdab381c901c4957e3c94119b3e10385513;p=ghc-base.git diff --git a/Foreign/Storable.hs b/Foreign/Storable.hs index 43fae68..78e2d4f 100644 --- a/Foreign/Storable.hs +++ b/Foreign/Storable.hs @@ -29,6 +29,11 @@ module Foreign.Storable ) where +#ifdef __NHC__ +import NHC.FFI (Storable(..),Ptr,FunPtr,StablePtr + ,Int8,Int16,Int32,Int64,Word8,Word16,Word32,Word64) +#else + import Control.Monad ( liftM ) #include "MachDeps.h" @@ -47,10 +52,14 @@ import GHC.Err import GHC.IOBase import GHC.Base #else +import Data.Int +import Data.Word import Foreign.Ptr +import Foreign.StablePtr #endif #ifdef __HUGS__ +import Hugs.Prelude import Hugs.Storable #endif @@ -77,8 +86,8 @@ memory blocks. The class 'Storable' facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size @Int@ types ('Int8', 'Int16', 'Int32', 'Int64'), the fixed size @Word@ types ('Word8', 'Word16', -'Word32', 'Word64'), 'StablePtr', all types from "CTypes" and -"CTypesISO", as well as 'Ptr'. +'Word32', 'Word64'), 'StablePtr', all types from "Foreign.C.Types", +as well as 'Ptr'. Minimal complete definition: 'sizeOf', 'alignment', one of 'peek', 'peekElemOff' and 'peekByteOff', and one of 'poke', 'pokeElemOff' and @@ -233,3 +242,5 @@ STORABLE(Int32,SIZEOF_INT32,ALIGNMENT_INT32, STORABLE(Int64,SIZEOF_INT64,ALIGNMENT_INT64, readInt64OffPtr,writeInt64OffPtr) + +#endif