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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/c-target/gen-output.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/c-target/gen-output.sml

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

revision 1814, Sun Apr 8 15:44:36 2012 UTC revision 1815, Tue Apr 10 11:52:06 2012 UTC
# Line 56  Line 56 
56      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")
57      val filePtrTy = CL.T_Ptr(CL.T_Named "FILE")      val filePtrTy = CL.T_Ptr(CL.T_Named "FILE")
58      val sizeTy = CL.T_Named "size_t"      val sizeTy = CL.T_Named "size_t"
59      fun wrldPtr (tgt : TargetUtil.target_desc) = CL.T_Ptr(CL.T_Named(#namespace tgt ^ "World_t"))      fun wrldPtr tgt = CL.T_Ptr(CL.T_Named(N.worldTy tgt))
   
60      fun mkInt i = CL.mkInt(IntInf.fromInt i)      fun mkInt i = CL.mkInt(IntInf.fromInt i)
61    
62    (* return information about the output type.  This is a tuple    (* return information about the output type.  This is a tuple
# Line 93  Line 92 
92              | _ => raise Fail(concat["GetOutput.infoOf(", Ty.toString ty, ")"])              | _ => raise Fail(concat["GetOutput.infoOf(", Ty.toString ty, ")"])
93            (* end case *))            (* end case *))
94    
   (* the name of an output getter *)  
     fun getFunName (tgt : TargetUtil.target_desc, name) = String.concat[#namespace tgt, "Get_", name]  
   
95    (* variables in the generated code *)    (* variables in the generated code *)
96      val wrldV = CL.mkVar "wrld"      val wrldV = CL.mkVar "wrld"
97      val sizesV = CL.mkVar "sizes"      val sizesV = CL.mkVar "sizes"
# Line 369  Line 365 
365                        nrrdNew (nLengthsV),                        nrrdNew (nLengthsV),
366                        nrrdNew (nDataV),                        nrrdNew (nDataV),
367                        CL.mkIfThenElse(                        CL.mkIfThenElse(
368                          CL.mkApply(getFunName(tgt, name), [wrldV, nLengthsV, nDataV]),                          CL.mkApply(N.outputGet(tgt, name), [wrldV, nLengthsV, nDataV]),
369                        (* then *)                        (* then *)
370                            error ("Error getting nrrd data: %s\n", CL.mkIndirect(wrldV, "err")),                            error ("Error getting nrrd data: %s\n", CL.mkIndirect(wrldV, "err")),
371                        (* else *)                        (* else *)
# Line 394  Line 390 
390                    else [                    else [
391                        nrrdNew (nDataV),                        nrrdNew (nDataV),
392                        CL.mkIfThenElse(                        CL.mkIfThenElse(
393                          CL.mkApply(getFunName(tgt, name), [wrldV, nDataV]),                          CL.mkApply(N.outputGet(tgt, name), [wrldV, nDataV]),
394                        (* then *)                        (* then *)
395                            error ("Error getting nrrd data: %s\n", CL.mkIndirect(wrldV, "err")),                            error ("Error getting nrrd data: %s\n", CL.mkIndirect(wrldV, "err")),
396                        (* else *)                        (* else *)
# Line 419  Line 415 
415    
416      fun gen (tgt : TargetUtil.target_desc, nAxes) = let      fun gen (tgt : TargetUtil.target_desc, nAxes) = let
417            fun getFn (ty, name) = let            fun getFn (ty, name) = let
418                  val funcName = getFunName(tgt, name)                  val funcName = N.outputGet(tgt, name)
419                  fun mkFunc (params, body) =                  fun mkFunc (params, body) =
420                        CL.D_Func([], CL.boolTy, funcName, CL.PARAM([], wrldPtr tgt, "wrld")::params, body)                        CL.D_Func([], CL.boolTy, funcName, CL.PARAM([], wrldPtr tgt, "wrld")::params, body)
421                  in                  in

Legend:
Removed from v.1814  
changed lines
  Added in v.1815

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