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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/c-util/tree-to-c.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/c-util/tree-to-c.sml

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

revision 2810, Sat Nov 8 18:26:25 2014 UTC revision 2811, Sat Nov 8 18:34:41 2014 UTC
# Line 31  Line 31 
31    
32      val trBlock : env * TreeIL.block -> CLang.stm      val trBlock : env * TreeIL.block -> CLang.stm
33    
     val trFree : env * TreeIL.block -> CLang.stm  
   
34      val trFragment : env * TreeIL.block -> env * CLang.stm list      val trFragment : env * TreeIL.block -> env * CLang.stm list
35    
36      val trExp : env * TreeIL.exp -> CLang.exp      val trExp : env * TreeIL.exp -> CLang.exp
# Line 547  Line 545 
545                CL.mkReturn(SOME(CL.mkVar "true")))]                CL.mkReturn(SOME(CL.mkVar "true")))]
546            end            end
547    
   (* given the global initialization code, generate code to free the storage that is heap  
    * allocated for globals.  
    *)  
     fun trFree (env, IL.Block{locals, body}) = let  
           val env = trLocals (env, locals)  
           fun trStmt (env, stm) = (case stm  
                  of IL.S_Comment text => [CL.mkComment text]  
                   | IL.S_LoadNrrd _ => [] (* FIXME *)  
                   | IL.S_InputNrrd _ => [] (* FIXME *)  
                   | _ => []  
                 (* end case *))  
           val stms = List.foldr (fn (stm, stms) => trStmt(env, stm)@stms) [] body  
           fun mkDecl (x, stms) = (case V.Map.find (env, x)  
                  of SOME(V(ty, x')) => CL.mkDecl(ty, x', NONE) :: stms  
                   | NONE => raise Fail(concat["mkDecl(", V.name x, ", _)"])  
                 (* end case *))  
           val stms = List.foldr mkDecl stms locals  
           in  
             CL.mkBlock stms  
           end  
   
548      fun trStms (env, stms) = let      fun trStms (env, stms) = let
549            fun trStmt (env, stm) = (case stm            fun trStmt (env, stm) = (case stm
550                   of IL.S_Comment text => [CL.mkComment text]                   of IL.S_Comment text => [CL.mkComment text]

Legend:
Removed from v.2810  
changed lines
  Added in v.2811

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