[project @ 2003-05-29 17:37:17 by malcolm]
authormalcolm <unknown>
Thu, 29 May 2003 17:37:19 +0000 (17:37 +0000)
committermalcolm <unknown>
Thu, 29 May 2003 17:37:19 +0000 (17:37 +0000)
For nhc98 only, export the basic C types non-abstractly.
This is due to a deficiency in the way newtypes are handled in
interface files - the compiler needs full information about the
newtype in order to pass values across the FFI.

Foreign/C/Error.hs
Foreign/C/Types.hs
Foreign/C/TypesISO.hs
Foreign/Marshal/Utils.hs

index c6106e0..cb8023b 100644 (file)
@@ -120,9 +120,6 @@ import System.IO.Unsafe             ( unsafePerformIO )
 {-# CBITS errno.c #-}
 #endif
 
-#ifdef __NHC__
-import NHC.FFI                 ( CInt(..) )
-#endif
 
 -- "errno" type
 -- ------------
index 15b624a..a36293e 100644 (file)
@@ -14,6 +14,7 @@
 -----------------------------------------------------------------------------
 
 module Foreign.C.Types
+#ifndef __NHC__
        ( -- Integral types, instances of: Eq, Ord, Num, Read, Show, Enum,
          -- Typeable, Storable, Bounded, Real, Integral, Bits
          CChar,  CSChar,  CUChar
@@ -29,6 +30,16 @@ module Foreign.C.Types
          -- Typeable, Storable, Real, Fractional, Floating, RealFrac,
          -- RealFloat 
        , CFloat,  CDouble, CLDouble
+#else
+       ( -- Exported non-abstractly in nhc98 to fix an interface file problem.
+         CChar(..),    CSChar(..),  CUChar(..)
+       , CShort(..),   CUShort(..), CInt(..),   CUInt(..)
+       , CLong(..),    CULong(..)
+       , CPtrdiff(..), CSize(..),   CWchar(..), CSigAtomic(..)
+        , CLLong(..),   CULLong(..)
+       , CClock(..),   CTime(..)
+       , CFloat(..),   CDouble(..), CLDouble(..)
+#endif
 
           -- Instances of: Eq and Storable
        , CFile,        CFpos,     CJmpBuf
@@ -36,13 +47,13 @@ module Foreign.C.Types
 
 #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
+  ( 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
index 21b0930..bde136c 100644 (file)
@@ -16,6 +16,7 @@
 
 -- #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
@@ -23,6 +24,12 @@ module Foreign.C.TypesISO
          -- Numeric types, instances of: Eq, Ord, Num, Read, Show, Enum,
          -- Typeable, Storable
        , 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
@@ -30,12 +37,12 @@ module Foreign.C.TypesISO
 
 #ifdef __NHC__
 import NHC.FFI
-  ( CPtrdiff
-  , CSize
-  , CWchar
-  , CSigAtomic
-  , CClock
-  , CTime
+  ( CPtrdiff(..)
+  , CSize(..)
+  , CWchar(..)
+  , CSigAtomic(..)
+  , CClock(..)
+  , CTime(..)
   , CFile
   , CFpos
   , CJmpBuf
index c88fb51..8f11e56 100644 (file)
@@ -64,7 +64,7 @@ import GHC.Base
 #endif
 
 #ifdef __NHC__
-import NHC.FFI                 ( CInt(..) )
+import Foreign.C.Types         ( CInt(..) )
 #endif
 
 -- combined allocation and marshalling