X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FC%2FTypes.hs;h=15b624a29ad3929485c376e0f45e4cdbc9f629b6;hb=69f06ecf9c7517fa9ce03b7f67084177df164952;hp=f20967299d3d34e5171f4609d611f763f02b1790;hpb=7f1f4e7a695c402ddd3a1dc2cc7114e649a78ebc;p=ghc-base.git diff --git a/Foreign/C/Types.hs b/Foreign/C/Types.hs index f209672..15b624a 100644 --- a/Foreign/C/Types.hs +++ b/Foreign/C/Types.hs @@ -1,32 +1,54 @@ {-# OPTIONS -fno-implicit-prelude #-} ----------------------------------------------------------------------------- --- +-- | -- Module : Foreign.C.Types -- Copyright : (c) The FFI task force 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : ffi@haskell.org --- Stability : experimental --- Portability : non-portable --- --- $Id: Types.hs,v 1.1 2001/06/28 14:15:03 simonmar Exp $ +-- Stability : provisional +-- Portability : portable -- --- Mapping of C types to corresponding Haskell types. A cool hack... +-- Mapping of C types to corresponding Haskell types. -- ----------------------------------------------------------------------------- module Foreign.C.Types ( -- Integral types, instances of: Eq, Ord, Num, Read, Show, Enum, -- Typeable, Storable, Bounded, Real, Integral, Bits - CChar(..), CSChar(..), CUChar(..) - , CShort(..), CUShort(..), CInt(..), CUInt(..) - , CLong(..), CULong(..), CLLong(..), CULLong(..) + CChar, CSChar, CUChar + , CShort, CUShort, CInt, CUInt + , CLong, CULong + , CPtrdiff, CSize, CWchar, CSigAtomic + , CLLong, CULLong + -- Numeric types, instances of: Eq, Ord, Num, Read, Show, Enum, + -- Typeable, Storable + , CClock, CTime -- Floating types, instances of: Eq, Ord, Num, Read, Show, Enum, - -- Typeable, Storable, Real, Fractional, Floating, RealFrac, RealFloat - , CFloat(..), CDouble(..), CLDouble(..) + -- Typeable, Storable, Real, Fractional, Floating, RealFrac, + -- RealFloat + , CFloat, CDouble, CLDouble + + -- Instances of: Eq and Storable + , CFile, CFpos, CJmpBuf ) where +#ifdef __NHC__ +import NHC.FFI + ( CChar, CSChar, CUChar + , CShort, CUShort, CInt, CUInt + , CLong, CULong, CLLong, CULLong + , CPtrdiff, CSize, CWchar, CSigAtomic + , CClock, CTime + , CFloat, CDouble, CLDouble + , CFile, CFpos, CJmpBuf + , Storable(..) + ) +#else + +import Foreign.C.TypesISO +import Foreign.Storable import Data.Bits ( Bits(..) ) import Data.Int ( Int8, Int16, Int32, Int64 ) import Data.Word ( Word8, Word16, Word32, Word64 ) @@ -40,8 +62,12 @@ import GHC.Real import GHC.Show import GHC.Read import GHC.Num +#else +import Control.Monad +import Foreign.Ptr #endif +#include "Dynamic.h" #include "CTypes.h" INTEGRAL_TYPE(CChar,tyConCChar,"CChar",HTYPE_CHAR) @@ -91,24 +117,4 @@ FLOATING_TYPE(CDouble,tyConCDouble,"CDouble",HTYPE_DOUBLE) -- HACK: Currently no long double in the FFI, so we simply re-use double FLOATING_TYPE(CLDouble,tyConCLDouble,"CLDouble",HTYPE_DOUBLE) - -#include "Dynamic.h" -INSTANCE_TYPEABLE0(CChar,cCharTc,"CChar") -INSTANCE_TYPEABLE0(CSChar,cSCharTc,"CSChar") -INSTANCE_TYPEABLE0(CUChar,cUCharTc,"CUChar") - -INSTANCE_TYPEABLE0(CShort,cShortTc,"CShort") -INSTANCE_TYPEABLE0(CUShort,cUShortTc,"CUShort") - -INSTANCE_TYPEABLE0(CInt,cIntTc,"CInt") -INSTANCE_TYPEABLE0(CUInt,cUIntTc,"CUInt") - -INSTANCE_TYPEABLE0(CLong,cLongTc,"CLong") -INSTANCE_TYPEABLE0(CULong,cULongTc,"CULong") - -INSTANCE_TYPEABLE0(CLLong,cLLongTc,"CLLong") -INSTANCE_TYPEABLE0(CULLong,cULLongTc,"CULLong") - -INSTANCE_TYPEABLE0(CFloat,cFloatTc,"CFloat") -INSTANCE_TYPEABLE0(CDouble,cDoubleTc,"CDouble") -INSTANCE_TYPEABLE0(CLDouble,cLDoubleTc,"CLDouble") +#endif