X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=2bf39b5e89c5fe5dbf298beb5ce99186e3a509fc;hb=16d5d1c75c999677783c9c1bda519540fa9a6e58;hp=b2ec5c1e351e9211b958c0f9ccca45e7276ade17;hpb=67b9ddc822964b29ea177bde3c735702afcda667;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index b2ec5c1..2bf39b5 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.30 2001/01/19 15:26:37 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.74 2001/06/14 12:50:06 simonpj Exp $ -- -- GHC Interactive User Interface -- @@ -7,25 +7,35 @@ -- ----------------------------------------------------------------------------- -module InteractiveUI (interactiveUI) where +{-# OPTIONS -#include "Linker.h" #-} +module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +#include "../includes/config.h" #include "HsVersions.h" import CompManager import CmStaticInfo +import ByteCodeLink import DriverFlags import DriverState +import DriverUtil import Linker -import Finder -import Module -import Outputable +import Finder ( flushPackageCache ) import Util -import PprType {- instance Outputable Type; do not delete -} -import Panic ( GhcException(..) ) +import Name ( Name ) +import Outputable +import CmdLineOpts ( DynFlag(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) +import Panic ( GhcException(..) ) +import Config + +#ifndef mingw32_TARGET_OS +import Posix +#endif import Exception -#ifndef NO_READLINE -import Readline +import Dynamic +#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS +import Readline #endif import IOExts @@ -36,23 +46,28 @@ import CPUTime import Directory import IO import Char -import Monad ( when ) +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 Bool)] -commands = [ +\ ___ ___ _\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), @@ -61,6 +76,7 @@ commands = [ ("set", keepGoing setOptions), ("type", keepGoing typeOfExpr), ("unset", keepGoing unsetOptions), + ("undef", keepGoing undefineMacro), ("quit", quit) ] @@ -72,146 +88,259 @@ shortHelpText = "use :? for help.\n" helpText = "\ \ Commands available from the prompt:\n\ \\ -\ evaluate \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