From 5ae62a561d08c762a84e6c0afd2e0520f772426a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 31 Mar 2000 04:13:27 +0000 Subject: [PATCH] [project @ 2000-03-31 04:13:27 by andy] Fixing a couple of problems with Quantified identifiers. (1) The string building routine for Qid's was not using the new abstraction for showing names. The old abstraction worked most of the time in the new system, so was only getting tickled sometimes. (2) Fixing the local module that top level expressions evaluate in. By importing quantified Prelude, this allows top level expressions like Prelude.take And a trivial Makefile change. --- ghc/interpreter/Makefile | 6 +++--- ghc/interpreter/hugs.c | 6 ++++-- ghc/interpreter/static.c | 16 +++++++++------- ghc/interpreter/storage.c | 21 +++++++++++---------- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ghc/interpreter/Makefile b/ghc/interpreter/Makefile index 84a7ea1..1881a5f 100644 --- a/ghc/interpreter/Makefile +++ b/ghc/interpreter/Makefile @@ -1,6 +1,6 @@ # --------------------------------------------------------------------------- # -# $Id: Makefile,v 1.28 2000/03/22 18:14:22 sewardj Exp $ # +# $Id: Makefile,v 1.29 2000/03/31 04:13:27 andy Exp $ # # --------------------------------------------------------------------------- # TOP = .. @@ -51,9 +51,9 @@ GHC_LIBS_NEEDED = $(GHC_RUNTIME_DIR)/libHSrts.a all :: parser.c $(GHC_LIBS_NEEDED) nHandle$(DYN_EXT) hugs ### EXTREMELY hacky -hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o \ +hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o \ ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o ../rts/Printer.o \ - ../rts/StgCRun.o ../rts/PrimOps.o + ../rts/StgCRun.o ../rts/PrimOps.o ../rts/libHSrts.a $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) \ -lbfd -liberty $(LIB_READLINE) $(LIB_DL) \ $(LIB_GMP) -lm diff --git a/ghc/interpreter/hugs.c b/ghc/interpreter/hugs.c index 16fabe2..8b5785c 100644 --- a/ghc/interpreter/hugs.c +++ b/ghc/interpreter/hugs.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: hugs.c,v $ - * $Revision: 1.51 $ - * $Date: 2000/03/30 12:04:13 $ + * $Revision: 1.52 $ + * $Date: 2000/03/31 04:13:27 $ * ------------------------------------------------------------------------*/ #include @@ -1682,6 +1682,8 @@ static Module allocEvalModule ( void ) module(evalMod).names = module(currentModule).names; module(evalMod).tycons = module(currentModule).tycons; module(evalMod).classes = module(currentModule).classes; + module(evalMod).qualImports + = singleton(pair(mkCon(textPrelude),modulePrelude)); return evalMod; } diff --git a/ghc/interpreter/static.c b/ghc/interpreter/static.c index e2cf438..8ee6aae 100644 --- a/ghc/interpreter/static.c +++ b/ghc/interpreter/static.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: static.c,v $ - * $Revision: 1.32 $ - * $Date: 2000/03/23 14:54:21 $ + * $Revision: 1.33 $ + * $Date: 2000/03/31 04:13:27 $ * ------------------------------------------------------------------------*/ #include "hugsbasictypes.h" @@ -470,10 +470,12 @@ Pair importSpec; { hidden = resolveImportList(m, snd(impList),FALSE); imports = resolveImportList(m, DOTDOT,FALSE); } else if (isPair(impList) && STAR == fst(impList)) { - List privileged; - imports = resolveImportList(m, DOTDOT, FALSE); - privileged = resolveImportList(m, snd(impList),TRUE); - imports = dupOnto(privileged,imports); + // Previously, I was forcing an import Prelude, + // but this precluded doing things like + // import Prelude hiding ( catch) + // so, for now, you need to put an explicit + // import Prelude if you use import privileged. + imports = resolveImportList(m, snd(impList),TRUE); } else { imports = resolveImportList(m, impList,FALSE); } @@ -4510,7 +4512,7 @@ Cell g; { /* expression */ static Cell local depExpr(line,e) /* find dependents of expression */ Int line; Cell e; { - // Printf( "\n\n"); print(e,100); Printf("\n"); + //Printf( "\n\n"); print(e,100); Printf("\n"); //printExp(stdout,e); switch (whatIs(e)) { diff --git a/ghc/interpreter/storage.c b/ghc/interpreter/storage.c index 01fa014..ee0363b 100644 --- a/ghc/interpreter/storage.c +++ b/ghc/interpreter/storage.c @@ -9,8 +9,8 @@ * included in the distribution. * * $RCSfile: storage.c,v $ - * $Revision: 1.56 $ - * $Date: 2000/03/30 09:02:12 $ + * $Revision: 1.57 $ + * $Date: 2000/03/31 04:13:27 $ * ------------------------------------------------------------------------*/ #include "hugsbasictypes.h" @@ -107,17 +107,18 @@ Cell v; { case CONIDCELL : case CONOPCELL : return text+textOf(v); - case QUALIDENT : { Text pos = textHw; - Text t = qmodOf(v); - while (pos+1 < savedText && text[t]!=0) { - text[pos++] = text[t++]; + case QUALIDENT : { String qmod = textToStr(qmodOf(v)); + String qtext = textToStr(qtextOf(v)); + Text pos = textHw; + + while (pos+1 < savedText && *qmod!=0) { + text[pos++] = *qmod++; } if (pos+1 < savedText) { text[pos++] = '.'; } - t = qtextOf(v); - while (pos+1 < savedText && text[t]!=0) { - text[pos++] = text[t++]; + while (pos+1 < savedText && *qtext!=0) { + text[pos++] = *qtext++; } text[pos] = '\0'; return text+textHw; @@ -1717,7 +1718,7 @@ Void setCurrModule(m) /* set lookup tables for current module */ Module m; { Int i; assert(isModule(m)); - /* fprintf(stderr, "SET CURR MODULE %s\n", textToStr(module(m).text));*/ + /* fprintf(stderr, "SET CURR MODULE %s %d\n", textToStr(module(m).text),m);*/ {List t; for (t = module(m).names; nonNull(t); t=tl(t)) assert(isName(hd(t))); -- 1.7.10.4