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 301 - (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 :     val reachable : GroupGraph.group -> AbsPathSet.set
10 :     end
11 :    
12 :     structure Reachable :> REACHABLE = struct
13 :     structure DG = DependencyGraph
14 :    
15 :     fun reachable (GroupGraph.GROUP { exports, ... }) = let
16 :     fun snode (DG.SNODE n, known) = let
17 :     val { smlinfo, localimports = l, globalimports = g } = n
18 :     val p = SmlInfo.sourcepath smlinfo
19 :     in
20 :     if AbsPathSet.member (known, p) then known
21 :     else foldl farsbnode (foldl snode (AbsPathSet.add (known, p)) l) g
22 :     end
23 :    
24 :     and farsbnode ((_, n), known) = sbnode (n, known)
25 :    
26 :     and sbnode (DG.SB_BNODE _, known) = known
27 :     | sbnode (DG.SB_SNODE n, known) = snode (n, known)
28 :    
29 :     fun impexp ((n, _), known) = farsbnode (n, known)
30 :     in
31 :     SymbolMap.foldl impexp AbsPathSet.empty exports
32 :     end
33 :     end

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