packages feed

language-c-inline 0.7.6.1 → 0.7.7.0

raw patch · 3 files changed

+38/−15 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Language/C/Inline/ObjC.hs view
@@ -65,12 +65,17 @@ -- |Specify imported Objective-C files. Needs to be spliced where an import declaration can appear. (Just put it -- straight after all the import statements in the module.) --+-- NB: This inline splice must appear before any other use of inline code in a module.+-- -- FIXME: need to use TH.addDependentFile on each of the imported ObjC files & read headers -- objc_import :: [FilePath] -> Q [TH.Dec] objc_import headers   = do-    { mapM_ stashHeader headers+    {   -- explicitly initialise the state as we can run multiple times in a --make compile+    ; initialiseState++    ; mapM_ stashHeader headers     ; objc_jumptable <- newName "objc_jumptable"     ; setForeignTable $ varE objc_jumptable     ; sequence $ [ sigD objc_jumptable [t|IORef (Array Int Dynamic)|]@@ -583,8 +588,9 @@           objcFname   = dropExtension origFname ++ "_objc"           objcFname_h = objcFname `addExtension` "h"           objcFname_m = objcFname `addExtension` "m"-    ; headers          <- getHeaders+    ; allHeaders       <- getHeaders     ; (objc_h, objc_m) <- getHoistedObjC+    ; let (hsFFIHeader, headers) = separateHsFFI allHeaders     ; runIO $         do         { writeFile  objcFname_h (info origFname)@@ -592,7 +598,7 @@         ; appendFile objcFname_h (show $ QC.ppr objc_h)         ; writeFile  objcFname_m (info origFname)         ; appendFile objcFname_m ("#import \"" ++ takeFileName objcFname_h ++ "\"\n")-        ; appendFile objcFname_m ("#import \"HsFFI.h\"\n\n")+        ; appendFile objcFname_m (mkImport hsFFIHeader ++ "\n\n")         ; appendFile objcFname_m (show $ QC.ppr objc_m)         }     ; objc_jumptable <- getForeignTable@@ -607,6 +613,16 @@     ; (initialize ++) <$> getHoistedHS     }   where+    hsFFI = "HsFFI.h"     -- Haskell C FFI header as prescribed in the standard+    +      -- If the user supplies the FFI header (presumably at a non-standard location), use that; otherwise, we include+      -- the header without a path. (The FFI header should by default only be included into the .m file; otherwise, we+      -- get into problems with framework modules.)+    separateHsFFI headers+      = case break ((== hsFFI) . takeFileName) headers of+          (before, [])        -> (hsFFI, before)+          (before, ffi:after) -> (ffi, before ++ after)+         mkImport h@('<':_) = "#import " ++ h ++ ""     mkImport h         = "#import \"" ++ h ++ "\"" 
Language/C/Inline/State.hs view
@@ -14,8 +14,9 @@ module Language.C.Inline.State (   -- * Abstract application state   State,+  initialiseState,   -  -- * State query and update operations+  -- ** State query and update operations   setForeignTable, stashHeader, stashMarshaller, stashObjC_h, stashObjC_m, stashHS,    extendJumpTable,   getForeignTable, getForeignLabels, getHeaders, getMarshallers, lookupMarshaller, getHoistedObjC, getHoistedHS@@ -53,16 +54,22 @@ state :: IORef State {-# NOINLINE state #-} state = unsafePerformIO $ -          newIORef $ -            State-            { foreignTable  = error "Language.C.Inline.State: internal error: 'foreignTable' undefined"-            , foreignLabels = []-            , headers       = []-            , marshallers   = []-            , hoistedObjC_h = []-            , hoistedObjC_m = []-            , hoistedHS     = []-            }+          newIORef initialState++initialState :: State+initialState +  = State+    { foreignTable  = error "Language.C.Inline.State: internal error: 'foreignTable' undefined"+    , foreignLabels = []+    , headers       = []+    , marshallers   = []+    , hoistedObjC_h = []+    , hoistedObjC_m = []+    , hoistedHS     = []+    }+    +initialiseState :: Q ()+initialiseState = modifyState (const initialState)  readState :: (State -> a) -> Q a readState read = runIO $ read <$> readIORef state
language-c-inline.cabal view
@@ -1,5 +1,5 @@ Name:                   language-c-inline-Version:                0.7.6.1+Version:                0.7.7.0 Cabal-version:          >= 1.9.2 Tested-with:            GHC == 7.6.3, GHC == 7.8.2 Build-type:             Simple