wrap.hs revision 35db0960aa2e2a13652381c756fae5fb2b27213b
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann{- |
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannModule : $Header$
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannCopyright : (c) Christian Maeder, Uni Bremen 2002-2004
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannLicence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannMaintainer : hets@tzi.de
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannStability : experimental
2450a4210dee64b064499a3a1154129bdfc74981Daniel HausmannPortability : portable
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmanntest the haskell wrapper
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann-}
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannmodule Main where
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannimport System.Environment
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannimport Haskell.Wrapper
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannimport Text.ParserCombinators.Parsec
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannmain :: IO ()
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmannmain = do
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann l <- getArgs
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann if length l == 1
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann then do
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann let f = head l
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann s <- readFile f
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann let r = parse hStuff f s
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann putStr $ case r of
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann Right x -> x
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann Left err -> show err
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann else do
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann p <- getProgName
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann putStrLn("Usage: "++p++" <file>")
2450a4210dee64b064499a3a1154129bdfc74981Daniel Hausmann