tools/pas2c.hs
changeset 6514 8ba891d34eba
parent 6512 0df7f6697939
child 6516 addaeb1b9539
--- 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