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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/target-cpu/gen-inputs.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/gen-inputs.sml

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

revision 3930, Sun Jun 5 14:13:06 2016 UTC revision 3931, Sun Jun 5 14:13:21 2016 UTC
# Line 65  Line 65 
65      val wrldV = CL.mkVar "wrld"      val wrldV = CL.mkVar "wrld"
66    
67    (* an l-value expression for accessing a global variable *)    (* an l-value expression for accessing a global variable *)
68      fun global gv = CL.mkIndirect(CL.mkIndirect(CL.mkVar "wrld", "globals"), GVar.name gv)      fun global gv = CL.mkIndirect(CL.mkIndirect(CL.mkVar "wrld", "_globals"), GVar.qname gv)
69    
70    (* define a function that is exported to C *)    (* define a function that is exported to C *)
71      fun cFunc (ty, name, params, body) = CL.D_Func(["extern \"C\""], ty, name, params, body)      fun cFunc (ty, name, params, body) = CL.D_Func(["extern \"C\""], ty, name, params, body)
# Line 76  Line 76 
76            val worldPtrTy = RN.worldPtrTy            val worldPtrTy = RN.worldPtrTy
77          (* the global state pointer type *)          (* the global state pointer type *)
78            val globPtrTy = RN.globalPtrTy            val globPtrTy = RN.globalPtrTy
         (* the inputs pointer type *)  
           val optionsPtrTy = RN.optionsPtrTy env  
79          (* some common variables *)          (* some common variables *)
80            val inpV = CL.mkVar "inp"            val inpV = CL.mkVar "inp"
81            val optsV = CL.mkVar "opts"            val optsV = CL.mkVar "opts"
# Line 116  Line 114 
114                            CL.mkReturn(SOME(CL.mkVar "true"))) :: stms                            CL.mkReturn(SOME(CL.mkVar "true"))) :: stms
115                        end                        end
116                    | ty => U.copy{                    | ty => U.copy{
117                          env=env, ty=ty, dst=global var, src=CL.mkIndirect(inpV, GVar.name var)                          env=env, ty=ty, dst=global var, src=CL.mkIndirect(inpV, GVar.qname var)
118                        } :: stms                        } :: stms
119                  (* end case *))                  (* end case *))
120            in            in
121              CL.D_Func(              CL.D_Func(
122                ["static"], CL.boolTy, "init_inputs",                ["static"], CL.boolTy, "init_inputs",
123                [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], optionsPtrTy, "inp")],                [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], RN.inputsPtrTy, "inp")],
124                CL.mkBlock(                CL.mkBlock(
125                  CL.mkDeclInit(globPtrTy, RN.globalsVar, CL.mkIndirect(CL.mkVar "wrld", "_globals")) ::                  CL.mkDeclInit(globPtrTy, RN.globalsVar, CL.mkIndirect(CL.mkVar "wrld", "_globals")) ::
126                  List.foldr initInput [CL.mkReturn(SOME(CL.mkVar "false"))] inputs))                  List.foldr initInput [CL.mkReturn(SOME(CL.mkVar "false"))] inputs))

Legend:
Removed from v.3930  
changed lines
  Added in v.3931

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