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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/codegen/gen-library-interface.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/codegen/gen-library-interface.sml

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

revision 3904, Mon May 23 18:44:15 2016 UTC revision 3905, Mon May 23 20:36:28 2016 UTC
# Line 40  Line 40 
40      structure CL = CLang      structure CL = CLang
41      structure Spec = TargetSpec      structure Spec = TargetSpec
42      structure Env = CodeGenEnv      structure Env = CodeGenEnv
43      structure PrC = PrintAsC      structure Out = CodeOutput
44    
45        val openOut = Out.openOut {ext = "h", ppDecl = PrintAsC.output}
46    
47      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")      val nrrdPtrTy = CL.T_Ptr(CL.T_Named "Nrrd")
48    
# Line 140  Line 142 
142                      [], CL.boolTy, (if snapshot then snapshotGet else outputGet)(spec, name),                      [], CL.boolTy, (if snapshot then snapshotGet else outputGet)(spec, name),
143                      [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], nrrdPtrTy, "data")])                      [CL.PARAM([], worldPtrTy, "wrld"), CL.PARAM([], nrrdPtrTy, "data")])
144                  ]                  ]
145              val outS = openOut filename
146  (* NOTE: there is some redundancy between placeholders and the substitutions defined in the target files *)  (* NOTE: there is some redundancy between placeholders and the substitutions defined in the target files *)
147            val placeholders = [            val placeholders = [
148                    ("DIDEROTC_CMD", #diderotc spec),                    ("DIDEROTC_CMD", #diderotc spec),
# Line 148  Line 151 
151                    ("DIDEROT_FLOAT_PRECISION", Spec.floatPrecisionDef spec),                    ("DIDEROT_FLOAT_PRECISION", Spec.floatPrecisionDef spec),
152                    ("DIDEROT_INT_PRECISION", Spec.intPrecisionDef spec),                    ("DIDEROT_INT_PRECISION", Spec.intPrecisionDef spec),
153                    ("DIDEROT_TARGET", Spec.targetDef spec),                    ("DIDEROT_TARGET", Spec.targetDef spec),
154                    ("HDRFILE", filename),                    ("HDRFILE", Out.filename outS),
155                    ("HDR_DEFINE", mkSymbol(#outBase spec)),                    ("HDR_DEFINE", mkSymbol(#outBase spec)),
156                    ("PREFIX", #namespace spec),                    ("PREFIX", #namespace spec),
157                    ("SRCFILE", #srcFile spec)                    ("SRCFILE", #srcFile spec)
158                  ]                  ]
159            val outStrm = TextIO.openOut filename            val prDecl = Out.decl outS
160            val outS = PrC.new outStrm            val prFrag = Out.fragment placeholders outS
161            fun prFrag frag = PrC.output (outS, CL.verbatimDcl [frag] placeholders)            val prDecls = List.app prDecl
           val prDecls = List.app (fn dcl => PrC.output(outS, dcl))  
162            in            in
163              prFrag Fragments.libHHead;              prFrag Fragments.libHHead;
164              PrC.output (outS, CL.D_Verbatim ["\n/**** Functions etc. for input variables ****/\n"]);              prDecl (CL.D_Verbatim ["\n/**** Functions etc. for input variables ****/\n"]);
165              List.app (fn input => prDecls (mkInputDecls input)) inputs;              List.app (fn input => prDecls (mkInputDecls input)) inputs;
166              case rt of SOME rt => prFrag rt | _ => ();              case rt of SOME rt => prFrag rt | _ => ();
167              prFrag Fragments.libHBody;              prFrag Fragments.libHBody;
168              PrC.output (outS, CL.D_Verbatim ["\n/**** Getters for output values ****/\n"]);              prDecl (CL.D_Verbatim ["\n/**** Getters for output values ****/\n"]);
169              if (#snapshot spec)              if (#snapshot spec)
170                then List.app (fn output => prDecls (mkGetDecl true output)) outputs                then List.app (fn output => prDecls (mkGetDecl true output)) outputs
171                else ();                else ();
172              List.app (fn output => prDecls (mkGetDecl false output)) outputs;              List.app (fn output => prDecls (mkGetDecl false output)) outputs;
173              prFrag Fragments.libHFoot;              prFrag Fragments.libHFoot;
174              PrC.close outS;              Out.closeOut outS
             TextIO.closeOut outStrm  
175            end            end
176    
177    end    end

Legend:
Removed from v.3904  
changed lines
  Added in v.3905

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