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 2011, Sun Oct 7 21:14:31 2012 UTC revision 2012, Mon Oct 8 14:27:53 2012 UTC
# Line 7  Line 7 
7  structure GenInputs : sig  structure GenInputs : sig
8    
9    (* input variable descriptor: type, name, description, has default *)    (* input variable descriptor: type, name, description, has default *)
10      type input_desc = (TreeIL.Ty.ty * string * string * bool)      type input_desc = (TreeIL.Ty.ty * string * string option * bool)
11    
12      val gatherInputs : TreeIL.block -> input_desc list      val gatherInputs : TreeIL.block -> input_desc list
13    
# Line 23  Line 23 
23      structure N = CNames      structure N = CNames
24      structure TrTy = CTyTranslate      structure TrTy = CTyTranslate
25    
26      type input_desc = (Ty.ty * string * string * bool)      type input_desc = (Ty.ty * string * string option * bool)
27    
28      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")
29      val wrldPrefixTy = CL.T_Ptr(CL.T_Named "WorldPrefix_t")      val wrldPrefixTy = CL.T_Ptr(CL.T_Named "WorldPrefix_t")
# Line 56  Line 56 
56            val optsV = CL.mkVar "opts"            val optsV = CL.mkVar "opts"
57          (* register a given input *)          (* register a given input *)
58            fun registerInput (ty, name, desc, hasDflt) = CL.mkCall(N.input ty, [            fun registerInput (ty, name, desc, hasDflt) = CL.mkCall(N.input ty, [
59                    optsV, CL.mkStr name, CL.mkStr desc,                    optsV, CL.mkStr name, CL.mkStr(Option.getOpt(desc, "")),
60                    CL.mkUnOp(CL.%&, CL.mkIndirect(globV, name)),                    CL.mkUnOp(CL.%&, CL.mkIndirect(globV, name)),
61                    CL.mkBool hasDflt                    CL.mkBool hasDflt
62                  ])                  ])
# Line 77  Line 77 
77          (* create decls for an input variable *)          (* create decls for an input variable *)
78            fun mkInputDecls (ty, name, desc, hasDflt) = let            fun mkInputDecls (ty, name, desc, hasDflt) = let
79                (* create a description declaration for the input variable *)                (* create a description declaration for the input variable *)
80                  val descDcl = if (desc = "")                  val descDcl = (case desc
81                          then []                         of SOME desc => [
                         else [  
82                              CL.D_Var([], CL.T_Ptr(CL.T_Named "const char"),                              CL.D_Var([], CL.T_Ptr(CL.T_Named "const char"),
83                                N.inputDesc(tgt, name),                                N.inputDesc(tgt, name),
84                                SOME(CL.I_Exp(CL.mkStr desc)))                                SOME(CL.I_Exp(CL.mkStr desc)))
85                            ]                            ]
86                            | NONE => []
87                          (* end case *))
88                  val getDcl = if hasDflt                  val getDcl = if hasDflt
89                          then let                          then let
90                            val getName = N.inputGet(tgt, name)                            val getName = N.inputGet(tgt, name)

Legend:
Removed from v.2011  
changed lines
  Added in v.2012

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