Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/libraries/Cabal/tests/wash2hs/hs/WASHMain.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Main where

-- ghc --make WASHMain -package text -o WASHMain

import IO
import List
import System
import WASHGenerator
import WASHFlags

main =
  do args <- getArgs
     runPreprocessor flags0 args

runPreprocessor flags [washfile] =
  if ".wash" `isSuffixOf` washfile 
  then
     preprocess flags washfile (take (length washfile - 5) washfile ++ ".hs") ""
  else
  preprocess flags
             (washfile ++ ".wash")
	     (washfile ++ ".hs")
	     ""
runPreprocessor flags [washfile, hsfile] =
  preprocess flags (washfile) (hsfile) ""
runPreprocessor flags [originalFile, washfile, hsfile] =
  preprocess flags (washfile) (hsfile) ""
runPreprocessor flags [] =
  preprocessPIPE flags "<stdin>" stdin stdout ""
runPreprocessor flags args =
  do progName <- getProgName
     hPutStrLn stderr ("Usage: " ++ progName ++ " washfile [hsfile]")
     hPutStrLn stderr ("   or: " ++ progName ++ " originalFile infile outfile")
     hPutStrLn stderr ("   or: " ++ progName)
     hPutStrLn stderr ("       to run as pipe processor")
     hPutStrLn stderr ("Actual arguments: " ++ show args)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.