Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/cm/depend/reachable.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 371 - (view) (download)

1 : blume 301 (*
2 :     * Get the set of reachable SNODEs in a given dependency graph.
3 :     *
4 :     * (C) 1999 Lucent Technologies, Bell Laboratories
5 :     *
6 :     * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7 :     *)
8 :     signature REACHABLE = sig
9 : blume 362 val reachable' : DependencyGraph.impexp SymbolMap.map -> SrcPathSet.set
10 : blume 354 val reachable : GroupGraph.group -> SrcPathSet.set
11 : blume 301 end
12 :    
13 :     structure Reachable :> REACHABLE = struct
14 :     structure DG = DependencyGraph
15 :    
16 : blume 362 fun reachable' exports = let
17 : blume 301 fun snode (DG.SNODE n, known) = let
18 :     val { smlinfo, localimports = l, globalimports = g } = n
19 :     val p = SmlInfo.sourcepath smlinfo
20 :     in
21 : blume 354 if SrcPathSet.member (known, p) then known
22 : blume 371 else foldl farsbnode (foldl snode (SrcPathSet.add (known, p)) l) g
23 : blume 301 end
24 :    
25 :     and farsbnode ((_, n), known) = sbnode (n, known)
26 :    
27 :     and sbnode (DG.SB_BNODE _, known) = known
28 :     | sbnode (DG.SB_SNODE n, known) = snode (n, known)
29 :    
30 :     fun impexp ((n, _), known) = farsbnode (n, known)
31 :     in
32 : blume 354 SymbolMap.foldl impexp SrcPathSet.empty exports
33 : blume 301 end
34 : blume 362
35 :     fun reachable (GroupGraph.GROUP { exports, ... }) = reachable' exports
36 : blume 301 end

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