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

SCM Repository

[smlnj] Diff of /sml/trunk/src/cm/semant/members.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/semant/members.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 282, Wed May 19 05:14:03 1999 UTC revision 283, Wed May 19 08:20:58 1999 UTC
# Line 13  Line 13 
13    
14      type symbol = Symbol.symbol      type symbol = Symbol.symbol
15      type smlinfo = SmlInfo.info      type smlinfo = SmlInfo.info
16        type impexp = DependencyGraph.impexp
17    
18      type collection      type collection
19    
20      type farlooker =      type farlooker = AbsPath.t ->
21          AbsPath.t ->          { imports: impexp SymbolMap.map, gimports: impexp SymbolMap.map }
         (DependencyGraph.farsbnode * DependencyGraph.env) SymbolMap.map  
22    
23      val empty : collection      val empty : collection
24    
# Line 28  Line 28 
28          -> collection          -> collection
29      val sequential : collection * collection * (string -> unit) -> collection      val sequential : collection * collection * (string -> unit) -> collection
30    
31      val build : collection      val build : collection * SymbolSet.set option * (string -> unit)
32          -> { nodemap: DependencyGraph.snode SymbolMap.map,          -> impexp SymbolMap.map
              rootset: DependencyGraph.snode list }  
   
33    
34      val num_look : collection -> string -> int      val num_look : collection -> string -> int
35      val ml_look : collection -> symbol -> bool      val ml_look : collection -> symbol -> bool
# Line 46  Line 44 
44    
45      type smlinfo = SmlInfo.info      type smlinfo = SmlInfo.info
46      type symbol = Symbol.symbol      type symbol = Symbol.symbol
47        type impexp = DG.impexp
48    
49      datatype collection =      datatype collection =
50          COLLECTION of { subexports: (DG.farsbnode * DG.env) SymbolMap.map,          COLLECTION of { imports: impexp SymbolMap.map,
51                            gimports: impexp SymbolMap.map,
52                          smlfiles: smlinfo list,                          smlfiles: smlinfo list,
53                          localdefs: smlinfo SymbolMap.map }                          localdefs: smlinfo SymbolMap.map }
54    
55      type farlooker =      type farlooker = AbsPath.t ->
56          AbsPath.t ->          { imports: impexp SymbolMap.map, gimports: impexp SymbolMap.map }
         (DependencyGraph.farsbnode * DependencyGraph.env) SymbolMap.map  
57    
58      val empty =      val empty =
59          COLLECTION { subexports = SymbolMap.empty,          COLLECTION { imports = SymbolMap.empty,
60                         gimports = SymbolMap.empty,
61                       smlfiles = [],                       smlfiles = [],
62                       localdefs = SymbolMap.empty }                       localdefs = SymbolMap.empty }
63    
# Line 86  Line 86 
86          in          in
87              Symbol.nameSpaceToString ns :: " " :: Symbol.name s :: r              Symbol.nameSpaceToString ns :: " " :: Symbol.name s :: r
88          end          end
89          fun se_error (s, x as (fn1, _), (fn2, _)) =          fun i_error (s, x as (fn1, _), (fn2, _)) =
90              (error (concat (describeSymbol              (error (concat (describeSymbol
91                              (s, [" imported from ", DG.describeFarSBN fn1,                              (s, [" imported from ", DG.describeFarSBN fn1,
92                                   " and also from ", DG.describeFarSBN fn2])));                                   " and also from ", DG.describeFarSBN fn2])));
93               x)               x)
94          val se_union = SymbolMap.unionWithi se_error          val i_union = SymbolMap.unionWithi i_error
95            val gi_union = SymbolMap.unionWith #1
96          fun ld_error (s, f1, f2) =          fun ld_error (s, f1, f2) =
97              (error (concat (describeSymbol              (error (concat (describeSymbol
98                              (s, [" defined in ", SmlInfo.spec f1,                              (s, [" defined in ", SmlInfo.spec f1,
# Line 99  Line 100 
100               f1)               f1)
101          val ld_union = SymbolMap.unionWithi ld_error          val ld_union = SymbolMap.unionWithi ld_error
102      in      in
103          COLLECTION { subexports = se_union (#subexports c1, #subexports c2),          COLLECTION { imports = i_union (#imports c1, #imports c2),
104                         gimports = gi_union (#gimports c1, #gimports c2),
105                       smlfiles = #smlfiles c1 @ #smlfiles c2,                       smlfiles = #smlfiles c1 @ #smlfiles c2,
106                       localdefs = ld_union (#localdefs c1, #localdefs c2) }                       localdefs = ld_union (#localdefs c1, #localdefs c2) }
107      end      end
# Line 108  Line 110 
110          fun noPrimitive () = let          fun noPrimitive () = let
111              fun e0 s = error s EM.nullErrorBody              fun e0 s = error s EM.nullErrorBody
112              val expansions = PrivateTools.expand e0 (sourcepath, class)              val expansions = PrivateTools.expand e0 (sourcepath, class)
113              fun exp2coll (PrivateTools.GROUP p) =              fun exp2coll (PrivateTools.GROUP p) = let
114                  COLLECTION { subexports = gexports p,                      val { imports = i, gimports = gi } = gexports p
115                               smlfiles = [],                  in
116                        COLLECTION { imports = i, gimports = gi, smlfiles = [],
117                               localdefs = SymbolMap.empty }                               localdefs = SymbolMap.empty }
118                    end
119                | exp2coll (PrivateTools.SMLSOURCE src) = let                | exp2coll (PrivateTools.SMLSOURCE src) = let
120                      val { sourcepath = p, history = h, share = s } = src                      val { sourcepath = p, history = h, share = s } = src
121                      val i =  SmlInfo.info                      val i =  SmlInfo.info
# Line 123  Line 127 
127                      fun addLD (s, m) = SymbolMap.insert (m, s, i)                      fun addLD (s, m) = SymbolMap.insert (m, s, i)
128                      val ld = SymbolSet.foldl addLD SymbolMap.empty exports                      val ld = SymbolSet.foldl addLD SymbolMap.empty exports
129                  in                  in
130                      COLLECTION { subexports = SymbolMap.empty,                      COLLECTION { imports = SymbolMap.empty,
131                                     gimports = SymbolMap.empty,
132                                   smlfiles = [i],                                   smlfiles = [i],
133                                   localdefs = ld }                                   localdefs = ld }
134                  end                  end
# Line 144  Line 149 
149                  in                  in
150                      SymbolMap.insert (m, s, (fsbn, env))                      SymbolMap.insert (m, s, (fsbn, env))
151                  end                  end
152                  val se = SymbolSet.foldl addFN SymbolMap.empty exports                  val imp = SymbolSet.foldl addFN SymbolMap.empty exports
153              in              in
154                  COLLECTION { subexports = se,                  COLLECTION { imports = imp,
155                                 gimports = SymbolMap.empty,
156                               smlfiles = [],                               smlfiles = [],
157                               localdefs = SymbolMap.empty }                               localdefs = SymbolMap.empty }
158              end              end
159            | NONE => noPrimitive ()            | NONE => noPrimitive ()
160      end      end
161    
162      fun build (COLLECTION c) = BuildDepend.build c      fun build (COLLECTION c, fopt, error) = BuildDepend.build (c, fopt, error)
163    
164      fun num_look (c: collection) (s: string) = 0      fun num_look (c: collection) (s: string) = 0
165    
166      fun cm_look (c: collection) (s: string) = false      fun cm_look (c: collection) (s: string) = false
167    
168      fun ml_look (COLLECTION { subexports, localdefs, ... }) s =      fun ml_look (COLLECTION { imports, localdefs, ... }) s =
169          isSome (SymbolMap.find (subexports, s)) orelse          isSome (SymbolMap.find (imports, s)) orelse
170          isSome (SymbolMap.find (localdefs, s))          isSome (SymbolMap.find (localdefs, s))
171  end  end

Legend:
Removed from v.282  
changed lines
  Added in v.283

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