packages feed

c2hsc 0.6.3 → 0.6.4

raw patch · 2 files changed

+15/−11 lines, 2 files

Files

Main.hs view
@@ -31,7 +31,7 @@ import           Text.StringTemplate  version :: String-version = "0.6.2"+version = "0.6.4"  copyright :: String copyright = "2012"@@ -377,11 +377,15 @@     isFuncDeclr (CFunDeclr {}) = True     isFuncDeclr _ = False +structTagPrefix :: CStructTag -> String+structTagPrefix CStructTag = "struct "+structTagPrefix CUnionTag = "union "+ appendType :: [CDeclarationSpecifier a] -> String -> Output () appendType declSpecs declrName = traverse_ appendType' declSpecs   where-    appendType' (CTypeSpec (CSUType (CStruct _ ident decls _ _) _)) = do-      let name' = identName ident+    appendType' (CTypeSpec (CSUType (CStruct tag ident decls _ _) _)) = do+      let name' = identName (structTagPrefix tag) ident       when (isNothing decls) $         appendHsc $ "#opaque_t " ++ name' @@ -400,8 +404,8 @@         appendHsc "#stoptype"      appendType' (CTypeSpec (CEnumType (CEnum ident defs _ _) _)) = do-      let name' = identName ident-      appendHsc $ "#integral_t " ++ name'+      let name' = identName "enum " ident+      when (length name' > 0) $ appendHsc $ "#integral_t " ++ name'        for_ defs $ \ds ->         for_ ds $ \(Ident nm _ _, _) ->@@ -409,9 +413,9 @@      appendType' _ = return () -    identName ident = case ident of+    identName pref ident = case ident of                         Nothing -> declrName-                        Just (Ident nm _ _) -> nm+                        Just (Ident nm _ _) -> pref ++ nm  -- The remainder of this file is some hairy code for turning various -- constructs into Bindings-DSL type names, such as turning "int ** foo" into@@ -596,10 +600,10 @@     Just (Typedef { typedefName = defNm }) ->       return defNm -typeName (CSUType (CStruct _ (Just (Ident nm _ _)) _ _ _) _) _ =-  return $ "<" ++ nm ++ ">"+typeName (CSUType (CStruct tag (Just (Ident nm _ _)) _ _ _) _) _ =+  return $ "<" ++ (structTagPrefix tag) ++ nm ++ ">" typeName (CEnumType (CEnum (Just (Ident nm _ _)) _ _ _) _) _ =-  return $ "<" ++ nm ++ ">"+  return $ "<enum " ++ nm ++ ">"  typeName (CComplexType _) _  = return "" typeName (CTypeOfExpr _ _) _ = return ""
c2hsc.cabal view
@@ -1,6 +1,6 @@ Name: c2hsc -Version:  0.6.3+Version:  0.6.4 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