StdInterface.hs revision 56c56b2181e76c239929ddade2925ba5c3f3fffd
55cf6e01272ec475edea32aa9b7923de2d36cb42Christian Maeder{- |
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederModule : $Header$
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens ElknerDescription : The definition of standard input\/output interface
de6a40dbdd4712e5a9398b8519a59b1eaeab2f5aChristian MaederCopyright : uni-bremen and DFKI
64f00fb69046070dc033eb034cdd9afd22809a63Christian MaederLicence : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuMaintainer : r.pascanu@jacobs-university.de
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederStability : provisional
3f69b6948966979163bdfe8331c38833d5d90ecdChristian MaederPortability : portable
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederPGIP.StdInterface describes the interface specific function
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederfor standard input and file input
aac750d0dc6a7c8f2129d357a129894c9d042e90Christian Maeder-}
aac750d0dc6a7c8f2129d357a129894c9d042e90Christian Maeder
aac750d0dc6a7c8f2129d357a129894c9d042e90Christian Maedermodule PGIP.StdInterface
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder ( stdShellDescription
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder , basicOutput
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder , recursiveApplyUse
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder )where
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
a209694d7694b93e56927c6aacc3f5b9366fdb8fChristian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederimport System.Console.Shell
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederimport System.Console.Shell.Backend
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederimport System.IO
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederimport PGIP.DataTypes
a209694d7694b93e56927c6aacc3f5b9366fdb8fChristian Maederimport PGIP.Commands
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maederimport PGIP.DgCommands
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederstdShellDescription :: ShellDescription CMDL_State
4ef2a978e66e2246ff0b7f00c77deb7aabb28b8eChristian MaederstdShellDescription =
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder let wbc = "\n\r\v\\" in
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder initialShellDescription
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder { shellCommands = shellacCommands
616b72452ce5a75ade1a11ccc2c9671b3444558eChristian Maeder , commandStyle = OnlyCommands
616b72452ce5a75ade1a11ccc2c9671b3444558eChristian Maeder , evaluateFunc = shellacEvalFunc
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder , wordBreakChars = wbc
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder , prompt = \x -> return (prompter x)
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder , historyFile = Just ("consoleHistory.tmp")
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder }
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederbasicOutput :: BackendOutput -> IO ()
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederbasicOutput (RegularOutput out) = hPutStr stdout out
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroederbasicOutput (InfoOutput out) = hPutStr stdout out
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian MaederbasicOutput (ErrorOutput out) = hPutStr stderr out
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
ca5e921bbca4a90ad9adf7350bedcb7deb059e86Christian Maeder
bba825b39570777866d560bfde3807731131097eKlaus Luettich
bba825b39570777866d560bfde3807731131097eKlaus Luettich-- | Applies cUse to a list of input files
740670de3c457d7571ef6f3fe9b60c2e25fb9902Christian MaederrecursiveApplyUse::[String] -> CMDL_State -> IO CMDL_State
740670de3c457d7571ef6f3fe9b60c2e25fb9902Christian MaederrecursiveApplyUse ls state
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder = case ls of
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder [] -> return state
2018084d6189a68640c516ca3e340d879f40f0acChristian Maeder l:ll -> do
aa074a906c39b63c7177040378c0073dbac4e3baChristian Maeder nwState <- cUse l state
recursiveApplyUse ll nwState