packages feed

cpphs 1.18.7 → 1.18.8

raw patch · 10 files changed

+110/−101 lines, 10 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG view
@@ -12,6 +12,7 @@   * (1.18.6): bugfix to reject a macro usage with different arity than               its definition   * (1.18.7): bugfix to accept a #include with absolute filepath+  * (1.18.8): fix version number  Version 1.17 ------------
Language/Preprocessor/Cpphs/CppIfdef.hs view
@@ -13,8 +13,8 @@ -----------------------------------------------------------------------------  module Language.Preprocessor.Cpphs.CppIfdef-  ( cppIfdef	-- :: FilePath -> [(String,String)] -> [String] -> Options-		--      -> String -> IO [(Posn,String)]+  ( cppIfdef    -- :: FilePath -> [(String,String)] -> [String] -> Options+                --      -> String -> IO [(Posn,String)]   ) where  @@ -37,12 +37,12 @@  -- | Run a first pass of cpp, evaluating \#ifdef's and processing \#include's, --   whilst taking account of \#define's and \#undef's as we encounter them.-cppIfdef :: FilePath		-- ^ File for error reports-	-> [(String,String)]	-- ^ Pre-defined symbols and their values-	-> [String]		-- ^ Search path for \#includes-	-> BoolOptions		-- ^ Options controlling output style-	-> String		-- ^ The input file content-	-> IO [(Posn,String)]	-- ^ The file after processing (in lines)+cppIfdef :: FilePath            -- ^ File for error reports+        -> [(String,String)]    -- ^ Pre-defined symbols and their values+        -> [String]             -- ^ Search path for \#includes+        -> BoolOptions          -- ^ Options controlling output style+        -> String               -- ^ The input file content+        -> IO [(Posn,String)]   -- ^ The file after processing (in lines) cppIfdef fp syms search options =     cpp posn defs search options (Keep []) . (cppline posn:) . linesCpp   where@@ -85,45 +85,45 @@                                          else emitMany (replicate n (p,""))) $             cpp (newlines n p) syms' path options ud xs'     in case cmd of-	"define" -> skipn (insertST def syms) True (Keep ps) xs-	"undef"  -> skipn (deleteST sym syms) True (Keep ps) xs-	"ifndef" -> skipn syms False (keepIf (not (definedST sym syms))) xs-	"ifdef"  -> skipn syms False (keepIf      (definedST sym syms)) xs-	"if"     -> do b <- gatherDefined p syms (unwords line)+        "define" -> skipn (insertST def syms) True (Keep ps) xs+        "undef"  -> skipn (deleteST sym syms) True (Keep ps) xs+        "ifndef" -> skipn syms False (keepIf (not (definedST sym syms))) xs+        "ifdef"  -> skipn syms False (keepIf      (definedST sym syms)) xs+        "if"     -> do b <- gatherDefined p syms (unwords line)                        skipn syms False (keepIf b) xs-	"else"   -> skipn syms False (Drop 1 False ps) xs-	"elif"   -> skipn syms False (Drop 1 True ps) xs-	"endif"  | null ps ->+        "else"   -> skipn syms False (Drop 1 False ps) xs+        "elif"   -> skipn syms False (Drop 1 True ps) xs+        "endif"  | null ps ->                     do hPutStrLn stderr $ "Unmatched #endif at "++show p                        return []-	"endif"  -> skipn syms False (Keep (tail ps)) xs-	"pragma" -> skipn syms True  (Keep ps) xs-        ('!':_)  -> skipn syms False (Keep ps) xs	-- \#!runhs scripts-	"include"-> do (inc,content) <- readFirst (file syms (unwords line))+        "endif"  -> skipn syms False (Keep (tail ps)) xs+        "pragma" -> skipn syms True  (Keep ps) xs+        ('!':_)  -> skipn syms False (Keep ps) xs       -- \#!runhs scripts+        "include"-> do (inc,content) <- readFirst (file syms (unwords line))                                                   p path                                                   (warnings options)                        cpp p syms path options (Keep ps)                              (("#line 1 "++show inc): linesCpp content                                                     ++ cppline (newline p): xs)-	"warning"-> if warnings options then+        "warning"-> if warnings options then                       do hPutStrLn stderr (l++"\nin "++show p)                          skipn syms False (Keep ps) xs                     else skipn syms False (Keep ps) xs-	"error"  -> error (l++"\nin "++show p)-	"line"   | all isDigit sym-	         -> (if locations options && hashline options then emitOne (p,l)+        "error"  -> error (l++"\nin "++show p)+        "line"   | all isDigit sym+                 -> (if locations options && hashline options then emitOne (p,l)                      else if locations options then emitOne (p,cpp2hask l)                      else id) $                     cpp (newpos (read sym) (un rest) p)                         syms path options (Keep ps) xs-	n | all isDigit n && not (null n)-	         -> (if locations options && hashline options then emitOne (p,l)+        n | all isDigit n && not (null n)+                 -> (if locations options && hashline options then emitOne (p,l)                      else if locations options then emitOne (p,cpp2hask l)                      else id) $-	            cpp (newpos (read n) (un (tail ws)) p)+                    cpp (newpos (read n) (un (tail ws)) p)                         syms path options (Keep ps) xs           | otherwise-	         -> do when (warnings options) $+                 -> do when (warnings options) $                            hPutStrLn stderr ("Warning: unknown directive #"++n                                              ++"\nin "++show p)                        emitOne (p,l) $@@ -156,7 +156,7 @@                                return []                        else skipn  dend  xs     else skipn (Drop n b ps) xs-	-- define, undef, include, error, warning, pragma, line+        -- define, undef, include, error, warning, pragma, line  cpp p syms path options (Keep ps) (x:xs) =     let p' = newline p in seq p' $
Language/Preprocessor/Cpphs/HashDefine.hs view
@@ -23,32 +23,32 @@ import Data.List (intercalate)  data HashDefine-	= LineDrop-		{ name :: String }-	| Pragma-		{ name :: String }+        = LineDrop+                { name :: String }+        | Pragma+                { name :: String }         | AntiDefined-		{ name          :: String-		, linebreaks    :: Int-		}-	| SymbolReplacement-		{ name		:: String-		, replacement	:: String-		, linebreaks    :: Int-		}-	| MacroExpansion-		{ name		:: String-		, arguments	:: [String]-		, expansion	:: [(ArgOrText,String)]-		, linebreaks    :: Int-		}+                { name          :: String+                , linebreaks    :: Int+                }+        | SymbolReplacement+                { name          :: String+                , replacement   :: String+                , linebreaks    :: Int+                }+        | MacroExpansion+                { name          :: String+                , arguments     :: [String]+                , expansion     :: [(ArgOrText,String)]+                , linebreaks    :: Int+                }     deriving (Eq,Show)  -- | 'smart' constructor to avoid warnings from ghc (undefined fields) symbolReplacement :: HashDefine symbolReplacement =     SymbolReplacement-	 { name=undefined, replacement=undefined, linebreaks=undefined }+         { name=undefined, replacement=undefined, linebreaks=undefined }  -- | Macro expansion text is divided into sections, each of which is classified --   as one of three kinds: a formal argument (Arg), plain text (Text),
Language/Preprocessor/Cpphs/MacroPass.hs view
@@ -36,19 +36,19 @@ noPos = newfile "preDefined"  -- | Walk through the document, replacing calls of macros with the expanded RHS.-macroPass :: [(String,String)]	-- ^ Pre-defined symbols and their values-          -> BoolOptions	-- ^ Options that alter processing style-          -> [(Posn,String)]	-- ^ The input file content-          -> IO String		-- ^ The file after processing+macroPass :: [(String,String)]  -- ^ Pre-defined symbols and their values+          -> BoolOptions        -- ^ Options that alter processing style+          -> [(Posn,String)]    -- ^ The input file content+          -> IO String          -- ^ The file after processing macroPass syms options =-    fmap (safetail		-- to remove extra "\n" inserted below+    fmap (safetail              -- to remove extra "\n" inserted below          . concat          . onlyRights)     . macroProcess (pragma options) (layout options) (lang options)                    (preDefine options syms)     . tokenise (stripEol options) (stripC89 options)                (ansi options) (lang options)-    . ((noPos,""):)	-- ensure recognition of "\n#" at start of file+    . ((noPos,""):)     -- ensure recognition of "\n#" at start of file   where     safetail [] = []     safetail (_:xs) = xs@@ -60,20 +60,20 @@ -- | Walk through the document, replacing calls of macros with the expanded RHS. --   Additionally returns the active symbol table after processing. macroPassReturningSymTab-          :: [(String,String)]	-- ^ Pre-defined symbols and their values-          -> BoolOptions	-- ^ Options that alter processing style-          -> [(Posn,String)]	-- ^ The input file content+          :: [(String,String)]  -- ^ Pre-defined symbols and their values+          -> BoolOptions        -- ^ Options that alter processing style+          -> [(Posn,String)]    -- ^ The input file content           -> IO (String,[(String,String)])-				-- ^ The file and symbol table after processing+                                -- ^ The file and symbol table after processing macroPassReturningSymTab syms options =-    fmap (mapFst (safetail		-- to remove extra "\n" inserted below+    fmap (mapFst (safetail              -- to remove extra "\n" inserted below                  . concat)          . walk)     . macroProcess (pragma options) (layout options) (lang options)                    (preDefine options syms)     . tokenise (stripEol options) (stripC89 options)                (ansi options) (lang options)-    . ((noPos,""):)	-- ensure recognition of "\n#" at start of file+    . ((noPos,""):)     -- ensure recognition of "\n#" at start of file   where     safetail [] = []     safetail (_:xs) = xs
Language/Preprocessor/Cpphs/Options.hs view
@@ -25,12 +25,12 @@  -- | Cpphs options structure. data CpphsOptions = CpphsOptions -    { infiles	:: [FilePath]-    , outfiles	:: [FilePath]-    , defines	:: [(String,String)]-    , includes	:: [String]-    , preInclude:: [FilePath]	-- ^ Files to \#include before anything else-    , boolopts	:: BoolOptions+    { infiles   :: [FilePath]+    , outfiles  :: [FilePath]+    , defines   :: [(String,String)]+    , includes  :: [String]+    , preInclude:: [FilePath]   -- ^ Files to \#include before anything else+    , boolopts  :: BoolOptions     } deriving (Show)  -- | Default options.@@ -42,17 +42,17 @@  -- | Options representable as Booleans. data BoolOptions = BoolOptions-    { macros	:: Bool  -- ^ Leave \#define and \#undef in output of ifdef?-    , locations	:: Bool	 -- ^ Place \#line droppings in output?-    , hashline	:: Bool	 -- ^ Write \#line or {-\# LINE \#-} ?-    , pragma	:: Bool  -- ^ Keep \#pragma in final output?-    , stripEol	:: Bool  -- ^ Remove C eol (\/\/) comments everywhere?-    , stripC89	:: Bool  -- ^ Remove C inline (\/**\/) comments everywhere?-    , lang	:: Bool  -- ^ Lex input as Haskell code?-    , ansi	:: Bool  -- ^ Permit stringise \# and catenate \#\# operators?-    , layout	:: Bool  -- ^ Retain newlines in macro expansions?-    , literate	:: Bool  -- ^ Remove literate markup?-    , warnings	:: Bool  -- ^ Issue warnings?+    { macros    :: Bool  -- ^ Leave \#define and \#undef in output of ifdef?+    , locations :: Bool  -- ^ Place \#line droppings in output?+    , hashline  :: Bool  -- ^ Write \#line or {-\# LINE \#-} ?+    , pragma    :: Bool  -- ^ Keep \#pragma in final output?+    , stripEol  :: Bool  -- ^ Remove C eol (\/\/) comments everywhere?+    , stripC89  :: Bool  -- ^ Remove C inline (\/**\/) comments everywhere?+    , lang      :: Bool  -- ^ Lex input as Haskell code?+    , ansi      :: Bool  -- ^ Permit stringise \# and catenate \#\# operators?+    , layout    :: Bool  -- ^ Retain newlines in macro expansions?+    , literate  :: Bool  -- ^ Remove literate markup?+    , warnings  :: Bool  -- ^ Issue warnings?     } deriving (Show)  -- | Default settings of boolean options.@@ -121,17 +121,17 @@ boolOpts :: [RawOption] -> BoolOptions boolOpts opts =   BoolOptions-    { macros	= not (NoMacro `elem` opts)-    , locations	= not (NoLine  `elem` opts)-    , hashline	= not (LinePragma `elem` opts)-    , pragma	=      Pragma  `elem` opts-    , stripEol	=      StripEol`elem` opts-    , stripC89	=      StripEol`elem` opts || Strip `elem` opts+    { macros    = not (NoMacro `elem` opts)+    , locations = not (NoLine  `elem` opts)+    , hashline  = not (LinePragma `elem` opts)+    , pragma    =      Pragma  `elem` opts+    , stripEol  =      StripEol`elem` opts+    , stripC89  =      StripEol`elem` opts || Strip `elem` opts     , lang      = not (Text    `elem` opts)-    , ansi	=      Ansi    `elem` opts-    , layout	=      Layout  `elem` opts-    , literate	=      Unlit   `elem` opts-    , warnings	= not (SuppressWarnings `elem` opts)+    , ansi      =      Ansi    `elem` opts+    , layout    =      Layout  `elem` opts+    , literate  =      Unlit   `elem` opts+    , warnings  = not (SuppressWarnings `elem` opts)     }  -- | Parse all command-line options.
Language/Preprocessor/Cpphs/ReadFirst.hs view
@@ -25,13 +25,13 @@ --   The first location found is returned, together with the file content. --   (The directory of the calling file is always searched first, then --    the current directory, finally any specified search path.)-readFirst :: String		-- ^ filename-	-> Posn			-- ^ inclusion point-	-> [String]		-- ^ search path-	-> Bool			-- ^ report warnings?-	-> IO ( FilePath+readFirst :: String             -- ^ filename+        -> Posn                 -- ^ inclusion point+        -> [String]             -- ^ search path+        -> Bool                 -- ^ report warnings?+        -> IO ( FilePath               , String-              )			-- ^ discovered filepath, and file contents+              )                 -- ^ discovered filepath, and file contents  readFirst name demand path warn =     case name of
Language/Preprocessor/Unlit.hs view
@@ -14,7 +14,7 @@    where allProg [] = []  -- Should give an error message,                           -- but I have no good position information.          allProg (('\\':x):xs) |  "end{code}"`isPrefixOf`x = Blank : classify xs-	 allProg (x:xs) = Program x:allProg xs+         allProg (x:xs) = Program x:allProg xs classify (('>':x):xs)      = Program (' ':x) : classify xs classify (('#':x):xs)      = (case words x of                                 (line:rest) | all isDigit line@@ -64,8 +64,8 @@ inlines s = lines' s id   where   lines' []             acc = [acc []]-  lines' ('\^M':'\n':s) acc = acc [] : lines' s id	-- DOS-  lines' ('\^M':s)      acc = acc [] : lines' s id	-- MacOS-  lines' ('\n':s)       acc = acc [] : lines' s id	-- Unix+  lines' ('\^M':'\n':s) acc = acc [] : lines' s id      -- DOS+  lines' ('\^M':s)      acc = acc [] : lines' s id      -- MacOS+  lines' ('\n':s)       acc = acc [] : lines' s id      -- Unix   lines' (c:s)          acc = lines' s (acc . (c:)) 
cpphs.cabal view
@@ -1,5 +1,5 @@ Name: cpphs-Version: 1.18.7+Version: 1.18.8 Copyright: 2004-2015, Malcolm Wallace License: LGPL License-File: LICENCE-LGPL
cpphs.hs view
@@ -20,7 +20,7 @@ import Data.List   ( isPrefixOf )  version :: String-version = "1.18.6"+version = "1.18.8"  main :: IO () main = do
docs/index.html view
@@ -198,11 +198,11 @@ <b>Current stable version:</b>  <p>-cpphs-1.18.7, release date 2015.01.17<br>+cpphs-1.18.8, release date 2015-01-20<br> By HTTP: <a href="http://hackage.haskell.org/package/cpphs">Hackage</a>. <ul>-<li> bugfix to accept a #include with absolute filepath+<li> fix version number </ul>  <p>@@ -224,6 +224,14 @@  <p> <b>Older versions:</b>++<p>+cpphs-1.18.7, release date 2015.01.17<br>+By HTTP:+<a href="http://hackage.haskell.org/package/cpphs">Hackage</a>.+<ul>+<li> bugfix to accept a #include with absolute filepath+</ul>  <p> cpphs-1.18.6, release date 2014.10.17<br>