|
(* just a placeholder so far *) |
|
|
|
|
1 |
(* |
(* |
2 |
* Collections of members in CM descriptions. |
* Collections of members in CM descriptions. |
3 |
* Involves: |
* Involves: |
12 |
signature MEMBERCOLLECTION = sig |
signature MEMBERCOLLECTION = sig |
13 |
|
|
14 |
type symbol = GenericVC.Symbol.symbol |
type symbol = GenericVC.Symbol.symbol |
15 |
type smlinfo = DependencyGraph.smlinfo |
type smlinfo = SmlInfo.info |
16 |
|
|
17 |
exception DuplicateImport of symbol * smlinfo * smlinfo |
exception DuplicateImport of symbol * string * string |
18 |
exception DuplicateDefinition of symbol * smlinfo * smlinfo |
exception DuplicateDefinition of symbol * string * string |
19 |
|
|
20 |
type collection |
type collection |
21 |
|
|
22 |
val expandOne : AbsPath.t * string option -> collection |
val expandOne : (AbsPath.t -> DependencyGraph.farnode SymbolMap.map) |
23 |
|
-> { sourcepath: AbsPath.t, group: AbsPath.t, class: string option } |
24 |
|
-> collection |
25 |
val sequential : collection * collection -> collection |
val sequential : collection * collection -> collection |
26 |
|
|
27 |
val num_look : collection -> string -> int |
val num_look : collection -> string -> int |
33 |
|
|
34 |
structure DG = DependencyGraph |
structure DG = DependencyGraph |
35 |
|
|
36 |
type smlinfo = DG.smlinfo |
type smlinfo = SmlInfo.info |
37 |
type symbol = GenericVC.Symbol.symbol |
type symbol = GenericVC.Symbol.symbol |
38 |
|
|
39 |
exception DuplicateImport of symbol * smlinfo * smlinfo |
exception DuplicateImport of symbol * string * string |
40 |
exception DuplicateDefinition of symbol * smlinfo * smlinfo |
exception DuplicateDefinition of symbol * string * string |
41 |
|
|
42 |
datatype collection = |
datatype collection = |
43 |
COLLECTION of { subexports: DG.farnode SymbolMap.map, |
COLLECTION of { subexports: DG.farnode SymbolMap.map, |
44 |
smlfiles: smlinfo list, |
smlfiles: smlinfo list, |
45 |
localdefs: smlinfo SymbolMap.map } |
localdefs: smlinfo SymbolMap.map } |
46 |
|
|
|
fun expandOne (f: AbsPath.t, c: string option) = raise Fail "notyet" |
|
|
|
|
47 |
fun sequential (COLLECTION c1, COLLECTION c2) = let |
fun sequential (COLLECTION c1, COLLECTION c2) = let |
48 |
fun se_error (s, (_, DG.NODE n1), (_, DG.NODE n2)) = |
fun se_error (s, (_, n1), (_, n2)) = |
49 |
raise DuplicateImport (s, #smlinfo n1, #smlinfo n2) |
raise DuplicateImport (s, DG.describeNode n1, DG.describeNode n2) |
|
fun ld_error (s, f1, f2) = raise DuplicateDefinition (s, f1, f2) |
|
50 |
val se_union = SymbolMap.unionWithi se_error |
val se_union = SymbolMap.unionWithi se_error |
51 |
|
fun ld_error (s, f1, f2) = |
52 |
|
raise DuplicateDefinition (s, SmlInfo.describe f1, |
53 |
|
SmlInfo.describe f2) |
54 |
val ld_union = SymbolMap.unionWithi ld_error |
val ld_union = SymbolMap.unionWithi ld_error |
55 |
|
|
56 |
in |
in |
57 |
COLLECTION { subexports = se_union (#subexports c1, #subexports c2), |
COLLECTION { subexports = se_union (#subexports c1, #subexports c2), |
58 |
smlfiles = #smlfiles c1 @ #smlfiles c2, |
smlfiles = #smlfiles c1 @ #smlfiles c2, |
59 |
localdefs = ld_union (#localdefs c1, #localdefs c2) } |
localdefs = ld_union (#localdefs c1, #localdefs c2) } |
60 |
end |
end |
61 |
|
|
62 |
|
fun expandOne gexports { sourcepath, group, class } = let |
63 |
|
val expansions = Tools.expand (sourcepath, class) |
64 |
|
fun exp2coll (Tools.GROUP p) = |
65 |
|
COLLECTION { subexports = gexports p, |
66 |
|
smlfiles = [], |
67 |
|
localdefs = SymbolMap.empty } |
68 |
|
| exp2coll (Tools.PRIMITIVE p) = let |
69 |
|
val exports = Primitive.exports p |
70 |
|
fun addFN (s, m) = |
71 |
|
SymbolMap.insert (m, s, (NONE, DG.PNODE p)) |
72 |
|
val se = SymbolSet.foldl addFN SymbolMap.empty exports |
73 |
|
in |
74 |
|
COLLECTION { subexports = se, |
75 |
|
smlfiles = [], |
76 |
|
localdefs = SymbolMap.empty } |
77 |
|
end |
78 |
|
| exp2coll (Tools.SMLSOURCE src) = let |
79 |
|
val { sourcepath = p, history = h, share = s } = src |
80 |
|
val i = SmlInfo.new { sourcepath = p, group = group, |
81 |
|
history = SOME h, share = s, |
82 |
|
stableinfo = NONE } |
83 |
|
val exports = SmlInfo.exports i |
84 |
|
fun addLD (s, m) = SymbolMap.insert (m, s, i) |
85 |
|
val ld = SymbolSet.foldl addLD SymbolMap.empty exports |
86 |
|
in |
87 |
|
COLLECTION { subexports = SymbolMap.empty, |
88 |
|
smlfiles = [i], |
89 |
|
localdefs = ld } |
90 |
|
end |
91 |
|
|
92 |
|
val collections = map exp2coll expansions |
93 |
|
val empty = COLLECTION { subexports = SymbolMap.empty, |
94 |
|
smlfiles = [], |
95 |
|
localdefs = SymbolMap.empty } |
96 |
|
fun combine (c1, c2) = sequential (c2, c1) |
97 |
|
in |
98 |
|
foldl combine empty collections |
99 |
|
end |
100 |
|
|
101 |
fun num_look (c: collection) (s: string) = 0 |
fun num_look (c: collection) (s: string) = 0 |
102 |
|
|
103 |
fun cm_look (c: collection) (s: string) = false |
fun cm_look (c: collection) (s: string) = false |