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
import List -- 1.3
import Char -- 1.3
import System.Environment
import Control.Monad
-- To keep it backward compatible with pre-Haskell 98 compilers..
#if __HASKELL1__ >= 5
#define fail ioError
......@@ -107,13 +110,13 @@ cal year = unlines (banner year `above` body year)
-- For a standalone calendar program:
main = do
strs <- getArgs
case strs of [year] -> calFor year
_ -> fail (userError "Usage: cal year\n")
(year:n:_) <- getArgs
replicateM_ (read n) (calFor year)
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)
(ds,rs) = span isDigit year
yr = atoi ds
......
......@@ -3,8 +3,9 @@ include $(TOP)/mk/boilerplate.mk
SRC_HC_OPTS += -cpp
# Arguments for test program
PROG_ARGS = 1993
FAST_OPTS = 1993 1
NORM_OPTS = 1993 1
SLOW_OPTS = 1993 2000
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
2888
2888
2888
2888
2888
2888
2888
2888