equal
deleted
inserted
replaced
92 $ gets stringConsts |
92 $ gets stringConsts |
93 |
93 |
94 docToLower :: Doc -> Doc |
94 docToLower :: Doc -> Doc |
95 docToLower = text . map toLower . render |
95 docToLower = text . map toLower . render |
96 |
96 |
97 pas2C :: String -> String -> String -> IO () |
97 pas2C :: String -> String -> String -> String -> IO () |
98 pas2C fn inputPath outputPath = do |
98 pas2C fn inputPath alternateInputPath outputPath = do |
99 s <- flip execStateT initState $ f fn |
99 s <- flip execStateT initState $ f fn |
100 renderCFiles s outputPath |
100 renderCFiles s outputPath |
101 where |
101 where |
102 printLn = liftIO . hPutStrLn stdout |
102 printLn = liftIO . hPutStrLn stdout |
103 print = liftIO . hPutStr stdout |
103 print = liftIO . hPutStr stdout |
107 processed <- gets $ Map.member fileName |
107 processed <- gets $ Map.member fileName |
108 unless processed $ do |
108 unless processed $ do |
109 print ("Preprocessing '" ++ fileName ++ ".pas'... ") |
109 print ("Preprocessing '" ++ fileName ++ ".pas'... ") |
110 fc' <- liftIO |
110 fc' <- liftIO |
111 $ tryJust (guard . isDoesNotExistError) |
111 $ tryJust (guard . isDoesNotExistError) |
112 $ preprocess inputPath (fileName ++ ".pas") |
112 $ preprocess inputPath alternateInputPath (fileName ++ ".pas") |
113 case fc' of |
113 case fc' of |
114 (Left a) -> do |
114 (Left a) -> do |
115 modify (Map.insert fileName (System [])) |
115 modify (Map.insert fileName (System [])) |
116 printLn "doesn't exist" |
116 printLn "doesn't exist" |
117 (Right fc) -> do |
117 (Right fc) -> do |
1085 |
1085 |
1086 main = do |
1086 main = do |
1087 let programName = "hwengine" |
1087 let programName = "hwengine" |
1088 let inputPath = "../hedgewars/" |
1088 let inputPath = "../hedgewars/" |
1089 let outputPath = "./" |
1089 let outputPath = "./" |
1090 pas2C programName inputPath outputPath |
1090 let alternateInputPath = "./" |
|
1091 pas2C programName inputPath alternateInputPath outputPath |