----------------------------------------------------------------------------- -- $Id: InteractiveUI.hs,v 1.54 2001/03/12 14:06:46 simonpj Exp $ -- -- GHC Interactive User Interface -- -- (c) The GHC Team 2000 -- ----------------------------------------------------------------------------- {-# OPTIONS -#include "Linker.h" #-} module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where #include "HsVersions.h" import CompManager import CmStaticInfo import ByteCodeLink import DriverFlags import DriverState import DriverUtil import Linker import Util import Name ( Name ) import Outputable import Panic ( GhcException(..) ) import Config import Exception import Dynamic #ifndef NO_READLINE import Readline #endif import IOExts import Numeric import List import System import CPUTime import Directory import IO import Char import Monad ( when ) import PrelGHC ( unsafeCoerce# ) import Foreign ( nullPtr ) import CString ( peekCString ) ----------------------------------------------------------------------------- ghciWelcomeMsg = "\ \ ___ ___ _\n\ \ / _ \\ /\\ /\\/ __(_)\n\ \ / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", For Haskell 98.\n\ \/ /_\\\\/ __ / /___| | http://www.haskell.org/ghc/\n\ \\\____/\\/ /_/\\____/|_| Type :? for help.\n" GLOBAL_VAR(commands, builtin_commands, [(String, String -> GHCi Bool)]) builtin_commands :: [(String, String -> GHCi Bool)] builtin_commands = [ ("add", keepGoing addModule), ("cd", keepGoing changeDirectory), ("def", keepGoing defineMacro), ("help", keepGoing help), ("?", keepGoing help), ("load", keepGoing loadModule), ("module", keepGoing setContext), ("reload", keepGoing reloadModule), ("set", keepGoing setOptions), ("type", keepGoing typeOfExpr), ("unset", keepGoing unsetOptions), ("undef", keepGoing undefineMacro), ("quit", quit) ] keepGoing :: (String -> GHCi ()) -> (String -> GHCi Bool) keepGoing a str = a str >> return False shortHelpText = "use :? for help.\n" helpText = "\ \ Commands available from the prompt:\n\ \\ \ evaluate/run \n\ \ :add add a module to the current set\n\ \ :cd change directory to \n\ \ :help, :? display this list of commands\n\ \ :load load a module (and it dependents)\n\ \ :module set the context for expression evaluation to \n\ \ :reload reload the current module set\n\ \ :set