# HG changeset patch # User unc0rr # Date 1335984702 -14400 # Node ID 5d817ba976f7ee032fd8339cf66d07223d716316 # Parent 89488f5b99ca884cafe51c0bd4c12e60da45bd30 Render float consts into defines diff -r 89488f5b99ca -r 5d817ba976f7 hedgewars/pas2c.h --- a/hedgewars/pas2c.h Wed May 02 22:12:58 2012 +0400 +++ b/hedgewars/pas2c.h Wed May 02 22:51:42 2012 +0400 @@ -89,3 +89,5 @@ #define BlockRead(a, b, c, d) BlockRead_(a, &(b), c, &(d)) void BlockRead_(int f, void * p, int size, int * sizeRead); void close(int f); + +bool odd(int i); diff -r 89488f5b99ca -r 5d817ba976f7 tools/pas2c.hs --- a/tools/pas2c.hs Wed May 02 22:12:58 2012 +0400 +++ b/tools/pas2c.hs Wed May 02 22:51:42 2012 +0400 @@ -376,6 +376,10 @@ (True, BTInt, [i], Just _) -> do i' <- id2CTyped t i return [text "enum" <> braces (i' <+> ie)] + (True, BTFloat, [i], Just e) -> do + i' <- id2CTyped t i + ie <- initExpr2C e + return [text "#define" <+> i' <+> parens ie <> text "\n"] _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids where initExpr Nothing = return $ empty