Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] Diff of /trunk/sml3d/src/particles/compiler/translate.sml
ViewVC logotype

Diff of /trunk/sml3d/src/particles/compiler/translate.sml

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

revision 758, Tue Feb 9 04:46:06 2010 UTC revision 769, Mon Feb 15 22:52:36 2010 UTC
# Line 344  Line 344 
344           (* end case *))           (* end case *))
345          end          end
346    
347            fun trPred(pred, env, state, thenk : particle_state -> IR.stmt, elsek : particle_state -> IR.stmt) = let
348              val PS{pos, vel, size, isDead, color} = state
349              val P.PR{ifstmt, ...} = pred
350              val thenBlk = newBlock(env, thenk)
351              val elseBlk = newBlock(env, elsek)
352             in
353              case ifstmt
354               of P.WITHIN(d) => mkWithinVar("wv", env, state, d, fn withinVar =>
355                IR.mkIF(withinVar, goto(state, thenBlk), goto(state, elseBlk)))
356             end
357    
358      fun trAct (action, env, state, k : particle_state -> IR.stmt) = let      fun trAct (action, env, state, k : particle_state -> IR.stmt) = let
359            val PS{pos, vel, size, isDead, color} = state            val PS{pos, vel, size, isDead, color} = state
360            in            in
# Line 490  Line 501 
501                  in                  in
502                    IR.mkRETURN[ pos, vel, size, isDead, color ]                    IR.mkRETURN[ pos, vel, size, isDead, color ]
503                  end (* trActs *)                  end (* trActs *)
504              | trActs (psa :: psal) state = trAct(psa, env, state, trActs psal)              | trActs (psa :: psal) state = (case psa
505                  of P.SEQ(acts) => (case acts
506                     of [] => raise Fail "Should never reach here."
507                      | [act] => trAct(act, env, state, trActs psal)
508                      | act :: rest => trAct(act, env, state, trActs (P.SEQ(rest) :: psal))
509                    (* end case *))
510                   | P.PRED(pred as P.PR{thenstmt=t, elsestmt=e, ...}) =>
511                      trPred(pred, env, state, trActs (t @ psal), trActs (e @ psal))
512                  (* end case *))
513    
514            val entryBlock = newBlock (env, fn state => trActs action state)            val entryBlock = newBlock (env, fn state => trActs action state)
515            in            in
516              IR.output(TextIO.stdErr, !blks);              IR.output(TextIO.stdErr, !blks);

Legend:
Removed from v.758  
changed lines
  Added in v.769

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