Fix the function definition issue so the function pointer format now looks correct.
authorxymeng
Fri, 29 Jun 2012 22:46:58 +0400
changeset 7327 4e35c45d0853
parent 7325 a68eca3ad1fe
child 7329 92b6d8ae99e4
Fix the function definition issue so the function pointer format now looks correct.
tools/pas2c.hs
--- a/tools/pas2c.hs	Fri Jun 29 01:23:43 2012 +0400
+++ b/tools/pas2c.hs	Fri Jun 29 22:46:58 2012 +0400
@@ -464,7 +464,7 @@
              i' <- id2CTyped t i
              ie <- initExpr2C e
              return [text "#define" <+> i' <+> parens ie <> text "\n"]
-         (_, BTFunction{}, _, Nothing) -> liftM (map(\i -> t' $ text "*" <+> i)) $ mapM (id2CTyped t) ids
+         (_, BTFunction{}, _, Nothing) -> liftM (map(\i -> t' i)) $ mapM (id2CTyped t) ids
          _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids
     where
     initExpr Nothing = return $ empty
@@ -615,7 +615,7 @@
     type2C' (FunctionType returnType params) = do
         t <- type2C returnType
         p <- withState' id $ functionParams2C params
-        return (\i -> t empty <+> i <> parens p)
+        return (\i -> (t empty <> (parens $ text "*" <> i) <> parens p))
     type2C' (DeriveType (InitBinOp _ _ i)) = type2C' (DeriveType i)
     type2C' (DeriveType (InitPrefixOp _ i)) = type2C' (DeriveType i)
     type2C' (DeriveType (InitNumber _)) = return (text "int" <+>)