Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/basis/basis.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/basis/basis.sml

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

revision 168, Wed Jul 21 20:58:37 2010 UTC revision 169, Thu Jul 22 20:07:37 2010 UTC
# Line 15  Line 15 
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
# Line 22  Line 27 
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,
# Line 41  Line 46 
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 *)
# Line 77  Line 90 
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
# Line 86  Line 99 
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

Legend:
Removed from v.168  
changed lines
  Added in v.169

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