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 309, Wed Jun 2 03:21:57 1999 UTC revision 310, Wed Jun 2 07:28:27 1999 UTC
# Line 29  Line 29 
29          -> info          -> info
30    
31      val sourcepath : info -> AbsPath.t      val sourcepath : info -> AbsPath.t
32        val skelpath : info -> AbsPath.t
33        val binpath : info -> AbsPath.t
34      val error : GeneralParams.info -> info -> complainer      val error : GeneralParams.info -> info -> complainer
35    
36      val parsetree : GeneralParams.info -> info -> (ast * source) option      val parsetree : GeneralParams.info -> info -> (ast * source) option
# Line 73  Line 75 
75    
76      datatype info =      datatype info =
77          INFO of { sourcepath: AbsPath.t,          INFO of { sourcepath: AbsPath.t,
78                      skelpath: AbsPath.t,
79                      binpath: AbsPath.t,
80                    persinfo: persinfo,                    persinfo: persinfo,
81                    share: bool option }                    share: bool option }
82    
83      type ord_key = info      type ord_key = info
84    
85      fun sourcepath (INFO { sourcepath = sp, ... }) = sp      fun sourcepath (INFO { sourcepath = sp, ... }) = sp
86        fun skelpath (INFO { skelpath = sp, ... }) = sp
87        fun binpath (INFO { binpath = bp, ... }) = bp
88      fun share (INFO { share = s, ... }) = s      fun share (INFO { share = s, ... }) = s
89    
90      fun gerror (gp: GeneralParams.info) = GroupReg.error (#groupreg gp)      fun gerror (gp: GeneralParams.info) = GroupReg.error (#groupreg gp)
# Line 118  Line 124 
124    
125      fun info (gp: GeneralParams.info) arg = let      fun info (gp: GeneralParams.info) arg = let
126          val { sourcepath, group = gr as (group, region), share } = arg          val { sourcepath, group = gr as (group, region), share } = arg
127            val policy = #fnpolicy (#param gp)
128            val skelpath = FNP.mkSkelPath policy sourcepath
129            val binpath = FNP.mkBinPath policy sourcepath
130          val groupreg = #groupreg gp          val groupreg = #groupreg gp
131          fun newpersinfo () = let          fun newpersinfo () = let
132              val pi = PERS { group = gr, lastseen = ref TStamp.NOTSTAMP,              val pi = PERS { group = gr, lastseen = ref TStamp.NOTSTAMP,
# Line 146  Line 155 
155                      else pi                      else pi
156      in      in
157          INFO { sourcepath = sourcepath,          INFO { sourcepath = sourcepath,
158                   skelpath = skelpath,
159                   binpath = binpath,
160                 persinfo = persinfo (),                 persinfo = persinfo (),
161                 share = share }                 share = share }
162      end      end
# Line 154  Line 165 
165      fun validate (INFO ir) = let      fun validate (INFO ir) = let
166          (* don't use "..." pattern to have the compiler catch later          (* don't use "..." pattern to have the compiler catch later
167           * additions to the type! *)           * additions to the type! *)
168          val { sourcepath, persinfo = PERS pir, share } = ir          val { sourcepath, skelpath, binpath, persinfo = PERS pir, share } = ir
169          val { group, lastseen, parsetree, skeleton } = pir          val { group, lastseen, parsetree, skeleton } = pir
170          val ts = !lastseen          val ts = !lastseen
171          val nts = AbsPath.tstamp sourcepath          val nts = AbsPath.tstamp sourcepath
# Line 179  Line 190 
190            | NONE => let            | NONE => let
191                  val stream = AbsPath.openTextIn sourcepath                  val stream = AbsPath.openTextIn sourcepath
192                  val _ = if noerrors orelse quiet then ()                  val _ = if noerrors orelse quiet then ()
193                          else Say.vsay (concat ["[parsing ", name, "]\n"])                          else Say.vsay ["[parsing ", name, "]\n"]
194                  val source =                  val source =
195                      Source.newSource (name, 1, stream, false, #errcons gp)                      Source.newSource (name, 1, stream, false, #errcons gp)
196                  val pto = let                  val pto = let
# Line 199  Line 210 
210      end      end
211    
212      fun getSkeleton gp (i as INFO ir, noerrors) = let      fun getSkeleton gp (i as INFO ir, noerrors) = let
213          val { sourcepath, persinfo = PERS pir, ... } = ir          val { sourcepath, skelpath, persinfo = PERS pir, ... } = ir
214          val { skeleton, lastseen, ... } = pir          val { skeleton, lastseen, ... } = pir
215      in      in
216          case !skeleton of          case !skeleton of
217              SOME sk => SOME sk              SOME sk => SOME sk
218            | NONE => let            | NONE =>
219                  val policy = #fnpolicy (#param gp)                  (case SkelIO.read (skelpath, !lastseen) of
                 val skelpath = FNP.mkSkelPath policy sourcepath  
             in  
                 case SkelIO.read (skelpath, !lastseen) of  
220                      SOME sk => (skeleton := SOME sk; SOME sk)                      SOME sk => (skeleton := SOME sk; SOME sk)
221                    | NONE =>                    | NONE =>
222                          (case getParseTree gp (i, false, noerrors) of                          (case getParseTree gp (i, false, noerrors) of
# Line 217  Line 225 
225                                       EM.error source region sv s                                       EM.error source region sv s
226                                           EM.nullErrorBody                                           EM.nullErrorBody
227                                   val { skeleton = sk, complain } =                                   val { skeleton = sk, complain } =
228                                       SkelCvt.convert { tree = tree, err = err }                                        SkelCvt.convert { tree = tree,
229                                                            err = err }
230                               in                               in
231                                   if noerrors then () else complain ();                                   if noerrors then () else complain ();
232                                   if EM.anyErrors (EM.errors source) then                                   if EM.anyErrors (EM.errors source) then
# Line 229  Line 238 
238                                         skeleton := SOME sk);                                         skeleton := SOME sk);
239                                   SOME sk                                   SOME sk
240                               end                               end
241                             | NONE => NONE)                              | NONE => NONE))
             end  
242      end      end
243    
244      (* first check the time stamp, then do your stuff... *)      (* first check the time stamp, then do your stuff... *)

Legend:
Removed from v.309  
changed lines
  Added in v.310

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