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 282, Wed May 19 05:14:03 1999 UTC revision 283, Wed May 19 08:20:58 1999 UTC
# Line 14  Line 14 
14    
15      type group      type group
16    
17      type perms      type privileges
18      type permspec      type privilegespec
19      type aexp      type aexp
20      type exp      type exp
21      type members                        (* still conditional *)      type members                        (* still conditional *)
# Line 33  Line 33 
33      val ml_funsig : string -> ml_symbol      val ml_funsig : string -> ml_symbol
34    
35      (* getting the full analysis for a group/library *)      (* getting the full analysis for a group/library *)
36      val emptyGroup : group      val emptyGroup : pathname -> group
37      val group : permspec * exports option * members -> group      val group :
38      val library : permspec * exports * members -> group          pathname * privilegespec * exports option * members * complainer
39            -> group
40      (* assembling permission lists *)      val library :
41      val initialPermSpec : permspec          pathname * privilegespec * exports * members * complainer
42      val require : permspec * cm_symbol * complainer -> permspec          -> group
43      val grant : permspec * cm_symbol * complainer -> permspec  
44        (* assembling privilege lists *)
45        val initialPrivilegeSpec : privilegespec
46        val require : privilegespec * cm_symbol * complainer -> privilegespec
47        val grant : privilegespec * cm_symbol * complainer -> privilegespec
48    
49      (* constructing member collections *)      (* constructing member collections *)
50      val emptyMembers : members      val emptyMembers : members
# Line 96  Line 100 
100      type ml_symbol = Symbol.symbol      type ml_symbol = Symbol.symbol
101      type cm_symbol = string      type cm_symbol = string
102    
103      type group = Dummy.t      type privileges = StringSet.set
104        type privilegespec = { required : privileges, granted : privileges }
105    
106      type environment = MemberCollection.collection      datatype group =
107            GROUP of { exports: DependencyGraph.impexp SymbolMap.map,
108                       islib: bool,
109                       privileges: privilegespec,
110                       grouppath: AbsPath.t }
111    
112      type perms = StringSet.set      type environment = MemberCollection.collection
     type permspec = { required : perms, granted : perms }  
113    
114      type aexp = environment -> int      type aexp = environment -> int
115      type exp = environment -> bool      type exp = environment -> bool
# Line 126  Line 134 
134    
135      fun applyTo mc e = e mc      fun applyTo mc e = e mc
136    
137      val emptyGroup = Dummy.v      fun emptyGroup path =
138            GROUP { exports = SymbolMap.empty,
139                    islib = false,
140                    privileges = { required = StringSet.empty,
141                                   granted = StringSet.empty },
142                    grouppath = path }
143    
144    
145      fun group (p: permspec, e: exports option, m) = let      fun group (g, p, e, m, error) = let
146          val mc = applyTo MemberCollection.empty m          val mc = applyTo MemberCollection.empty m
147          val exports = Option.map (applyTo mc) e          val filter = Option.map (applyTo mc) e
148            val exports = MemberCollection.build (mc, filter, error)
149      in      in
150          ignore (MemberCollection.build mc);          GROUP { exports = exports, islib = false,
151          Dummy.v                  privileges = p, grouppath = g }
152      end      end
153    
154      fun library (p: permspec, e: exports, m) = let      fun library (g, p, e, m, error) = let
155          val mc = applyTo MemberCollection.empty m          val mc = applyTo MemberCollection.empty m
156          val exports = applyTo mc e          val filter = applyTo mc e
157            val exports = MemberCollection.build (mc, SOME filter, error)
158      in      in
159          ignore (MemberCollection.build mc);          GROUP { exports = exports, islib = true,
160          Dummy.v                  privileges = p, grouppath = g }
161      end      end
162    
163      local      local
164          val isMember = StringSet.member          val isMember = StringSet.member
165          fun sanity ({ required, granted }, s, error) =          fun sanity ({ required, granted }, s, error) =
166              if isMember (required, s) orelse isMember (granted, s) then              if isMember (required, s) orelse isMember (granted, s) then
167                  error ("duplicate permission name: " ^ s)                  error ("duplicate privilege name: " ^ s)
168              else ()              else ()
169      in      in
170          val initialPermSpec = { required = StringSet.empty,          val initialPrivilegeSpec = { required = StringSet.empty,
171                               granted = StringSet.empty }                               granted = StringSet.empty }
172          fun require (a as ({ required, granted }, s, _)) =          fun require (a as ({ required, granted }, s, _)) =
173              (sanity a;              (sanity a;
# Line 162  Line 178 
178      end      end
179    
180      (* get the export map from a group *)      (* get the export map from a group *)
181      fun getExports (g: group) = (ignore Dummy.v; SymbolMap.empty)      fun getExports (GROUP { exports, islib, ... }) =
182            { imports = exports,
183              gimports = if islib then SymbolMap.empty else exports }
184    
185      fun emptyMembers env = env      fun emptyMembers env = env
186      fun member rparse arg env = let      fun member rparse arg env = let

Legend:
Removed from v.282  
changed lines
  Added in v.283

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