equal
deleted
inserted
replaced
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 -> IO () |
98 pas2C fn inputPath outputPath = do |
98 pas2C fn inputPath outputPath = do |
99 setCurrentDirectory inputPath |
|
100 s <- flip execStateT initState $ f fn |
99 s <- flip execStateT initState $ f fn |
101 renderCFiles s outputPath |
100 renderCFiles s outputPath |
102 where |
101 where |
103 printLn = liftIO . hPutStrLn stdout |
102 printLn = liftIO . hPutStrLn stdout |
104 print = liftIO . hPutStr stdout |
103 print = liftIO . hPutStr stdout |
108 processed <- gets $ Map.member fileName |
107 processed <- gets $ Map.member fileName |
109 unless processed $ do |
108 unless processed $ do |
110 print ("Preprocessing '" ++ fileName ++ ".pas'... ") |
109 print ("Preprocessing '" ++ fileName ++ ".pas'... ") |
111 fc' <- liftIO |
110 fc' <- liftIO |
112 $ tryJust (guard . isDoesNotExistError) |
111 $ tryJust (guard . isDoesNotExistError) |
113 $ preprocess (fileName ++ ".pas") |
112 $ preprocess inputPath (fileName ++ ".pas") |
114 case fc' of |
113 case fc' of |
115 (Left a) -> do |
114 (Left a) -> do |
116 modify (Map.insert fileName (System [])) |
115 modify (Map.insert fileName (System [])) |
117 printLn "doesn't exist" |
116 printLn "doesn't exist" |
118 (Right fc) -> do |
117 (Right fc) -> do |