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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 329 - (view) (download)

1 : blume 329 (*
2 :     * Produce a linear listing of information pertaining to nodes in
3 :     * a given dependency graph.
4 :     *
5 :     * (C) 1999 Lucent Technologies, Bell Laboratories
6 :     *
7 :     * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
8 :     *)
9 :     functor MkListFn (type element
10 :     val bininfo : BinInfo.info -> element
11 :     val smlinfo : SmlInfo.info -> element) :>
12 :     sig
13 :     val group : GroupGraph.group -> element list
14 :     end = struct
15 :    
16 :     structure DG = DependencyGraph
17 :    
18 :     fun stab_isreg ((bs, ss), i) = StableSet.member (bs, i)
19 :     fun sml_isreg ((bs, ss), i) = SmlInfoSet.member (ss, i)
20 :     fun stab_reg ((bs, ss), i) = (StableSet.add (bs, i), ss)
21 :     fun sml_reg ((bs, ss), i) = (bs, SmlInfoSet.add (ss, i))
22 :    
23 :     fun do_list do_elem [] k m = k m
24 :     | do_list do_elem (h :: t) k m = do_elem h (do_list do_elem t k) m
25 :    
26 :     fun bnode (DG.PNODE _) k m = k m
27 :     | bnode (DG.BNODE n) k m = let
28 :     val { bininfo = i, localimports = l, globalimports = g } = n
29 :     in
30 :     if stab_isreg (m, i) then k m
31 :     else bininfo i
32 :     :: do_list bnode l (do_list farbnode g k) (stab_reg (m, i))
33 :     end
34 :    
35 :     and farbnode (_, n) k m = bnode n k m
36 :    
37 :     fun snode (DG.SNODE n) k m = let
38 :     val { smlinfo = i, localimports = l, globalimports = g } = n
39 :     in
40 :     if sml_isreg (m, i) then k m
41 :     else smlinfo i
42 :     :: do_list snode l (do_list farsbnode g k) (sml_reg (m, i))
43 :     end
44 :    
45 :     and farsbnode (_, DG.SB_BNODE n) k m = bnode n k m
46 :     | farsbnode (_, DG.SB_SNODE n) k m = snode n k m
47 :    
48 :     fun impexp (n, _) k m = farsbnode n k m
49 :    
50 :     fun group (GroupGraph.GROUP { exports, ... }) =
51 :     do_list impexp (SymbolMap.listItems exports)
52 :     (fn m => [])
53 :     (StableSet.empty, SmlInfoSet.empty)
54 :     end

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