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/c-target.sml
ViewVC logotype

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

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

revision 1827, Thu Apr 12 14:37:41 2012 UTC revision 1828, Thu Apr 12 22:46:32 2012 UTC
# Line 363  Line 363 
363          fun condCons (true, x, xs) = x::xs          fun condCons (true, x, xs) = x::xs
364            | condCons (false, _, xs) = xs            | condCons (false, _, xs) = xs
365    
366            fun verbFrag (tgt : target_desc, parFrag, seqFrag, subs) =
367                  CL.verbatim [if (#parallel tgt) then parFrag else seqFrag] subs
368    
369          fun compile (tgt : target_desc, basename) = let          fun compile (tgt : target_desc, basename) = let
370              (* generate the C compiler flags *)              (* generate the C compiler flags *)
371                val cflags = ["-I" ^ Paths.diderotInclude, "-I" ^ Paths.teemInclude]                val cflags = ["-I" ^ Paths.diderotInclude, "-I" ^ Paths.teemInclude]
# Line 436  Line 439 
439                        (CL.T_Ptr(CL.T_Ptr(CL.T_Named tyName)),   "inState"),                        (CL.T_Ptr(CL.T_Ptr(CL.T_Named tyName)),   "inState"),
440                        (CL.T_Ptr(CL.T_Ptr(CL.T_Named tyName)),   "outState")                        (CL.T_Ptr(CL.T_Ptr(CL.T_Named tyName)),   "outState")
441                      ]                      ]
442                  val body = if #parallel tgt
443                        then body @ [
444                            (CL.T_Ptr(CL.T_Named "Diderot_Sched_t"), "sched")
445                          ]
446                        else body
447                in                in
448                  if isTypedef                  if isTypedef
449                    then CL.D_StructDef(NONE, body, SOME(ns ^ "World_t"))                    then CL.D_StructDef(NONE, body, SOME(ns ^ "World_t"))
# Line 470  Line 478 
478                val ppStrm = PrintAsC.new outS                val ppStrm = PrintAsC.new outS
479                fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)                fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)
480                in                in
481  (* FIXME: use a fragment for this part of the file *)                  ppDecl (verbFrag (tgt, ParHeadFrag.text, SeqHeadFrag.text, substitutions));
                 ppDecl (CL.verbatim [CHeadFrag.text] substitutions);  
482                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));
483                  ppDecl (genWorldStruct(false, tgt, strand));                  ppDecl (genWorldStruct(false, tgt, strand));
484                  List.app ppDecl (List.rev (!topDecls));                  List.app ppDecl (List.rev (!topDecls));
# Line 484  Line 491 
491  (* FIXME: the XXX_Init function needs to include code to initialize the globals with defaults *)  (* FIXME: the XXX_Init function needs to include code to initialize the globals with defaults *)
492                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);
493                  ppDecl (!initially);                  ppDecl (!initially);
494                  ppDecl (CL.verbatim [RunFrag.text] substitutions);                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));
495                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);
496                  PrintAsC.close ppStrm;                  PrintAsC.close ppStrm;
497                  TextIO.closeOut outS                  TextIO.closeOut outS
# Line 521  Line 528 
528                val outS = TextIO.openOut fileName                val outS = TextIO.openOut fileName
529                val ppStrm = PrintAsC.new outS                val ppStrm = PrintAsC.new outS
530                fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)                fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)
               val mainFrag = if (#parallel tgt)  
                     then ParMainFrag.text  
                     else SeqMainFrag.text  
531                in                in
532                  ppDecl (CL.verbatim [ExecHdr.text] substitutions);                  ppDecl (CL.verbatim [ExecHdr.text] substitutions);
533                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));
# Line 537  Line 541 
541  (* FIXME: the XXX_Init function needs to include code to initialize the globals with defaults *)  (* FIXME: the XXX_Init function needs to include code to initialize the globals with defaults *)
542                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);                  ppDecl (CL.verbatim [AllocFrag.text] substitutions);
543                  ppDecl (!initially);                  ppDecl (!initially);
544                  ppDecl (CL.verbatim [RunFrag.text] substitutions);                  ppDecl (verbFrag (tgt, ParRunFrag.text, SeqRunFrag.text, substitutions));
545                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);                  ppDecl (CL.verbatim [ShutdownFrag.text] substitutions);
546                  ppDecl (CL.verbatim [mainFrag] substitutions);                  ppDecl (verbFrag (tgt, ParMainFrag.text, SeqMainFrag.text, substitutions));
547                  PrintAsC.close ppStrm;                  PrintAsC.close ppStrm;
548                  TextIO.closeOut outS                  TextIO.closeOut outS
549                end                end

Legend:
Removed from v.1827  
changed lines
  Added in v.1828

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