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 362 - (download) (annotate)
Thu Jul 1 09:39:48 1999 UTC (21 years ago) by blume
File size: 1070 byte(s)
bootstrapping now working (it seems)
 * 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' : DependencyGraph.impexp SymbolMap.map -> SrcPathSet.set
    val reachable : GroupGraph.group -> SrcPathSet.set

structure Reachable :> REACHABLE = struct
    structure DG = DependencyGraph

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

	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)
	SymbolMap.foldl impexp SrcPathSet.empty exports

    fun reachable (GroupGraph.GROUP { exports, ... }) = reachable' exports

ViewVC Help
Powered by ViewVC 1.0.0