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/gen-inputs.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/c-util/gen-inputs.sml

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

revision 2708, Sat Sep 20 18:46:49 2014 UTC revision 2709, Sat Sep 20 19:31:47 2014 UTC
# Line 166  Line 166 
166          (* some common variables *)          (* some common variables *)
167            val inpV = CL.mkVar "inp"            val inpV = CL.mkVar "inp"
168            val optsV = CL.mkVar "opts"            val optsV = CL.mkVar "opts"
         (* set to true if the initialization code uses a status variable *)  
           val usesStatus = ref false  
169          (* initialize a given input global; for sequences and images, this requires          (* initialize a given input global; for sequences and images, this requires
170           * loading the value from the specified nrrd file, while for other types           * loading the value from the specified nrrd file, while for other types
171           * we just copy the values.           * we just copy the values.
# Line 183  Line 181 
181                        (* end case *))                        (* end case *))
182                  in                  in
183                    CL.mkAssign(global name,                    CL.mkAssign(global name,
184                      CL.mkApply(loadFn, [                      CL.mkApply(loadFn, [wrldPrefix, CL.mkIndirect(inpV, name), nDims, dims])) ::
185                          wrldPrefix, CL.mkIndirect(inpV, name), nDims, dims                    CL.mkIfThen(CL.mkBinOp(global name, CL.#==, CL.mkInt 0),
186                        ])) :: stms                      CL.mkReturn(SOME(CL.mkVar "true"))) :: stms
187                  end                  end
188              | initInput ((Ty.ImageTy info, name, desc, optDflt), stms) = let              | initInput ((Ty.ImageTy info, name, desc, optDflt), stms) = let
189                  val loadFn = (case ImageInfo.dim info                  val loadFn = (case ImageInfo.dim info
# Line 195  Line 193 
193                          | _ => raise Fail "image with dimension > 3"                          | _ => raise Fail "image with dimension > 3"
194                        (* end case *))                        (* end case *))
195                  in                  in
196                    CL.mkCall(loadFn, [                    CL.mkIfThen(
197                        wrldPrefix, CL.mkIndirect(inpV, name), CL.mkAddrOf(global name)                      CL.mkApply(loadFn, [wrldPrefix, CL.mkIndirect(inpV, name), CL.mkAddrOf(global name)]),
198                      ]) :: stms                      CL.mkReturn(SOME(CL.mkVar "true"))) :: stms
199                  end                  end
200              | initInput ((ty, name, _, _), stms) =              | initInput ((ty, name, _, _), stms) =
201                  TrTy.copyFromC{ty=ty, dst=global name, src=CL.mkIndirect(inpV, name)} @ stms                  TrTy.copyFromC{ty=ty, dst=global name, src=CL.mkIndirect(inpV, name)} @ stms
202            in            in
203              CL.D_Func(              CL.D_Func(
204                ["static"], CL.voidTy, N.initInputs,                ["static"], CL.boolTy, N.initInputs,
205                [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], inputPtrTy, "inp")],                [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], inputPtrTy, "inp")],
206                CL.mkBlock(                CL.mkBlock(
207                  CL.mkDeclInit(globPtrTy, "glob", CL.mkIndirect(CL.mkVar "wrld", "globals")) ::                  CL.mkDeclInit(globPtrTy, "glob", CL.mkIndirect(CL.mkVar "wrld", "globals")) ::
208                  List.foldr initInput [] inputs))                  List.foldr initInput [CL.mkReturn(SOME(CL.mkVar "false"))] inputs))
209            end            end
210    
211    (* generate the functions that handle inputs for standalone executables.  These are:    (* generate the functions that handle inputs for standalone executables.  These are:

Legend:
Removed from v.2708  
changed lines
  Added in v.2709

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