- Fix type2C id2C call
authorunc0rr
Wed, 07 Dec 2011 17:55:23 +0400
changeset 6514 8ba891d34eba
parent 6513 677b96d13e1f
child 6515 74a04089bb56
- Fix type2C id2C call - Introduce renderCFiles function
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/GameMode.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Grave.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Map.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Scheme.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Team.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/UserInput/TouchInterface.java
share/hedgewars/Data/Scripts/plist/Racer.plist
tools/pas2c.hs
--- a/tools/pas2c.hs	Wed Dec 07 12:19:36 2011 +0100
+++ b/tools/pas2c.hs	Wed Dec 07 17:55:23 2011 +0400
@@ -23,7 +23,7 @@
 pas2C fn = do
     setCurrentDirectory "../hedgewars/"
     s <- flip execStateT initState $ f fn
-    mapM_ toCFiles (Map.toList s)
+    renderCFiles s
     where
     printLn = liftIO . hPutStrLn stderr
     print = liftIO . hPutStr stderr
@@ -53,6 +53,12 @@
                             modify (Map.insert fileName a)
                             mapM_ f (usesFiles a)
 
+
+renderCFiles :: Map.Map String PascalUnit -> IO ()
+renderCFiles units = do
+    let u = Map.toList units
+    mapM_ toCFiles u
+
 toCFiles :: (String, PascalUnit) -> IO ()
 toCFiles (_, System _) = return ()
 toCFiles p@(fn, pu) = do
@@ -172,7 +178,7 @@
 type2C :: TypeDecl -> State RenderState Doc
 type2C UnknownType = return $ text "void"
 type2C (String l) = return $ text $ "string" ++ show l
-type2C (SimpleType i) = id2C True i
+type2C (SimpleType i) = id2C False i
 type2C (PointerTo t) = liftM (<> text "*") $ type2C t
 type2C (RecordType tvs union) = do
     t <- mapM (tvar2C False) tvs