X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FC%2FTypesISO.hs;h=65aa789109cd1bbef101bb72b6792b944f6465f1;hb=29246dd4eb44d03cc48cbd894821d3c9501d8829;hp=3d971f1e72068a1f629df0829b415b715b702e22;hpb=7f1f4e7a695c402ddd3a1dc2cc7114e649a78ebc;p=haskell-directory.git diff --git a/Foreign/C/TypesISO.hs b/Foreign/C/TypesISO.hs index 3d971f1..65aa789 100644 --- a/Foreign/C/TypesISO.hs +++ b/Foreign/C/TypesISO.hs @@ -1,15 +1,13 @@ {-# OPTIONS -fno-implicit-prelude #-} ----------------------------------------------------------------------------- --- +-- | -- 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 : experimental --- Portability : non-portable --- --- $Id: TypesISO.hs,v 1.1 2001/06/28 14:15:03 simonmar Exp $ +-- Stability : provisional +-- Portability : portable -- -- A mapping of C types defined by the ISO C standard to corresponding Haskell -- types. Like CTypes, this is a cool hack... @@ -23,15 +21,31 @@ module Foreign.C.TypesISO -- Numeric types, instances of: Eq, Ord, Num, Read, Show, Enum, -- Typeable, Storable - , CClock(..), CTime(..), + , CClock(..), CTime(..) + -- 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 Foreign.Storable #ifdef __GLASGOW_HASKELL__ import GHC.Base @@ -40,8 +54,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(CPtrdiff,tyConCPtrdiff,"CPtrdiff",HTYPE_PTRDIFF_T) @@ -64,21 +82,12 @@ INTEGRAL_TYPE(CSigAtomic,tyConCSigAtomic,"CSigAtomic",HTYPE_SIG_ATOMIC_T) INTEGRAL_TYPE(CClock,tyConCClock,"CClock",HTYPE_CLOCK_T) INTEGRAL_TYPE(CTime,tyConCTime,"CTime",HTYPE_TIME_T) --- TODO: Instances. But which...? :-} - +-- FIXME: Implement and provide instances for Eq and Storable data CFile = CFile - data CFpos = CFpos - 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