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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 301 - (download) (annotate)
Fri May 28 09:43:39 1999 UTC (21 years, 1 month ago) by blume
File size: 945 byte(s)
recompile and exec mostly working (probably still bugs in the details)
(*
 * Get the set of reachable SNODEs in a given dependency graph.
 *
 * (C) 1999 Lucent Technologies, Bell Laboratories
 *
 * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
 *)
signature REACHABLE = sig
    val reachable : GroupGraph.group -> AbsPathSet.set
end

structure Reachable :> REACHABLE = struct
    structure DG = DependencyGraph

    fun reachable (GroupGraph.GROUP { exports, ... }) = let
	fun snode (DG.SNODE n, known) = let
	    val { smlinfo, localimports = l, globalimports = g } = n
	    val p = SmlInfo.sourcepath smlinfo
	in
	    if AbsPathSet.member (known, p) then known
	    else foldl farsbnode (foldl snode (AbsPathSet.add (known, p)) l) g
	end

	and farsbnode ((_, n), known) = sbnode (n, known)

	and sbnode (DG.SB_BNODE _, known) = known
	  | sbnode (DG.SB_SNODE n, known) = snode (n, known)

	fun impexp ((n, _), known) = farsbnode (n, known)
    in
	SymbolMap.foldl impexp AbsPathSet.empty exports
    end
end

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