X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FC%2FTypesISO.hs;h=ab2c928d357f98bd0547a9e43f2d53e3da7275c9;hb=d539a9457e2c79a9f13744d073d3f253ea2fb33e;hp=742fc733a2493acb0953f6f1ce34a3cdac2e775a;hpb=9fa9bc17072a58c0bae2cce4764d38677e96ac29;p=ghc-base.git diff --git a/Foreign/C/TypesISO.hs b/Foreign/C/TypesISO.hs index 742fc73..ab2c928 100644 --- a/Foreign/C/TypesISO.hs +++ b/Foreign/C/TypesISO.hs @@ -3,36 +3,57 @@ -- | -- Module : Foreign.C.TypesISO -- 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 : provisional -- Portability : portable -- --- $Id: TypesISO.hs,v 1.4 2002/04/24 16:31:44 simonmar Exp $ --- -- A mapping of C types defined by the ISO C standard to corresponding Haskell -- types. Like CTypes, this is a cool hack... -- ----------------------------------------------------------------------------- +-- #hide module Foreign.C.TypesISO +#ifndef __NHC__ ( -- Integral types, instances of: Eq, Ord, Num, Read, Show, Enum, -- Typeable, Storable, Bounded, Real, Integral, Bits - CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..) + CPtrdiff, CSize, CWchar, CSigAtomic -- Numeric types, instances of: Eq, Ord, Num, Read, Show, Enum, -- Typeable, Storable - , CClock(..), CTime(..), + , CClock, CTime +#else + ( -- For nhc98, these are exported non-abstractly to work around + -- an interface-file problem. + CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..) + , CClock(..), CTime(..) +#endif -- Instances of: Eq and Storable , CFile, CFpos, CJmpBuf ) where +#ifdef __NHC__ +import NHC.FFI + ( CPtrdiff(..) + , CSize(..) + , CWchar(..) + , CSigAtomic(..) + , CClock(..) + , CTime(..) + , CFile + , CFpos + , CJmpBuf + ) +#else + import Data.Bits ( Bits(..) ) import Data.Int import Data.Word -import Data.Dynamic +import Data.Typeable +import Foreign.Storable #ifdef __GLASGOW_HASKELL__ import GHC.Base @@ -41,8 +62,12 @@ import GHC.Real import GHC.Show import GHC.Read import GHC.Num +#else +import Control.Monad +import Foreign.Ptr #endif +#include "Typeable.h" #include "CTypes.h" INTEGRAL_TYPE(CPtrdiff,tyConCPtrdiff,"CPtrdiff",HTYPE_PTRDIFF_T) @@ -73,10 +98,4 @@ data CJmpBuf = CJmpBuf -- C99 types which are still missing include: -- intptr_t, uintptr_t, intmax_t, uintmax_t, wint_t, wctrans_t, wctype_t -#include "Dynamic.h" -INSTANCE_TYPEABLE0(CPtrdiff,cPtrdiffTc,"CPtrdiff") -INSTANCE_TYPEABLE0(CSize,cSizeTc,"CSize") -INSTANCE_TYPEABLE0(CWchar,cWcharTc,"CWchar") -INSTANCE_TYPEABLE0(CSigAtomic,cSigAtomicTc,"CSigAtomic") -INSTANCE_TYPEABLE0(CClock,cClockTc,"CClock") -INSTANCE_TYPEABLE0(CTime,cTimeTc,"CTime") +#endif