% -----------------------------------------------------------------------------
-% $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
%
NSTORABLE(CULong)
NSTORABLE(CLLong)
NSTORABLE(CULLong)
+NSTORABLE(CFloat)
+NSTORABLE(CDouble)
+NSTORABLE(CLDouble)
NSTORABLE(CPtrdiff)
NSTORABLE(CSize)
NSTORABLE(CWchar)
/* -----------------------------------------------------------------------------
- * $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
*
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 ; \
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 ; \