Mercurial > repos > rhope
diff cbackend_c.rhope @ 135:18a4403fe576
Javascript backend can now produce broken output. Needs fixes plus port of standard lib
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 Nov 2010 03:09:49 -0500 |
parents | 50406500334d |
children | fc3815b7462f |
line wrap: on
line diff
--- a/cbackend_c.rhope Wed Nov 10 22:29:49 2010 -0500 +++ b/cbackend_c.rhope Sun Nov 14 03:09:49 2010 -0500 @@ -325,7 +325,7 @@ ]Set["Blueprint", "TYPE_BLUEPRINT"] //12 ]Set["Array", "TYPE_ARRAY"] //13 ]Set["Boxed Array", "TYPE_BOXEDARRAY"]//14 - ]Set["Worker", "TYPE_WORKER"] //15 + ]Set["Worker", "TYPE_WORKER"] //15 ]Set["Method Missing Exception", "TYPE_METHODMISSINGEXCEPTION"] //16 ]Set["Field Missing Exception", "TYPE_FIELDMISSINGEXCEPTION"] //17 ]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]] //18 @@ -1134,6 +1134,26 @@ out <- [[[[[[Build[C Program()]]Functions <<[Dictionary[]]]Method Registry <<[C Method Registry[]]]Type Registry <<[C Type Registry[p]]]Field Registry <<[C Field Registry[]]]Libraries <<[Dictionary[]]]Escape Pattern <<[p] } +Supported Number Types@JS Program[program:out] +{ + out <- ("Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64") +} + +Needed Specials@JS Program[program,typename,makespecial:out] +{ + init name <- [" init "]Append[typename] + with init <- [()]Append[ [[()]Append[init name]]Append[[makespecial]Index["init"]] ] + [("Array","Boxed Array","Worker")]Find[=[?,typename]] + { + out <- Val[with init] + }{ + copy name <- [" copy "]Append[typename] + cleanup name <- [" cleanup "]Append[typename] + out <- [[with init]Append[ [[()]Append[copy name]]Append[[makespecial]Index["copy"]] ] + ]Append[ [[()]Append[cleanup name]]Append[[makespecial]Index["cleanup"]] ] + } +} + Link@C Program[program,language,library:out] { If[[library] = ["runtime"]] @@ -1480,6 +1500,11 @@ { out <- text } } +Text Filename@C Program[program,source name:out] +{ + out <- [source name]Append[".c"] +} + Text@C Program[program:out] { p <- [program]Escape Pattern >>