X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=9d6f6a17d9e7df8ec2a8b9afaba1c9b385226ba8;hb=2ba5597f143dd581027ac4903b49d8cdd1cc25f2;hp=fd7f5422120a1069008c2e3f2a63826af3d35c78;hpb=13033b5e3aa42995b75bac9d272fbb590a84c7ac;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index fd7f542..9d6f6a1 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.1 2000/11/16 10:48:22 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.87 2001/08/15 14:41:49 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -7,166 +7,869 @@ -- ----------------------------------------------------------------------------- -module InteractiveUI where +{-# OPTIONS -#include "Linker.h" #-} +{-# OPTIONS -#include "SchedAPI.h" #-} +module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +#include "../includes/config.h" +#include "HsVersions.h" + +import Packages import CompManager -import Module -import Panic +import HscTypes ( GhciMode(..), TyThing(..) ) +import MkIface ( ifaceTyCls ) +import ByteCodeLink +import DriverFlags +import DriverState +import DriverUtil +import Linker +import Finder ( flushPackageCache ) import Util +import Id ( isDataConWrapId, idName ) +import Class ( className ) +import TyCon ( tyConName ) +import SrcLoc ( isGoodSrcLoc ) +import Name ( Name, isHomePackageName, nameSrcLoc ) +import Outputable +import CmdLineOpts ( DynFlag(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) +import Panic ( GhcException(..) ) +import Config + +#ifndef mingw32_TARGET_OS +import Posix +#endif -import Readline +import Exception +import Dynamic +#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS +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\ -\(| || || (| |) GHC Interactive, version 5.00 \n\ -\|| __ ||___|| || () For Haskell 98. \n\ -\|| |) ||---|| || || http://www.haskell.org/ghc \n\ -\|| || || || || (| Bug reports to: glasgow-haskell-bugs@haskell.org \n\ -\(|___|| || || (|__|) \\\\______________________________________________________\n" - -commands :: [(String, String -> GHCi ())] -commands = [ - ("cd", changeDirectory), - ("help", help), - ("?", help), - ("load", loadModule), - ("reload", reloadModule), - ("set", setOptions), - ("type", typeOfExpr), - ("quit", quit), - ("!", shellEscape) +\ ___ ___ _\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), + ("info", keepGoing info), + ("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 = "\ -\ evaluate \n\ -\ :cd change directory to \n\ -\ :help display this list of commands\n\ -\ :? display this list of commands\n\ -\ :load load a module (and it dependents)\n\ -\ :reload reload the current program\n\ -\ :set ... set options\n\ -\ :type show the type of \n\ -\ :quit exit GHCi\n\ -\ :! run the shell command \n\ +\ Commands available from the prompt:\n\ +\\ +\ evaluate/run \n\ +\ :add ... add module(s) to the current target set\n\ +\ :cd change directory to \n\ +\ :def define a command :\n\ +\ :help, :? display this list of commands\n\ +\ :info [ ...] display information about the given names\n\ +\ :load ... load module(s) and their dependents\n\ +\ :module set the context for expression evaluation to \n\ +\ :reload reload the current module set\n\ +\ :set