[project @ 2003-05-12 08:55:53 by ross]
[ghc-base.git] / Foreign / C / Types.hs
index df1b989..944cf6d 100644 (file)
@@ -19,16 +19,36 @@ module Foreign.C.Types
          CChar(..),  CSChar(..),  CUChar(..)
        , CShort(..), CUShort(..), CInt(..),   CUInt(..)
        , CLong(..),  CULong(..)
-#ifndef __HUGS__
+       , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..)
         , CLLong(..), CULLong(..)
-#endif
+         -- 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(..)
+
+          -- 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 )
@@ -42,6 +62,9 @@ import GHC.Real
 import GHC.Show
 import GHC.Read
 import GHC.Num
+#else
+import Control.Monad
+import Foreign.Ptr
 #endif
 
 #include "Dynamic.h"
@@ -60,10 +83,8 @@ INTEGRAL_TYPE(CUInt,tyConCUInt,"CUInt",HTYPE_UNSIGNED_INT)
 INTEGRAL_TYPE(CLong,tyConCLong,"CLong",HTYPE_LONG)
 INTEGRAL_TYPE(CULong,tyConCULong,"CULong",HTYPE_UNSIGNED_LONG)
 
-#ifndef __HUGS__
 INTEGRAL_TYPE(CLLong,tyConCLLong,"CLLong",HTYPE_LONG_LONG)
 INTEGRAL_TYPE(CULLong,tyConCULLong,"CULLong",HTYPE_UNSIGNED_LONG_LONG)
-#endif
 
 {-# RULES
 "fromIntegral/a->CChar"   fromIntegral = \x -> CChar   (fromIntegral x)
@@ -96,3 +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)
 
+#endif