[pass -D flags to hsc2hs, add CLong and CULong instances, fill out Foreign.ForeignPtr
John Meacham <john@repetae.net>**20120206140318
 Ignore-this: b386c32535020c2b821d481d3692987e
] hunk ./Makefile.am 360
+bytestring-0.9.2.0.hl: lib/ext/bytestring.yaml base-1.0.hl
+	perl utils/build_extlibs.prl $<
hunk ./lib/base/Foreign/ForeignPtr.hs 1
--- | Just a dummy skeleton, fixme.
-module Foreign.ForeignPtr
-    (ForeignPtr, newForeignPtr_, newForeignPtr,
-     addForeignPtrFinalizer, mallocForeignPtr, mallocForeignPtrBytes,
-     withForeignPtr, unsafeForeignPtrToPtr, touchForeignPtr, castForeignPtr
+module Foreign.ForeignPtr(
+    ForeignPtr,  FinalizerPtr,  FinalizerEnvPtr,  newForeignPtr,
+    newForeignPtr_,  addForeignPtrFinalizer,  newForeignPtrEnv,
+    addForeignPtrFinalizerEnv,  withForeignPtr,  finalizeForeignPtr,
+    unsafeForeignPtrToPtr,  touchForeignPtr,  castForeignPtr,
+    mallocForeignPtr,  mallocForeignPtrBytes,  mallocForeignPtrArray,
+    mallocForeignPtrArray0
hunk ./lib/base/Foreign/ForeignPtr.hs 19
-
hunk ./lib/base/Foreign/ForeignPtr.hs 30
-
hunk ./lib/base/Foreign/ForeignPtr.hs 45
+mallocForeignPtrArray0  :: Storable a => Int -> IO (ForeignPtr a)
+mallocForeignPtrArray0 = liftM FP . mallocArray0
+
hunk ./lib/base/Foreign/ForeignPtr.hs 62
+
+-- |A finalizer is represented as a pointer to a foreign function that, at
+-- finalisation time, gets as an argument a plain pointer variant of the
+-- foreign pointer that the finalizer is associated with.
+--
+type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ())
+
+-- | This variant of newForeignPtr adds a finalizer that expects an environment in addition to the finalized pointer. The environment that will be passed to the finalizer is fixed by the second argument to newForeignPtrEnv.
+newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a)
+newForeignPtrEnv _ _ p = newForeignPtr_ p
+
+-- | Like addForeignPtrFinalizerEnv but allows the finalizer to be passed an additional environment parameter to be passed to the finalizer. The environment passed to the finalizer is fixed by the second argument to addForeignPtrFinalizerEnv
+addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO ()
+addForeignPtrFinalizerEnv _ _ _ = return ()
+
+-- | Causes the finalizers associated with a foreign pointer to be run immediately.
+finalizeForeignPtr :: ForeignPtr a -> IO ()
+finalizeForeignPtr _ = return ()
hunk ./lib/jhc/Jhc/Inst/Enum.hs 60
+ENUMINST(CLong)
+BOUNDED(CLong)
+ENUMINST(CULong)
+UBOUNDED(CULong)
+
hunk ./lib/jhc/Jhc/Inst/Num.hs 50
+SIGNED(CLong)
+UNSIGNED(CULong)
hunk ./lib/jhc/Jhc/Inst/Order.hs 35
+INST_EQORDER(CLong,,CLong,)
+INST_EQORDER(CULong,,CULong,U)
hunk ./lib/jhc/Jhc/Inst/Show.hs 66
+instance Show CLong where
+    showsPrec p x = showsPrec p (fromIntegral x :: Integer)
hunk ./lib/jhc/Jhc/Inst/Show.hs 77
+instance Show CULong where
+    showsPrec _ x = showWordMax (fromIntegral x :: WordMax)
hunk ./src/Ho/ReadSource.hs 103
-    let hscargs =   [fp, "-o", tdir </> out] ++ incFlags ++ concatMap (\x -> ["-C",x]) cflags ++ ["-c", cc]
+        defFlags = [ "-D" ++ d | d <- optDefs options ]
+    let hscargs =   [fp, "-o", tdir </> out] ++ defFlags ++ incFlags ++ concatMap (\x -> ["-C",x]) cflags ++ ["-c", cc]