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-library-interface.sml
ViewVC logotype

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

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

revision 1701, Tue Mar 6 12:54:48 2012 UTC revision 1706, Wed Mar 7 12:06:48 2012 UTC
# Line 17  Line 17 
17  structure GenLibraryInterface : sig  structure GenLibraryInterface : sig
18    
19      val gen : {      val gen : {
20              srcFile : string,           (* source filename (including directory) *)              tgt : TargetUtil.target_desc,       (* target information *)
             base : string,              (* base part of output file name (no suffix) *)  
             prefix : string option,     (* optional namespace prefix *)  
21              inputs : (TreeIL.Ty.ty * string) list,              inputs : (TreeIL.Ty.ty * string) list,
22              outputs : (TreeIL.Ty.ty * string) list              outputs : (TreeIL.Ty.ty * string) list
23            } -> unit            } -> unit
# Line 59  Line 57 
57              String.concat["_", CharVector.map tr base, "_H_"]              String.concat["_", CharVector.map tr base, "_H_"]
58            end            end
59    
60      fun gen {srcFile, base, prefix, inputs, outputs} = let      fun gen {tgt : TargetUtil.target_desc, inputs, outputs} = let
           val {dir, ...} = OS.Path.splitDirFile srcFile  
61            val filename = OS.Path.joinDirFile{            val filename = OS.Path.joinDirFile{
62                    dir = dir,                    dir = #outDir tgt,
63                    file = OS.Path.joinBaseExt{base = base, ext = SOME "h"}                    file = OS.Path.joinBaseExt{base = #outBase tgt, ext = SOME "h"}
64                  }                  }
65            val prefix = (case prefix            val prefix = (case #namespace tgt
66                   of NONE => "Diderot_"                   of NONE => "Diderot_"
67                    | SOME s => s ^ "_"                    | SOME s => s ^ "_"
68                  (* end case *))                  (* end case *))
# Line 98  Line 95 
95                      [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], nrrdPtrTy, "data")])                      [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], nrrdPtrTy, "data")])
96                  ]                  ]
97            val placeholders = [            val placeholders = [
98                      ("DIDEROT_FLOAT_PRECISION", TargetUtil.floatPrecisionDef tgt),
99                      ("DIDEROT_INT_PRECISION", TargetUtil.intPrecisionDef tgt),
100                      ("DIDEROT_TARGET", TargetUtil.targetDef tgt),
101                    ("HDRFILE", filename),                    ("HDRFILE", filename),
102                    ("HDR_DEFINE", mkSymbol base),                    ("HDR_DEFINE", mkSymbol(#outBase tgt)),
103                    ("PREFIX", prefix),                    ("PREFIX", prefix),
104                    ("SRCFILE", srcFile)                    ("SRCFILE", #srcFile tgt)
105                  ]                  ]
106            val outStrm = TextIO.openOut filename            val outStrm = TextIO.openOut filename
107            val outS = PrC.new outStrm            val outS = PrC.new outStrm
108            in            in
109              PrC.output (outS, CL.verbatim [LibInterfaceHeadFrag.text] placeholders);              PrC.output (outS, CL.verbatim [LibInterfaceHeadFrag.text] placeholders);
110              PrC.output (outS, CL.D_Verbatim ["[\n/**** Setters for input values ****/\n]"]);              PrC.output (outS, CL.D_Verbatim ["\n/**** Setters for input values ****/\n"]);
111              List.app (fn input => List.app (fn dcl => PrC.output(outS, dcl)) (mkSetDecl input)) inputs;              List.app (fn input => List.app (fn dcl => PrC.output(outS, dcl)) (mkSetDecl input)) inputs;
112              PrC.output (outS, CL.verbatim [LibInterfaceBodyFrag.text] placeholders);              PrC.output (outS, CL.verbatim [LibInterfaceBodyFrag.text] placeholders);
113              PrC.output (outS, CL.D_Verbatim ["[\n/**** Getters for output values ****/\n]"]);              PrC.output (outS, CL.D_Verbatim ["\n/**** Getters for output values ****/\n"]);
114              List.app (fn output => List.app (fn dcl => PrC.output(outS, dcl)) (mkGetDecl output)) outputs;              List.app (fn output => List.app (fn dcl => PrC.output(outS, dcl)) (mkGetDecl output)) outputs;
115              PrC.output (outS, CL.verbatim [LibInterfaceFootFrag.text] placeholders);              PrC.output (outS, CL.verbatim [LibInterfaceFootFrag.text] placeholders);
116              PrC.close outS;              PrC.close outS;

Legend:
Removed from v.1701  
changed lines
  Added in v.1706

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