packages feed

c2hsc 0.3.1 → 0.3.2

raw patch · 3 files changed

+11/−11 lines, 3 files

Files

Main.hs view
@@ -435,15 +435,13 @@                                           <*> pure (f:ds)  applyDeclrs cStyle baseType (CFunDeclr (Right (decls, _)) _ _:_)-  | cStyle = do-    let declNames = sequence $-                    map (cdeclTypeName' cStyle) decls ++ [pure baseType]-    intercalate ", " <$> (filter (/= "") <$> declNames)+  | cStyle    = renderList ", " (funTypes decls baseType)+  | otherwise = do argTypes <- renderList " -> " (funTypes decls baseType)+                   return $ "FunPtr (" ++ argTypes ++ ")" -  | otherwise = do-    let declNames = sequence $ map cdeclTypeName decls ++ [pure baseType]-    argTypes <- intercalate " -> " <$> (filter (/= "") <$> declNames)-    return $ "FunPtr (" ++ argTypes ++ ")"+  where renderList str xs = intercalate str . filter (not . null) <$> xs+        funTypes xs bt    = sequence $+                            map (cdeclTypeName' cStyle) xs ++ [pure bt]  applyDeclrs cStyle baseType (CPtrDeclr _ _:[])   | cStyle && baseType == "" = return "void *"
README.md view
@@ -1,16 +1,18 @@ Converts C API header files to `.hsc` and `.hsc.helper.c` files -    Usage: c2hsc <Lib Prefix> [cpp options...] <FILE>.h+    Usage: c2hsc --prefix=<Lib Prefix> <FILE>.h  This will create `<FILE>.hsc`, and `<FILE>.hsc.helper.c` if the header file contains inline functions.  For example, in `hlibgit2` on the Mac I'm using: -    c2hsc Bindings.Libgit2 -U__BLOCKS__ libgit2/include/git2/tree.h+    c2hsc --prefix=Bindings.Libgit2 --cppopts=-U__BLOCKS__ \+        libgit2/include/git2/tree.h  Known issues: + - Filename matching is not accurate enough  - Pointers to "struct foo" are being rendered as Ptr () [void *]  - Function pointers of void return type are rendered incorrectlyb  - `const` is being dropped from BC_INLINE macros
c2hsc.cabal view
@@ -1,6 +1,6 @@ Name: c2hsc -Version:  0.3.1+Version:  0.3.2 Synopsis: Convert C API header files to .hsc and .hsc.helper.c files  Description: Convert C API header files to .hsc and .hsc.helper.c files