15 |
*) |
*) |
16 |
val findOp : Atom.atom -> AST.var list |
val findOp : Atom.atom -> AST.var list |
17 |
|
|
18 |
|
(* certain operations are restricted to only appear at global scope (i.e., not in an |
19 |
|
* actor body). This function returns true for such operations. |
20 |
|
*) |
21 |
|
val isRestricted : AST.var -> bool |
22 |
|
|
23 |
end = struct |
end = struct |
24 |
|
|
25 |
structure N = BasisNames |
structure N = BasisNames |
27 |
structure ATbl = AtomTable |
structure ATbl = AtomTable |
28 |
|
|
29 |
(* non-overloaded operators, etc. *) |
(* non-overloaded operators, etc. *) |
30 |
val basis = [ |
val basisFunctions = [ |
31 |
(* non-overloaded operators *) |
(* non-overloaded operators *) |
32 |
BV.op_at, |
BV.op_at, |
33 |
BV.op_D, |
BV.op_D, |
46 |
BV.fn_modulate, |
BV.fn_modulate, |
47 |
BV.fn_pow, |
BV.fn_pow, |
48 |
BV.fn_principleEvec, |
BV.fn_principleEvec, |
49 |
BV.fn_sin, |
BV.fn_sin |
50 |
|
] |
51 |
|
|
52 |
|
val basisVars = [ |
53 |
(* kernels *) |
(* kernels *) |
54 |
BV.kn_bspln3, |
BV.kn_bspln3, |
55 |
|
BV.kn_bspln5, |
56 |
|
BV.kn_ctmr, |
57 |
BV.kn_tent |
BV.kn_tent |
58 |
] |
] |
59 |
|
|
60 |
(* seed the basis environment *) |
(* seed the basis environment *) |
61 |
val env = let |
val env = let |
62 |
fun ins (x, env) = Env.insertGlobal(env, Atom.atom(Var.nameOf x), x) |
fun insF (x, env) = Env.insertFunc(env, Atom.atom(Var.nameOf x), x) |
63 |
|
fun insV (x, env) = Env.insertGlobal(env, Atom.atom(Var.nameOf x), x) |
64 |
|
val env = List.foldl insF (Env.new()) basisFunctions |
65 |
|
val env = List.foldl insV env basisVars |
66 |
in |
in |
67 |
List.foldl ins (Env.new()) basis |
env |
68 |
end |
end |
69 |
|
|
70 |
(* overloaded operators *) |
(* overloaded operators *) |
90 |
ATbl.find tbl |
ATbl.find tbl |
91 |
end |
end |
92 |
in |
in |
93 |
fun findOp name = (case Env.findVar(env, name) |
fun findOp name = (case Env.findFunc(env, name) |
94 |
of SOME x => [x] |
of SOME x => [x] |
95 |
| NONE => (case find name |
| NONE => (case find name |
96 |
of SOME xs => xs |
of SOME xs => xs |
99 |
(* end case *)) |
(* end case *)) |
100 |
end (* local *) |
end (* local *) |
101 |
|
|
102 |
|
local |
103 |
|
val restricted = List.foldl Var.Set.add' Var.Set.empty [ |
104 |
|
BV.fn_load |
105 |
|
] |
106 |
|
in |
107 |
|
fun isRestricted x = Var.Set.member (restricted, x) |
108 |
|
end (* local *) |
109 |
|
|
110 |
end |
end |