[project @ 2001-02-05 11:49:20 by chak]
authorchak <unknown>
Mon, 5 Feb 2001 11:49:20 +0000 (11:49 +0000)
committerchak <unknown>
Mon, 5 Feb 2001 11:49:20 +0000 (11:49 +0000)
Somewhere we lost the Storable instances of CFloat, CDouble and CLDouble &
removed cruft from CTypes.h.

ghc/lib/std/PrelStorable.lhs
ghc/lib/std/cbits/CTypes.h

index 343b36c..7bf23f5 100644 (file)
@@ -1,5 +1,5 @@
 % -----------------------------------------------------------------------------
-% $Id: PrelStorable.lhs,v 1.1 2001/01/11 17:25:57 simonmar Exp $
+% $Id: PrelStorable.lhs,v 1.2 2001/02/05 11:49:20 chak Exp $
 %
 % (c) The FFI task force, 2000
 %
@@ -162,6 +162,9 @@ NSTORABLE(CLong)
 NSTORABLE(CULong)
 NSTORABLE(CLLong)
 NSTORABLE(CULLong)
+NSTORABLE(CFloat)
+NSTORABLE(CDouble)
+NSTORABLE(CLDouble)
 NSTORABLE(CPtrdiff)
 NSTORABLE(CSize)
 NSTORABLE(CWchar)
index 00f9ba8..1d956b1 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: CTypes.h,v 1.1 2001/01/11 17:25:58 simonmar Exp $
+ * $Id: CTypes.h,v 1.2 2001/02/05 11:49:20 chak Exp $
  *
  * Dirty CPP hackery for CTypes/CTypesISO
  *
@@ -62,13 +62,6 @@ C = mkTyCon S ; \
 instance Typeable T where { \
   typeOf _ = mkAppTy C [] }
 
-#define INSTANCE_STORABLE(T) \
-instance Storable T where { \
-   sizeOf    (T x)       = sizeOf x ; \
-   alignment (T x)       = alignment x ; \
-   peekElemOff a i       = liftM T (peekElemOff a i) ; \
-   pokeElemOff a i (T x) = pokeElemOff a i x }
-
 #define INSTANCE_BOUNDED(T) \
 instance Bounded T where { \
    minBound = T minBound ; \
@@ -240,13 +233,6 @@ instance Num T where { \
    fromInteger         = unsafeCoerce# (fromInteger :: Integer -> B); \
    fromInt             = unsafeCoerce# (fromInt :: Int -> B) }
 
-#define INSTANCE_STORABLE(T,B) \
-instance Storable T where { \
-   sizeOf  = unsafeCoerce# (sizeOf :: B -> Int); \
-   alignment = unsafeCoerce# (alignment :: B -> Int); \
-   peekElemOff = unsafeCoerce# (peekElemOff :: Ptr B -> Int -> IO B); \
-   pokeElemOff = unsafeCoerce# (pokeElemOff :: Ptr B -> Int -> B -> IO B); }
-
 #define INSTANCE_BOUNDED(T,B) \
 instance Bounded T where { \
    minBound = T minBound ; \