Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/cm/semant/semant.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/semant/semant.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 572, Thu Mar 9 02:43:06 2000 UTC revision 573, Thu Mar 9 15:23:52 2000 UTC
# Line 146  Line 146 
146    
147      fun emptyGroup path =      fun emptyGroup path =
148          GG.GROUP { exports = SymbolMap.empty,          GG.GROUP { exports = SymbolMap.empty,
149                     kind = GG.NOLIB [],                     kind = GG.NOLIB { subgroups = [], owner = NONE },
150                     required = StringSet.empty,                     required = StringSet.empty,
151                     grouppath = path,                     grouppath = path,
152                     sublibs = [] }                     sublibs = [] }
# Line 163  Line 163 
163          foldl oneSG [] subgroups          foldl oneSG [] subgroups
164      end      end
165    
166      fun grouplib (islib, g, p, e, m, gp, curlib, init_group) = let      fun grouplib (isgroup, g, p, e, m, gp, curlib, init_group) = let
167          val mc = applyTo (MemberCollection.implicit init_group, curlib) m          val mc = applyTo (MemberCollection.implicit init_group, curlib) m
168          val filter = Option.map (applyTo mc) e          val filter = Option.map (applyTo mc) e
169          val pfsbn = let          val pfsbn = let
# Line 177  Line 177 
177          val rp'' = StringSet.union (rp', StringSet.union (rp, wr))          val rp'' = StringSet.union (rp', StringSet.union (rp, wr))
178      in      in
179          GG.GROUP { exports = exports,          GG.GROUP { exports = exports,
180                     kind = if islib then GG.LIB (wr, subgroups)                     kind = case isgroup of
181                            else (if StringSet.isEmpty wr then ()                                NONE => GG.LIB { wrapped = wr,
182                                                   subgroups = subgroups }
183                                | SOME owner =>
184                                  (if StringSet.isEmpty wr then ()
185                                  else EM.impossible                                  else EM.impossible
186                                      "group with wrapped privilege";                                      "group with wrapped privilege";
187                                  GG.NOLIB subgroups),                                          GG.NOLIB { subgroups = subgroups,
188                                                       owner = owner }),
189                     required = rp'',                     required = rp'',
190                     grouppath = g,                     grouppath = g,
191                     sublibs = sgl2sll subgroups }                     sublibs = sgl2sll subgroups }
192      end      end
193    
194      fun group (g, p, e, m, gp, curlib, owner, error, init_group) = let      fun group (g, p, e, m, gp, curlib, owner, error, init_group) =
195          fun libname NONE = "<toplevel>"          grouplib (SOME owner, g, p, e, m, gp, curlib, init_group)
           | libname (SOME p) = SrcPath.descr p  
         fun eq (NONE, NONE) = true  
           | eq (SOME p, SOME p') = SrcPath.compare (p, p') = EQUAL  
           | eq _ = false  
         fun checkowner () =  
             if eq (curlib, owner) then ()  
             else error (concat ["owner specified as ",  
                                 libname owner, " but found to be ",  
                                 libname curlib])  
     in  
         checkowner ();  
         grouplib (false, g, p, e, m, gp, curlib, init_group)  
     end  
196      fun library (g, p, e, m, gp, init_group) =      fun library (g, p, e, m, gp, init_group) =
197          grouplib (true, g, p, SOME e, m, gp, SOME g, init_group)          grouplib (NONE, g, p, SOME e, m, gp, SOME g, init_group)
198    
199      local      local
200          val isMember = StringSet.member          val isMember = StringSet.member
# Line 228  Line 219 
219          val group = #group arg          val group = #group arg
220          val error = GroupReg.error (#groupreg gp) group          val error = GroupReg.error (#groupreg gp) group
221          fun e0 s = error EM.COMPLAIN s EM.nullErrorBody          fun e0 s = error EM.COMPLAIN s EM.nullErrorBody
222            fun checkowner (_, GG.GROUP { kind = GG.NOLIB { owner, ... }, ...}) =
223                let fun libname NONE = "<toplevel>"
224                      | libname (SOME p) = SrcPath.descr p
225                    fun eq (NONE, NONE) = true
226                      | eq (SOME p, SOME p') = SrcPath.compare (p, p') = EQUAL
227                      | eq _ = false
228                in
229                    if eq (curlib, owner) then ()
230                    else e0 (concat ["owner of subgroup (",
231                                     libname owner,
232                                     ") does not match current library (",
233                                     libname curlib])
234                end
235              | checkowner _ = ()
236      in      in
237            app checkowner (MemberCollection.subgroups coll);
238          MemberCollection.sequential (env, coll, e0)          MemberCollection.sequential (env, coll, e0)
239      end      end
240      fun members (m1, m2) (env, curlib) = m2 (m1 (env, curlib), curlib)      fun members (m1, m2) (env, curlib) = m2 (m1 (env, curlib), curlib)

Legend:
Removed from v.572  
changed lines
  Added in v.573

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0