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/depend/reachable.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/depend/reachable.sml

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

revision 447, Tue Oct 19 07:34:25 1999 UTC revision 448, Thu Oct 21 09:20:16 1999 UTC
# Line 8  Line 8 
8  signature REACHABLE = sig  signature REACHABLE = sig
9      val reachable' : DependencyGraph.impexp SymbolMap.map -> SrcPathSet.set      val reachable' : DependencyGraph.impexp SymbolMap.map -> SrcPathSet.set
10      val reachable : GroupGraph.group -> SrcPathSet.set      val reachable : GroupGraph.group -> SrcPathSet.set
11        val snodeMap : GroupGraph.group -> DependencyGraph.snode SrcPathMap.map
12  end  end
13    
14  structure Reachable :> REACHABLE = struct  structure Reachable :> REACHABLE = struct
15      structure DG = DependencyGraph      structure DG = DependencyGraph
16    
17      fun reachable' exports = let      local
18          fun snode (DG.SNODE n, known) = let          fun reach ops (exports: DG.impexp SymbolMap.map) = let
19                val { add, member, empty } = ops
20                fun snode (x as DG.SNODE n, known) = let
21              val { smlinfo, localimports = l, globalimports = g } = n              val { smlinfo, localimports = l, globalimports = g } = n
22              val p = SmlInfo.sourcepath smlinfo              val p = SmlInfo.sourcepath smlinfo
23          in          in
24              if SrcPathSet.member (known, p) then known                  if member (known, p) then known
25              else foldl farsbnode (foldl snode (SrcPathSet.add (known, p)) l) g                  else foldl farsbnode (foldl snode (add (known, p, x)) l) g
26          end          end
27    
28          and farsbnode ((_, n), known) = sbnode (n, known)          and farsbnode ((_, n), known) = sbnode (n, known)
# Line 29  Line 32 
32    
33          fun impexp ((n, _), known) = farsbnode (n, known)          fun impexp ((n, _), known) = farsbnode (n, known)
34      in      in
35          SymbolMap.foldl impexp SrcPathSet.empty exports              SymbolMap.foldl impexp empty exports
36      end      end
37    
38            val snodeMap' =
39                reach { add = SrcPathMap.insert,
40                        member = SrcPathMap.inDomain,
41                        empty = SrcPathMap.empty }
42        in
43            val reachable' =
44                reach { add = fn (s, x, _) => SrcPathSet.add (s, x),
45                        member = SrcPathSet.member,
46                        empty = SrcPathSet.empty }
47    
48      fun reachable (GroupGraph.GROUP { exports, ... }) = reachable' exports      fun reachable (GroupGraph.GROUP { exports, ... }) = reachable' exports
49    
50            fun snodeMap (GroupGraph.GROUP { exports, ... }) = snodeMap' exports
51        end
52  end  end

Legend:
Removed from v.447  
changed lines
  Added in v.448

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