Mercurial > repos > rhope
diff nworker.rhope @ 50:689fb73e7612
Add support for various integer literals and add support for raw pointers to objects and raw pointers to arrays in the FFI
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 16 Apr 2010 01:57:04 -0400 |
parents | 3e20ed8959c4 |
children | d4b44ae2e34a |
line wrap: on
line diff
--- a/nworker.rhope Thu Apr 08 01:02:18 2010 -0400 +++ b/nworker.rhope Fri Apr 16 01:57:04 2010 -0400 @@ -369,8 +369,17 @@ If[[Type Of[[node]Data >>]] = ["Type Instance"]] { outtype <- Type Instance["Blueprint"] - }{ - outtype <- Type Instance[Type Of[[node]Data >>]] + }{ + If[[Type Of[[node]Data >>]] = ["Machine Integer"]] + { + If[[[node]Data >>]Signed? >>] + { base <- "Int" } + { base <- "UInt" } + + outtype <- Type Instance[[base]Append[ [[node]Data >>]Size >> ]] + }{ + outtype <- Type Instance[Type Of[[node]Data >>]] + } } } nextnode <- [node]Output Types <<[ [()]Append[outtype] ] @@ -645,8 +654,16 @@ { //TODO: Support parametric types datstring <- [[node]Data >>]Name >> - }{ - datstring <- [node]Data >> + }{ + If[[Type Of[[node]Data >>]] = ["Machine Integer"]] + { + If[[[node]Data >>]Signed? >>] + { s <- "i" } + { s <- "u" } + datstring <- [[[[node]Data >>]Value >>]Append[s]]Append[[[node]Data >>]Size >>] + }{ + datstring <- [node]Data >> + } } out <- Constant[[[Type Of[[node]Data >>]]Append["_"]]Append[datstring]] @@ -790,7 +807,15 @@ //TODO: Support parametric types datstring <- [[node]Data >>]Name >> }{ - datstring <- [node]Data >> + If[[Type Of[[node]Data >>]] = ["Machine Integer"]] + { + If[[[node]Data >>]Signed? >>] + { s <- "i" } + { s <- "u" } + datstring <- [[[[node]Data >>]Value >>]Append[s]]Append[[[node]Data >>]Size >>] + }{ + datstring <- [node]Data >> + } } nfunc <- [func]Register Constant[[[Type Of[[node]Data >>]]Append["_"]]Append[datstring], [node]Data >>] }{ @@ -945,7 +970,7 @@ { ,none <- [outputs]Next[index] { - out,none <- _Return Param[outputs, index, input types, ~] + out,none <- _Return Param[outputs, inputs, input types, ~] } } { out <- index