Commit 1e1e959c authored by simonmar's avatar simonmar

[project @ 2005-04-28 10:26:30 by simonmar]

mode=slow
parent a8522e82
...@@ -7,6 +7,9 @@ import System -- 1.3 ...@@ -7,6 +7,9 @@ import System -- 1.3
import List -- 1.3 import List -- 1.3
import Char -- 1.3 import Char -- 1.3
import System.Environment
import Control.Monad
-- To keep it backward compatible with pre-Haskell 98 compilers.. -- To keep it backward compatible with pre-Haskell 98 compilers..
#if __HASKELL1__ >= 5 #if __HASKELL1__ >= 5
#define fail ioError #define fail ioError
...@@ -107,13 +110,13 @@ cal year = unlines (banner year `above` body year) ...@@ -107,13 +110,13 @@ cal year = unlines (banner year `above` body year)
-- For a standalone calendar program: -- For a standalone calendar program:
main = do main = do
strs <- getArgs (year:n:_) <- getArgs
case strs of [year] -> calFor year replicateM_ (read n) (calFor year)
_ -> fail (userError "Usage: cal year\n")
calFor year | illFormed = fail (userError "Bad argument") calFor year | illFormed = fail (userError "Bad argument")
| otherwise = putStr (cal yr) | otherwise = print (length (cal yr))
-- SDM: changed to print the length, otherwise
-- stdout file is too huge.
where illFormed = null ds || not (null rs) where illFormed = null ds || not (null rs)
(ds,rs) = span isDigit year (ds,rs) = span isDigit year
yr = atoi ds yr = atoi ds
......
...@@ -3,8 +3,9 @@ include $(TOP)/mk/boilerplate.mk ...@@ -3,8 +3,9 @@ include $(TOP)/mk/boilerplate.mk
SRC_HC_OPTS += -cpp SRC_HC_OPTS += -cpp
# Arguments for test program FAST_OPTS = 1993 1
PROG_ARGS = 1993 NORM_OPTS = 1993 1
SLOW_OPTS = 1993 2000
include $(TOP)/mk/target.mk include $(TOP)/mk/target.mk
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888
2888