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/smlfile/smlinfo.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/smlfile/smlinfo.sml

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

revision 300, Thu May 27 22:01:36 1999 UTC revision 301, Fri May 28 09:43:39 1999 UTC
# Line 31  Line 31 
31      val error : GeneralParams.info -> info -> complainer      val error : GeneralParams.info -> info -> complainer
32    
33      val parsetree : GeneralParams.info -> info -> (ast * source) option      val parsetree : GeneralParams.info -> info -> (ast * source) option
34      val exports : GeneralParams.info -> info  -> SymbolSet.set      val exports : GeneralParams.info -> info  -> SymbolSet.set option
35      val skeleton : GeneralParams.info -> info -> Skeleton.decl      val skeleton : GeneralParams.info -> info -> Skeleton.decl option
36      val share : info -> bool option      val share : info -> bool option
37        val lastseen : info -> TStamp.t
38    
39        (* forget a parse tree that we are done with *)
40        val forgetParsetree : info -> unit
41    
42        (* evict all but the reachable nodes in the cache *)
43        val forgetAllBut : AbsPathSet.set -> unit
44    
45      (* different ways of describing an sml file using group and source *)      (* different ways of describing an sml file using group and source *)
46      val spec : info -> string           (* sspec *)      val spec : info -> string           (* sspec *)
# Line 79  Line 86 
86          AbsPath.compare (p, p')          AbsPath.compare (p, p')
87      fun eq (i, i') = compare (i, i') = EQUAL      fun eq (i, i') = compare (i, i') = EQUAL
88    
89        fun lastseen (INFO { persinfo = PERS { lastseen, ... }, ... }) =
90            !lastseen
91    
92      (* If files change their file ids, then CM will be seriously      (* If files change their file ids, then CM will be seriously
93       * disturbed because the ordering relation will change.       * disturbed because the ordering relation will change.
94       * We'll asume that this won't happen in general.  However, we provide       * We'll asume that this won't happen in general.  However, we provide
# Line 93  Line 103 
103          knownInfo := foldl AbsPathMap.insert' AbsPathMap.empty l          knownInfo := foldl AbsPathMap.insert' AbsPathMap.empty l
104      end      end
105    
106        fun forgetParsetree (INFO { persinfo = PERS { parsetree, ... }, ... }) =
107            parsetree := NONE
108    
109        fun forgetAllBut reachable = let
110            val m0 = !knownInfo
111            fun retain (p, m) =
112                case AbsPathMap.find (m0, p) of
113                    NONE => m
114                  | SOME pi => AbsPathMap.insert (m, p, pi)
115        in
116            knownInfo := AbsPathSet.foldl retain AbsPathMap.empty reachable
117        end
118    
119      fun info (gp: GeneralParams.info) arg = let      fun info (gp: GeneralParams.info) arg = let
120          val { sourcepath, group = gr as (group, region), share } = arg          val { sourcepath, group = gr as (group, region), share } = arg
121          val groupreg = #groupreg gp          val groupreg = #groupreg gp
# Line 183  Line 206 
206          val { skeleton, lastseen, ... } = pir          val { skeleton, lastseen, ... } = pir
207      in      in
208          case !skeleton of          case !skeleton of
209              SOME sk => sk              SOME sk => SOME sk
210            | NONE => let            | NONE => let
211                  val policy = #fnpolicy (#param gp)                  val policy = #fnpolicy (#param gp)
212                  val skelpath = FNP.mkSkelPath policy sourcepath                  val skelpath = FNP.mkSkelPath policy sourcepath
213              in              in
214                  case SkelIO.read (skelpath, !lastseen) of                  case SkelIO.read (skelpath, !lastseen) of
215                      SOME sk => (skeleton := SOME sk; sk)                      SOME sk => (skeleton := SOME sk; SOME sk)
216                    | NONE =>                    | NONE =>
217                          (case getParseTree gp (i, false, noerrors) of                          (case getParseTree gp (i, false, noerrors) of
218                               SOME (tree, source) => let                               SOME (tree, source) => let
# Line 207  Line 230 
230                                             EM.nullErrorBody                                             EM.nullErrorBody
231                                   else (SkelIO.write (skelpath, sk);                                   else (SkelIO.write (skelpath, sk);
232                                         skeleton := SOME sk);                                         skeleton := SOME sk);
233                                   sk                                   SOME sk
234                               end                               end
235                             | NONE => Skeleton.Ref SymbolSet.empty)                             | NONE => NONE)
236              end              end
237      end      end
238    
# Line 217  Line 240 
240      fun skeleton0 noerrors gp i = (validate i; getSkeleton gp (i, noerrors))      fun skeleton0 noerrors gp i = (validate i; getSkeleton gp (i, noerrors))
241    
242      (* we only complain at the time of getting the exports *)      (* we only complain at the time of getting the exports *)
243      fun exports gp i = SkelExports.exports (skeleton0 false gp i)      fun exports gp i = Option.map SkelExports.exports (skeleton0 false gp i)
244      val skeleton = skeleton0 true      val skeleton = skeleton0 true
245    
246      fun parsetree gp i = getParseTree gp (i, true, true)      fun parsetree gp i =
247            (validate i;
248             getParseTree gp (i, true, true))
249    
250      fun spec (INFO { sourcepath, ... }) = AbsPath.spec sourcepath      fun spec (INFO { sourcepath, ... }) = AbsPath.spec sourcepath
251      fun fullSpec (INFO { sourcepath, persinfo = PERS { group, ... }, ... }) =      fun fullSpec (INFO { sourcepath, persinfo = PERS { group, ... }, ... }) =

Legend:
Removed from v.300  
changed lines
  Added in v.301

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