{-# LANGUAGE LambdaCase #-} import Hpp.CmdLine import System.Environment usage :: IO () usage = mapM_ putStrLn [ "Usage: hpp [options] inputFile [outputFile]" , "" , "Options:" , "-D name" , " Define name as an object macro defined as 1." , "-D name=definition" , " Define name as an object macro defined as definition." , "-U name" , " Remove any previous definition of name." , "-I dir" , " Add directory dir to the search path for includes." , "-o file" , " Write output to file. If not given, outputs to stdout." , "-include file" , " Acts as if #include \"file\" were the first line " , " in the primary source file. -include options are " , " processed after -D and -U options." , "--cpp" , " C98 compatibility." , " Implies: --fline-splice --ferase-comments --freplace-trigraphs" , " -D __STDC__ -D __STDC_VERSION__=199409L -D _POSIX_C_SOURCE=200112L" , "--only-macros" , " No line splicing, no comment removal, no trigraph replacement." , " Only macros (including conditionals) and line marker output." , "-P" , " Inhibit #line markers." , "--fline-splice" , " Enable continued line splicing." , "--ferase-comments" , " Remove all C-style comments before processing." , "--freplace-trigraphs" , " Replace trigraph sequences before processing."] main :: IO () main = do getArgs >>= \case [] -> usage ["--help"] -> usage ["-help"] -> usage ["-h"] -> usage ["--h"] -> usage args -> runWithArgs args >> return () {- For testing against C: hpp -I/usr/local/include -I/usr/include -fline-splice -ferase-comments -D __x86_64__ -D __GNUC__ -D _POSIX_C_SOURCE n_1.c For the mcpp validation suite ../tool/cpp_test HPP "../../dist/build/hpp/hpp -I/usr/local/include -I/usr/include -fline-splice -ferase-comments -D __x86_64__ -D __GNUC__=4 -D __STDC__ -D __STDC_VERSION__=199409L -D _POSIX_C_SOURCE -D __DARWIN_ONLY_UNIX_CONFORMANCE %s.c | gcc -o %s -x c -" "rm %s" < n_i_.lst -}