Mercurial > repos > rhope
view boolean.rhope @ 175:03e4fa277291
Use worker refs for geninterp
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 08 Jun 2011 23:24:15 -0700 |
parents | ac5c2d78663f |
children |
line wrap: on
line source
Generate Boolean Methods[backend:out] { func,inval <- [[[[[backend]Create Function["If@Boolean",("in"),("yes","no"),"rhope"] ]Set Input Type[Type Instance["Boolean"], 0] ]Set Output Type[Type Instance["Boolean"], 0] ]Set Output Type[Type Instance["Boolean"], 1] ]Read Field["in", "Val"] ifyes <- [[[func]Instruction Stream ]Move["in","yes"] ]Set Null["no"] ifno <- [[[func]Instruction Stream ]Move["in","no"] ]Set Null["yes"] ffunc <- [[func]Do If[inval, ifyes] ]Do If[NotCond[inval], ifno] out <- [backend]Store Function[ffunc] } Compile Boolean Inline Check[func,op,type,in,outyes,outno:out,no inline] { ,no inline <- If[[op]=["If"]] { ,no inline <- If[[[type]Name >>]=["Boolean"]] { ifyes <- [[func]Instruction Stream ]Move[in, outyes] ifno <- [[func]Instruction Stream ]Move[in, outno] ,inval <- [func]Read Field[Cast[in, type] "Val"] { out <- [[~]Do If[inval, ifyes] ]Do If[NotCond[inval], ifno] } } } }