Render float consts into defines
authorunc0rr
Wed, 02 May 2012 22:51:42 +0400
changeset 7002 5d817ba976f7
parent 7001 89488f5b99ca
child 7003 e118ee168577
Render float consts into defines
hedgewars/pas2c.h
tools/pas2c.hs
--- 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);
--- 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