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