[project @ 2000-03-31 04:13:27 by andy]
authorandy <unknown>
Fri, 31 Mar 2000 04:13:27 +0000 (04:13 +0000)
committerandy <unknown>
Fri, 31 Mar 2000 04:13:27 +0000 (04:13 +0000)
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
ghc/interpreter/hugs.c
ghc/interpreter/static.c
ghc/interpreter/storage.c

index 84a7ea1..1881a5f 100644 (file)
@@ -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
index 16fabe2..8b5785c 100644 (file)
@@ -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 <setjmp.h>
@@ -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;
 }
 
index e2cf438..8ee6aae 100644 (file)
@@ -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)) {
 
index 01fa014..ee0363b 100644 (file)
@@ -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)));