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 277, Mon May 17 09:13:26 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 * 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 89  Line 93 
93    
94  structure CMSemant :> CM_SEMANT = struct  structure CMSemant :> CM_SEMANT = struct
95    
     structure Symbol = GenericVC.Symbol  
96      structure SymPath = GenericVC.SymPath      structure SymPath = GenericVC.SymPath
97    
98      type pathname = AbsPath.t      type pathname = AbsPath.t
# Line 97  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 125  Line 132 
132      val ml_functor = Symbol.fctSymbol      val ml_functor = Symbol.fctSymbol
133      val ml_funsig = Symbol.fsigSymbol      val ml_funsig = Symbol.fsigSymbol
134    
135      val emptyGroup = Dummy.v      fun applyTo mc e = e mc
136      fun group (p: permspec, e: exports, m: members) =  
137          (ignore (m MemberCollection.empty);      fun emptyGroup path =
138           Dummy.v)          GROUP { exports = SymbolMap.empty,
139      fun library (p: permspec, e: exports, m: members) =                  islib = false,
140          (ignore (m MemberCollection.empty);                  privileges = { required = StringSet.empty,
141           Dummy.v)                                 granted = StringSet.empty },
142                    grouppath = path }
143    
144    
145        fun group (g, p, e, m, error) = let
146            val mc = applyTo MemberCollection.empty m
147            val filter = Option.map (applyTo mc) e
148            val exports = MemberCollection.build (mc, filter, error)
149        in
150            GROUP { exports = exports, islib = false,
151                    privileges = p, grouppath = g }
152        end
153    
154        fun library (g, p, e, m, error) = let
155            val mc = applyTo MemberCollection.empty m
156            val filter = applyTo mc e
157            val exports = MemberCollection.build (mc, SOME filter, error)
158        in
159            GROUP { exports = exports, islib = true,
160                    privileges = p, grouppath = g }
161        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 151  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.277  
changed lines
  Added in v.283

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