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 294, Tue May 25 09:06:06 1999 UTC
# Line 12  Line 12 
12      type ml_symbol      type ml_symbol
13      type cm_symbol      type cm_symbol
14    
15      type group      type group = GroupGraph.group
16    
17      type perms      type privilegespec = GroupGraph.privilegespec
     type permspec  
18      type aexp      type aexp
19      type exp      type exp
20      type members                        (* still conditional *)      type members                        (* still conditional *)
# Line 33  Line 32 
32      val ml_funsig : string -> ml_symbol      val ml_funsig : string -> ml_symbol
33    
34      (* getting the full analysis for a group/library *)      (* getting the full analysis for a group/library *)
35      val emptyGroup : group      val emptyGroup : pathname -> group
36      val group : permspec * exports * members -> group      val group :
37      val library : permspec * exports * members -> group          pathname * privilegespec * exports option * members * complainer
38            -> group
39      (* assembling permission lists *)      val library :
40      val initialPermSpec : permspec          pathname * privilegespec * exports * members * complainer
41      val require : permspec * cm_symbol * complainer -> permspec          -> group
42      val grant : permspec * cm_symbol * complainer -> permspec  
43        (* assembling privilege lists *)
44        val initialPrivilegeSpec : privilegespec
45        val require : privilegespec * cm_symbol * complainer -> privilegespec
46        val grant : privilegespec * cm_symbol * complainer -> privilegespec
47    
48      (* constructing member collections *)      (* constructing member collections *)
49      val emptyMembers : members      val emptyMembers : members
50      val member : (pathname -> group)      val member : GeneralParams.params * (pathname -> group)
51          -> { sourcepath: pathname, group: pathname, class: cm_symbol option,          -> { sourcepath: pathname, group: pathname, class: cm_symbol option,
52               error: string -> (PrettyPrint.ppstream -> unit) -> unit }               error: GenericVC.ErrorMsg.complainer }
53          -> members          -> members
54      val members : members * members -> members      val members : members * members -> members
55      val guarded_members :      val guarded_members :
# Line 89  Line 92 
92    
93  structure CMSemant :> CM_SEMANT = struct  structure CMSemant :> CM_SEMANT = struct
94    
     structure Symbol = GenericVC.Symbol  
95      structure SymPath = GenericVC.SymPath      structure SymPath = GenericVC.SymPath
96        structure EM = GenericVC.ErrorMsg
97        structure GG = GroupGraph
98    
99      type pathname = AbsPath.t      type pathname = AbsPath.t
100      type context = AbsPath.context      type context = AbsPath.context
101      type ml_symbol = Symbol.symbol      type ml_symbol = Symbol.symbol
102      type cm_symbol = string      type cm_symbol = string
103    
104      type group = Dummy.t      type group = GG.group
105        type privilegespec = GG.privilegespec
106    
107      type environment = MemberCollection.collection      type environment = MemberCollection.collection
108    
     type perms = StringSet.set  
     type permspec = { required : perms, granted : perms }  
   
109      type aexp = environment -> int      type aexp = environment -> int
110      type exp = environment -> bool      type exp = environment -> bool
111      type members = environment -> MemberCollection.collection      type members = environment -> MemberCollection.collection
# Line 125  Line 127 
127      val ml_functor = Symbol.fctSymbol      val ml_functor = Symbol.fctSymbol
128      val ml_funsig = Symbol.fsigSymbol      val ml_funsig = Symbol.fsigSymbol
129    
130      val emptyGroup = Dummy.v      fun applyTo mc e = e mc
131      fun group (p: permspec, e: exports, m: members) =  
132          (ignore (m MemberCollection.empty);      fun emptyGroup path =
133           Dummy.v)          GG.GROUP { exports = SymbolMap.empty,
134      fun library (p: permspec, e: exports, m: members) =                     islib = false,
135          (ignore (m MemberCollection.empty);                     privileges = { required = StringSet.empty,
136           Dummy.v)                                    granted = StringSet.empty },
137                       grouppath = path,
138                       subgroups = [] }
139    
140    
141        fun group (g, p, e, m, error) = let
142            val mc = applyTo MemberCollection.empty m
143            val filter = Option.map (applyTo mc) e
144            val exports = MemberCollection.build (mc, filter, error)
145            val subgroups = MemberCollection.subgroups mc
146        in
147            GG.GROUP { exports = exports, islib = false,
148                       privileges = p, grouppath = g,
149                       subgroups = subgroups }
150        end
151    
152        fun library (g, p, e, m, error) = let
153            val mc = applyTo MemberCollection.empty m
154            val filter = applyTo mc e
155            val exports = MemberCollection.build (mc, SOME filter, error)
156            val subgroups = MemberCollection.subgroups mc
157        in
158            GG.GROUP { exports = exports, islib = true,
159                       privileges = p, grouppath = g,
160                       subgroups = subgroups }
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 150  Line 177 
177               { required = required, granted = StringSet.add (granted, s) })               { required = required, granted = StringSet.add (granted, s) })
178      end      end
179    
     (* get the export map from a group *)  
     fun getExports (g: group) = (ignore Dummy.v; SymbolMap.empty)  
   
180      fun emptyMembers env = env      fun emptyMembers env = env
181      fun member rparse arg env = let      fun member (params, rparse) arg env = let
182          val coll = MemberCollection.expandOne (getExports o rparse) arg          val coll = MemberCollection.expandOne (params, rparse) arg
183          val error = #error arg          val error = #error arg
184          fun e0 s = error s GenericVC.ErrorMsg.nullErrorBody          fun e0 s = error EM.COMPLAIN s EM.nullErrorBody
185      in      in
186          MemberCollection.sequential (env, coll, e0)          MemberCollection.sequential (env, coll, e0)
187      end      end

Legend:
Removed from v.277  
changed lines
  Added in v.294

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