use CPPHS for processing
This commit is contained in:
parent
b487aef898
commit
515f55b344
11
QA.hs
11
QA.hs
@ -7,6 +7,7 @@ import Data.List
|
|||||||
import System.Directory
|
import System.Directory
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
|
import System.Process
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
@ -87,10 +88,16 @@ main = do
|
|||||||
"" -> []
|
"" -> []
|
||||||
s' -> w : wordsWhen p s'' where (w, s'') = break p s'
|
s' -> w : wordsWhen p s'' where (w, s'') = break p s'
|
||||||
|
|
||||||
processCPP file content = return $ simpleCPP
|
processCPP file content = do
|
||||||
|
contentProcessed <- readProcess "cpphs" [d minVersionBase] content
|
||||||
|
return $ simpleCPP contentProcessed
|
||||||
where
|
where
|
||||||
|
|
||||||
|
d s = "-D" ++ s
|
||||||
|
minVersionBase = "MIN_VERSION_base(a,b,c)=(((a) >= 4) && ((b) >= 7))"
|
||||||
|
|
||||||
-- simple CPP just strip # starting line
|
-- simple CPP just strip # starting line
|
||||||
simpleCPP = unlines $ filter (not . isHashStart) $ lines content
|
simpleCPP = unlines . filter (not . isHashStart) . lines
|
||||||
where
|
where
|
||||||
isHashStart s = case dropWhile (flip elem " \t\v") s of
|
isHashStart s = case dropWhile (flip elem " \t\v") s of
|
||||||
[] -> False
|
[] -> False
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user