110 |
end |
end |
111 |
(* NOTE: we may be able to simplify the interface to ToC.trBlock! *) |
(* NOTE: we may be able to simplify the interface to ToC.trBlock! *) |
112 |
fun block (ENV{vMap, ...}, blk) = ToC.trBlock (vMap, blk) |
fun block (ENV{vMap, ...}, blk) = ToC.trBlock (vMap, blk) |
113 |
|
fun free (ENV{vMap, ...}, blk) = ToC.trFree (vMap, blk) |
114 |
fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e) |
fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e) |
115 |
end |
end |
116 |
|
|
261 |
in |
in |
262 |
topDecls := initFn :: !topDecls |
topDecls := initFn :: !topDecls |
263 |
end |
end |
264 |
|
(* register the global destruction part of a program *) |
265 |
|
fun free (Prog{tgt, topDecls, ...}, free) = let |
266 |
|
val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy tgt)) |
267 |
|
val globTy = CL.T_Ptr(CL.T_Named(N.globalTy tgt)) |
268 |
|
val free = CL.mkBlock( |
269 |
|
CL.mkDeclInit(globTy, "glob", CL.mkIndirect(CL.mkVar "wrld", "globals")) :: |
270 |
|
CL.unBlock free @ [CL.mkReturn(SOME(CL.mkVar "false"))]) |
271 |
|
val freeFn = CL.D_Func( |
272 |
|
["static"], CL.boolTy, N.freeGlobals, |
273 |
|
[CL.PARAM([], worldTy, "wrld")], |
274 |
|
free) |
275 |
|
in |
276 |
|
topDecls := freeFn :: !topDecls |
277 |
|
end |
278 |
(* create and register the initially function for a program *) |
(* create and register the initially function for a program *) |
279 |
fun initially { |
fun initially { |
280 |
prog = Prog{tgt, strands, nAxes, initially, ...}, |
prog = Prog{tgt, strands, nAxes, initially, ...}, |