[project @ 2000-04-06 00:36:12 by andy]
authorandy <unknown>
Thu, 6 Apr 2000 00:36:12 +0000 (00:36 +0000)
committerandy <unknown>
Thu, 6 Apr 2000 00:36:12 +0000 (00:36 +0000)
Removing the "import privileged" implementation from hugs.

ghc/interpreter/input.c
ghc/interpreter/parser.y
ghc/interpreter/static.c

index 555659a..6615e77 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: input.c,v $
- * $Revision: 1.26 $
- * $Date: 2000/04/06 00:01:26 $
+ * $Revision: 1.27 $
+ * $Date: 2000/04/06 00:36:12 $
  * ------------------------------------------------------------------------*/
 
 #include "hugsbasictypes.h"
@@ -165,7 +165,6 @@ static Cell varDot;                     /* (.)                             */
 static Cell varHiding;                  /* hiding                          */
 static Cell varQualified;               /* qualified                       */
 static Cell varAsMod;                   /* as                              */
-static Cell varPrivileged;              /* privileged                      */
 
 static List imps;                       /* List of imports to be chased    */
 
@@ -1520,7 +1519,6 @@ static Int local yylex() {             /* Read next input token ...        */
         if (it==textHiding)            return HIDING;
         if (it==textQualified)         return QUALIFIED;
         if (it==textAsMod)             return ASMOD;
-        if (it==textPrivileged)        return PRIVILEGED;
         if (it==textWildcard)          return '_';
         if (it==textAll && !haskell98) return ALL;
 #if IPARAM
@@ -1715,7 +1713,6 @@ Int what; {
                        textHiding     = findText("hiding");
                        textQualified  = findText("qualified");
                        textAsMod      = findText("as");
-                       textPrivileged = findText("privileged");
                        textWildcard   = findText("_");
                        textAll        = findText("forall");
                        textUUAll      = findText("__forall");
@@ -1727,7 +1724,6 @@ Int what; {
                        varHiding      = mkVar(textHiding);
                        varQualified   = mkVar(textQualified);
                        varAsMod       = mkVar(textAsMod);
-                       varPrivileged  = mkVar(textPrivileged);
                        conMain        = mkCon(findText("Main"));
                        varMain        = mkVar(findText("main"));
                        evalDefaults   = NIL;
@@ -1776,7 +1772,6 @@ Int what; {
                        mark(varHiding);
                        mark(varQualified);
                        mark(varAsMod);
-                       mark(varPrivileged);
                        mark(varMain);
                        mark(conMain);
                        mark(imps);
index 99900bf..a86b13c 100644 (file)
@@ -12,8 +12,8 @@
  * included in the distribution.
  *
  * $RCSfile: parser.y,v $
- * $Revision: 1.27 $
- * $Date: 2000/04/04 17:35:04 $
+ * $Revision: 1.28 $
+ * $Date: 2000/04/06 00:36:12 $
  * ------------------------------------------------------------------------*/
 
 %{
@@ -97,7 +97,6 @@ static Void   local noIP       ( String );
 %token EXPORT     UUEXPORT   INTERFACE  REQUIRES   UNSAFE     
 %token INSTIMPORT DYNAMIC    CCALL      STDKALL
 %token UTL        UTR        UUUSAGE
-%token PRIVILEGED
 
 %%
 /*- Top level script/module structure -------------------------------------*/
@@ -516,10 +515,6 @@ impDecl   : IMPORT modid impspec        {$$=gc3(doubleton(
                                         {$$=gc4(singleton(
                                                ap(M_IMPORT_Q,zpair($3,$3))
                                             ));}
-          | IMPORT PRIVILEGED modid '(' imports ')'
-                                       {$$=gc6(singleton(
-                                               ap(M_IMPORT_UNQ,
-                                                  zpair($3,ap(STAR,$5)))));}
           | IMPORT error                {syntaxError("import declaration");}
           ;
 impspec   : /* empty */                 {$$ = gc0(DOTDOT);}
@@ -1199,7 +1194,6 @@ varid     : VARID                       {$$ = $1;}
           | HIDING                      {$$ = gc1(varHiding);}
           | QUALIFIED                   {$$ = gc1(varQualified);}
           | ASMOD                       {$$ = gc1(varAsMod);}
-          | PRIVILEGED                  {$$ = gc1(varPrivileged);}
           ;
 qconid    : QCONID                      {$$ = $1;}
           | CONID                       {$$ = $1;}
@@ -1268,7 +1262,6 @@ varid1    : VARID                       {$$ = gc1($1);}
           | HIDING                      {$$ = gc1(varHiding);}
           | QUALIFIED                   {$$ = gc1(varQualified);}
           | ASMOD                       {$$ = gc1(varAsMod);}
-          | PRIVILEGED                  {$$ = gc1(varPrivileged);}
           ;
 
 /*- Tricks to force insertion of leading and closing braces ---------------*/
@@ -1413,7 +1406,6 @@ static String local unexpected() {     /* find name for unexpected token   */
                          return buffer;
         case HIDING    : return "symbol \"hiding\"";
         case QUALIFIED : return "symbol \"qualified\"";
-       case PRIVILEGED : return "symbol \"privileged\"";
         case ASMOD     : return "symbol \"as\"";
         case NUMLIT    : return "numeric literal";
         case CHARLIT   : return "character literal";
index 3dc5133..5859e84 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: static.c,v $
- * $Revision: 1.38 $
- * $Date: 2000/04/06 00:01:27 $
+ * $Revision: 1.39 $
+ * $Date: 2000/04/06 00:36:12 $
  * ------------------------------------------------------------------------*/
 
 #include "hugsbasictypes.h"
@@ -31,8 +31,8 @@ static List   local checkSubentities    ( List,List,List,String,Text );
 static List   local checkExportTycon    ( List,Text,Cell,Tycon );
 static List   local checkExportClass    ( List,Text,Cell,Class );
 static List   local checkExport         ( List,Text,Cell );
-static List   local checkImportEntity   ( List,Module,Bool,Cell );
-static List   local resolveImportList   ( Module,Cell,Bool );
+static List   local checkImportEntity   ( List,Module,Cell );
+static List   local resolveImportList   ( Module,Cell );
 static Void   local checkImportList     ( Pair );
 
 static Void   local importEntity        ( Module,Cell );
@@ -334,21 +334,14 @@ Text   textParent; {
     return imports;
 }
 
-static List local checkImportEntity(imports,exporter,priv,entity)
+static List local checkImportEntity(imports,exporter,entity)
 List   imports; /* Accumulated list of things to import */
 Module exporter;
-Bool priv;
 Cell entity; { /* Entry from import list */
     List oldImports = imports;
     Text t  = isIdent(entity) ? textOf(entity) : textOf(fst(entity));
     List es = NIL;
-    if (priv) {
-      es = module(exporter).names;
-      es = dupOnto(module(exporter).tycons,es);
-      es = dupOnto(module(exporter).classes,es);
-    } else {
-      es = module(exporter).exports; 
-    }
+    es = module(exporter).exports; 
 
     for(; nonNull(es); es=tl(es)) {
         Cell e = hd(es); /* :: Entity
@@ -398,18 +391,6 @@ Cell entity; { /* Entry from import list */
             if (isIdent(entity) && name(e).text == t) {
                 imports = cons(e,imports);
             }
-        } else if (isTycon(e) && priv) {
-           if (tycon(e).text == t) {
-               imports = cons(e,imports);
-               return dupOnto(tycon(e).defn,imports);
-           }
-        } else if (isClass(e) && priv) {
-           if (cclass(e).text == t) {
-               imports = cons(e,imports);
-               return dupOnto(cclass(e).members,imports);
-           }
-        } else if (whatIs(e) == TUPLE && priv) {
-         // do nothing
         } else {
             internal("checkImportEntity3");
         }
@@ -423,10 +404,9 @@ Cell entity; { /* Entry from import list */
     return imports;
 }
 
-static List local resolveImportList(m,impList,priv)
+static List local resolveImportList(m,impList)
 Module m;  /* exporting module */
-Cell impList; 
-Bool priv; {
+Cell impList; {
     List imports = NIL;
     if (DOTDOT == impList) {
         List es = module(m).exports;
@@ -450,7 +430,7 @@ Bool priv; {
             }
         }
     } else {
-        map2Accum(checkImportEntity,imports,m,priv,impList);
+        map1Accum(checkImportEntity,imports,m,impList);
     }
     return imports;
 }
@@ -467,17 +447,10 @@ Pair importSpec; {
         /* Somewhat inefficient - but obviously correct:
          * imports = importsOf("module Foo") `setDifference` hidden;
          */
-        hidden  = resolveImportList(m, snd(impList),FALSE);
-        imports = resolveImportList(m, DOTDOT,FALSE);
-    } else if (isPair(impList) && STAR == fst(impList)) {
-       // 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);
+        hidden  = resolveImportList(m, snd(impList));
+        imports = resolveImportList(m, DOTDOT);
     } else {
-        imports = resolveImportList(m, impList,FALSE);
+        imports = resolveImportList(m, impList);
     }
 
     for(; nonNull(imports); imports=tl(imports)) {