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/stable/verify.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/stable/verify.sml

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

revision 537, Fri Feb 18 17:20:16 2000 UTC revision 632, Sat Apr 29 15:50:42 2000 UTC
# Line 11  Line 11 
11   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)   * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
12   *)   *)
13  local  local
14        structure DG = DependencyGraph
15      structure GG = GroupGraph      structure GG = GroupGraph
16      structure GP = GeneralParams      structure GP = GeneralParams
17      structure TS = TStamp      structure TS = TStamp
18  in  in
19  signature VERIFY_STABLE = sig  signature VERIFY_STABLE = sig
20      val verify : GP.info -> GG.group -> bool      type exportmap = SmlInfo.info StableMap.map
21        val verify' : GP.info -> exportmap
22            -> SrcPath.t *                  (* grouppath *)
23               DG.sbnode list *             (* export_nodes *)
24               (SrcPath.t * GG.group) list * (* sublibs *)
25               SrcPathSet.set *             (* groups *)
26               Version.t option
27            -> bool
28        val verify : GP.info -> exportmap -> GG.group -> bool
29  end  end
30    
31  structure VerifyStable :> VERIFY_STABLE = struct  functor VerStabFn (structure Stabilize: STABILIZE) :> VERIFY_STABLE = struct
32      fun verify (gp: GP.info) g = let  
33        type exportmap = SmlInfo.info StableMap.map
34    
35        fun verify' (gp: GP.info) em args = let
36            val (grouppath, export_nodes, sublibs, groups, version) = args
37            val groups = SrcPathSet.add (groups, grouppath)
38          val policy = #fnpolicy (#param gp)          val policy = #fnpolicy (#param gp)
39          fun sname p = FilenamePolicy.mkStableName policy p          val stablename =
40          val GG.GROUP { grouppath, exports, sublibs, ... } = g              FilenamePolicy.mkStableName policy (grouppath, version)
41          val stablename = sname grouppath  
         fun invalidSublib st (p, GG.GROUP { kind = GG.STABLELIB _, ... }) =  
             let val sn = sname p  
             in case TS.fmodTime sn of  
                 TS.TSTAMP t => Time.compare (t, st) = GREATER  
               | _ => true  
             end  
           | invalidSublib _ _ = true  
42          fun invalidMember stab_t i = let          fun invalidMember stab_t i = let
43              val p = SmlInfo.sourcepath i              val p = SmlInfo.sourcepath i
44    
45              val bn = SmlInfo.binname i              val bn = SmlInfo.binname i
46          in          in
47              case (SrcPath.tstamp p, TS.fmodTime bn) of              case (SrcPath.tstamp p, TS.fmodTime bn) of
# Line 42  Line 50 
50                      Time.compare (src_t, stab_t) = GREATER                      Time.compare (src_t, stab_t) = GREATER
51                | _ => true                | _ => true
52          end          end
53    
54            fun nonstabSublib (_, GG.GROUP { kind = GG.LIB { kind = GG.STABLE _,
55                                                             ... }, ... }) = false
56              | nonstabSublib _ = true
57    
58            fun invalidGroup stab_t p =
59                case SrcPath.tstamp p of
60                    TS.TSTAMP g_t => Time.compare (g_t, stab_t) = GREATER
61                  | _ => true
62    
63            val validStamp = Stabilize.libStampIsValid gp
64    
65            val isValid =
66                case TS.fmodTime stablename of
67                    TS.TSTAMP st => let
68                        val (m, i) = Reachable.reachable' export_nodes
69      in      in
70          case (TS.fmodTime stablename, SrcPath.tstamp grouppath) of                      (* The group itself is included in "groups"... *)
71              (TS.TSTAMP st, TS.TSTAMP gt) =>                      not (SrcPathSet.exists (invalidGroup st) groups) andalso
72                  if Time.compare (st, gt) = LESS then false                      not (List.exists nonstabSublib sublibs) andalso
73                  else not (SmlInfoSet.exists (invalidMember st)                      validStamp ((grouppath, export_nodes, sublibs), version)
74                                              (Reachable.reachable g) orelse                      andalso not (SmlInfoSet.exists (invalidMember st) m)
75                            List.exists (invalidSublib st) sublibs)                  end
76            | _ => false            | _ => false
77        in
78            if not isValid then
79                OS.FileSys.remove stablename handle _ => ()
80            else ();
81            isValid
82        end
83    
84        fun verify _ _ GG.ERRORGROUP = false
85          | verify gp em (group as GG.GROUP g) = let
86                val { exports, grouppath, sublibs, kind, ... } = g
87                val groups = Reachable.groupsOf group
88                val version =
89                    case kind of
90                        GG.NOLIB _ => NONE
91                      | GG.LIB { version, ... } => version
92            in
93                verify' gp em (grouppath,
94                               map (#2 o #1) (SymbolMap.listItems exports),
95                               sublibs, groups, version)
96      end      end
97  end  end
98  end  end

Legend:
Removed from v.537  
changed lines
  Added in v.632

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