comparison cbackend.rhope @ 49:3e20ed8959c4

Added initial FFI implementation, Array type and 64-bit integers
author Mike Pavone <pavone@retrodev.com>
date Thu, 08 Apr 2010 01:02:18 -0400
parents a24eb366195c
children 689fb73e7612
comparison
equal deleted inserted replaced
48:a24eb366195c 49:3e20ed8959c4
136 variant <- [type]Variant >> 136 variant <- [type]Variant >>
137 If[[[type]Name >>] = ["Array"]] 137 If[[[type]Name >>] = ["Array"]]
138 { 138 {
139 [("Naked","Raw Pointer")]Find[variant] 139 [("Naked","Raw Pointer")]Find[variant]
140 { 140 {
141 /*
142 //Below code assumes that paramaterized types are implemented
141 pre param <- [[type]Params >>]Index[0] {} 143 pre param <- [[type]Params >>]Index[0] {}
142 { pre param <- Type Instance["Any Type"] } 144 { pre param <- Type Instance["Any Type"] }
143 [[type]Params >>]Index[1] 145 [[type]Params >>]Index[1]
144 { param,param <- [pre param]Set Variant[~] } 146 { param,param <- [pre param]Set Variant[~] }
145 { param <- Val[pre param] } 147 { param <- Val[pre param] }
149 out <- Val[child type] 151 out <- Val[child type]
150 array <- "[1]" 152 array <- "[1]"
151 }{ 153 }{
152 out <- [child type]Append[" *"] 154 out <- [child type]Append[" *"]
153 array <- "" 155 array <- ""
154 } 156 } */
157 out <- "void *"
158 array <- ""
155 }{ 159 }{
156 typename <- "Array" 160 typename <- "Array"
157 } 161 }
158 primitive <- No 162 primitive <- No
159 }{ 163 }{
160 ,regulartype <- [("Naked","Raw Pointer")]Find[variant] 164 ,regulartype <- [("Naked","Raw Pointer")]Find[variant]
161 { 165 {
162 [("Int32","Int16","Int8")]Find[[type]Name >>] 166 [("Int64","Int32","Int16","Int8")]Find[[type]Name >>]
163 { 167 {
164 primitive <- Yes 168 primitive <- Yes
165 [[type]Name >>]Slice[3] {} 169 [[type]Name >>]Slice[3] {}
166 { typename <- [["int"]Append[~]]Append["_t"] } 170 { typename <- [["int"]Append[~]]Append["_t"] }
167 }{ 171 }{
168 ,regulartype <- [("UInt32","UInt16","UInt8")]Find[[type]Name >>] 172 ,regulartype <- [("UInt64","UInt32","UInt16","UInt8")]Find[[type]Name >>]
169 { 173 {
170 primitive <- Yes 174 primitive <- Yes
171 [[type]Name >>]Slice[4] {} 175 [[type]Name >>]Slice[4] {}
172 { typename <- [["uint"]Append[~]]Append["_t"] } 176 { typename <- [["uint"]Append[~]]Append["_t"] }
173 } 177 }
233 { 237 {
234 If[[[[ctype]Fields >>]Length] = [1]] 238 If[[[[ctype]Fields >>]Length] = [1]]
235 { 239 {
236 out <- [[[_Type Def C Type["typedef struct {\n\tobject _SP_header;\n\t", [[ctype]Fields >>]Index[0]]]Append["\n} t_"]]Append[[ctype]Name >>]]Append[";"] 240 out <- [[[_Type Def C Type["typedef struct {\n\tobject _SP_header;\n\t", [[ctype]Fields >>]Index[0]]]Append["\n} t_"]]Append[[ctype]Name >>]]Append[";"]
237 }{ 241 }{
238 out <- [Fold["_Type Def C Type", "OBegin", [ctype]Fields >>]]Append[ [["\nObject("]Append[Escape Rhope Name[[ctype]Name >>]]]Append[")"] ] 242 //HACK!!!
243 If[[[ctype]Name >>]=["Blueprint"]]
244 {
245 out <- ""
246 }{
247 If[[[ctype]Name >>]=["Array"]]
248 { oend <- "\nMObject(" }
249 { oend <- "\nObject(" }
250 out <- [Fold["_Type Def C Type", "OBegin", [ctype]Fields >>]]Append[ [[oend]Append[Escape Rhope Name[[ctype]Name >>]]]Append[")"] ]
251 }
239 } 252 }
240 } 253 }
241 254
242 _Type Init C[type name,method reg,text,method:out] 255 _Type Init C[type name,method reg,text,method:out]
243 { 256 {
251 ]Append[[["\n\tadd_setter(bp, "]Append[ [field reg]Field ID[fname] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" <<"]]]]Append[[","]Append[Escape Rhope Name[type name]]]]]]Append["));"] 264 ]Append[[["\n\tadd_setter(bp, "]Append[ [field reg]Field ID[fname] ]]Append[ [[", MethodName("]Append[Escape Rhope Name[[fname]Append[" <<"]]]]Append[[","]Append[Escape Rhope Name[type name]]]]]]Append["));"]
252 } 265 }
253 266
254 Type Init@C Type[ctype,id,method reg,field reg:out] 267 Type Init@C Type[ctype,id,method reg,field reg:out]
255 { 268 {
269 If[[[ctype]Name >>]=["Array"]]
270 { size <- "-1" }
271 {
272 [("Int64","Int32","Int16","Int8")]Find[[ctype]Name >>]
273 {
274 [[ctype]Name >>]Slice[3] {}
275 { typename <- [["int"]Append[~]]Append["_t"] }
276 }{
277 [("UInt64","UInt32","UInt16","UInt8")]Find[[ctype]Name >>]
278 {
279 [[ctype]Name >>]Slice[4] {}
280 { typename <- [["uint"]Append[~]]Append["_t"] }
281 }{
282 If[[[ctype]Name >>]=["Blueprint"]]
283 { typename <- "blueprint *" }
284 {
285 If[[[ctype]Name >>]=["Boolean"]]
286 { typename <- "int32_t" }
287 { typename <- ["nt_"]Append[Escape Rhope Name[[ctype]Name >>]] }
288 }
289 }
290 }
291 size <- [["sizeof("]Append[typename]]Append[")"]
292 }
256 start <- [["\tbp = register_type_byid(" 293 start <- [["\tbp = register_type_byid("
257 ]Append[id] 294 ]Append[id]
258 ]Append[ 295 ]Append[
259 [[", sizeof(" 296 [[", "]Append[size]
260 ]Append[ 297 ]Append[
261 ["t_"]Append[Escape Rhope Name[ [ctype]Name >> ]]] 298 [", (special_func)"]Append[
262 ]Append[
263 ["), (special_func)"]Append[
264 [ 299 [
265 [[[[Escape Rhope Name NU[[ctype]Init >>] 300 [[[[Escape Rhope Name NU[[ctype]Init >>]
266 ]Append[", (special_func)"] 301 ]Append[", (special_func)"]
267 ]Append[Escape Rhope Name NU[[ctype]Copy >> ]] 302 ]Append[Escape Rhope Name NU[[ctype]Copy >> ]]
268 ]Append[", (special_func)"] 303 ]Append[", (special_func)"]
279 } 314 }
280 315
281 C Type Registry[:out] 316 C Type Registry[:out]
282 { 317 {
283 out <- [[[Build["C Type Registry"]]Lookup << [ 318 out <- [[[Build["C Type Registry"]]Lookup << [
284 [[[[[[[[[[[[[[[[Dictionary[] 319 [[[[[[[[[[[[[[[[[Dictionary[]
285 ]Set["UInt8", "TYPE_UINT8"] 320 ]Set["UInt8", "TYPE_UINT8"]
286 ]Set["UInt16", "TYPE_UINT16"] 321 ]Set["UInt16", "TYPE_UINT16"]
287 ]Set["UInt32", "TYPE_UINT32"] 322 ]Set["UInt32", "TYPE_UINT32"]
288 ]Set["UInt64", "TYPE_UINT64"] 323 ]Set["UInt64", "TYPE_UINT64"]
289 ]Set["Int8", "TYPE_INT8"] 324 ]Set["Int8", "TYPE_INT8"]
292 ]Set["Int64", "TYPE_INT64"] 327 ]Set["Int64", "TYPE_INT64"]
293 ]Set["Boolean", "TYPE_BOOLEAN"] 328 ]Set["Boolean", "TYPE_BOOLEAN"]
294 ]Set["Float32", "TYPE_FLOAT32"] 329 ]Set["Float32", "TYPE_FLOAT32"]
295 ]Set["Float64", "TYPE_FLOAT64"] 330 ]Set["Float64", "TYPE_FLOAT64"]
296 ]Set["Real Number", "TYPE_FLOAT64"] 331 ]Set["Real Number", "TYPE_FLOAT64"]
332 ]Set["Blueprint", "TYPE_BLUEPRINT"]
297 ]Set["Array", "TYPE_ARRAY"] 333 ]Set["Array", "TYPE_ARRAY"]
298 ]Set["Method Missing Exception", "TYPE_METHODMISSINGEXCEPTION"] 334 ]Set["Method Missing Exception", "TYPE_METHODMISSINGEXCEPTION"]
299 ]Set["Field Missing Exception", "TYPE_FIELDMISSINGEXCEPTION"] 335 ]Set["Field Missing Exception", "TYPE_FIELDMISSINGEXCEPTION"]
300 ]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]] 336 ]Set["Wrong Type Exception", "TYPE_WRONGTYPEEXCEPTION"]]
301 ]Definitions << [Dictionary[]] 337 ]Definitions << [Dictionary[]]
318 } 354 }
319 355
320 Type Inits@C Type Registry[reg,method reg,field reg:out] 356 Type Inits@C Type Registry[reg,method reg,field reg:out]
321 { 357 {
322 out <- Fold[[[["_Type Inits C"]Set Input[0, reg]]Set Input[1, method reg]]Set Input[2, field reg], "", [reg]Definitions >>] 358 out <- Fold[[[["_Type Inits C"]Set Input[0, reg]]Set Input[1, method reg]]Set Input[2, field reg], "", [reg]Definitions >>]
359 { Print["Type inits got output"] }
323 } 360 }
324 361
325 Register Type@C Type Registry[reg,def:out] 362 Register Type@C Type Registry[reg,def:out]
326 { 363 {
327 name <- [def]Name >> 364 name <- [def]Name >>
341 } 378 }
342 } 379 }
343 380
344 Type ID@C Type Registry[reg,name:out,notfound] 381 Type ID@C Type Registry[reg,name:out,notfound]
345 { 382 {
346 out,notfound <- [[reg]Lookup >>]Index[name] 383 out <- [[reg]Lookup >>]Index[name] {}
384 {
385 ,notfound <- If[[name]=["Any Type"]]
386 { out <- "0" }
387 }
347 } 388 }
348 389
349 Simple Type?@C Type Registry[reg,name:yep,nope,notfound] 390 Simple Type?@C Type Registry[reg,name:yep,nope,notfound]
350 { 391 {
351 Print[["Symple Type?: "]Append[name]] 392 Print[["Symple Type?: "]Append[name]]
507 548
508 Do AddRef@C Function[func,psource,pdest:out] 549 Do AddRef@C Function[func,psource,pdest:out]
509 { 550 {
510 source <- [psource]Make Op[func] 551 source <- [psource]Make Op[func]
511 dest <- [pdest]Make Op[func] 552 dest <- [pdest]Make Op[func]
512 out <- [func]Add Statement[[[[dest]Append[" = add_ref("]]Append[source]]Append[")"]] 553 out <- [func]Add Statement[[[[dest]Append[" = add_ref((object *)"]]Append[source]]Append[")"]]
513 } 554 }
514 555
515 AddRef No Dest@C Function[func,psource:out] 556 AddRef No Dest@C Function[func,psource:out]
516 { 557 {
517 source <- [psource]Make Op[func] 558 source <- [psource]Make Op[func]
518 out <- [func]Add Statement[[["add_ref("]Append[source]]Append[")"]] 559 out <- [func]Add Statement[[["add_ref((object *)"]Append[source]]Append[")"]]
519 } 560 }
520 561
521 Release@C Function[func,psource:out] 562 Release@C Function[func,psource:out]
522 { 563 {
523 source <- [psource]Make Op[func] 564 source <- [psource]Make Op[func]
565 Print[["Release: "]Append[source]]
524 out <- [func]Add Statement[[["release_ref("]Append[source]]Append[")"]] 566 out <- [func]Add Statement[[["release_ref("]Append[source]]Append[")"]]
525 } 567 }
526 568
527 Set Null@C Function[func,pdest:out] 569 Set Null@C Function[func,pdest:out]
528 { 570 {
624 ]Append[", &"] 666 ]Append[", &"]
625 ]Append[dest] 667 ]Append[dest]
626 ]Append[")"] ] 668 ]Append[")"] ]
627 } 669 }
628 670
671 Get Raw Pointer@C Function[func,psource,pdest:out]
672 {
673 dest <- [pdest]Make Op[func]
674 source <- [psource]Make Op[func]
675 out <- [func]Add Statement[ [[[dest]Append[" = &("]]Append[source]]Append["->payload)"] ]
676 }
677
678 Array Raw Pointer@C Function[func,psource,pdest:out]
679 {
680 dest <- [pdest]Make Op[func]
681 source <- [psource]Make Op[func]
682 out <- [func]Add Statement[ [[[dest]Append[" = ((char *)"]]Append[source]]Append[")+ sizeof(t_Array)"] ]
683 }
684
629 _Function Arg C[func,val,inputnum:out] 685 _Function Arg C[func,val,inputnum:out]
630 { 686 {
631 out <- [func]Add Statement[ 687 out <- [func]Add Statement[
632 [[["call->params[" 688 [[["call->params["
633 ]Append[inputnum] 689 ]Append[inputnum]
646 out <- [func]Func Base[Escape Rhope Name[name],args, "Call"] 702 out <- [func]Func Base[Escape Rhope Name[name],args, "Call"]
647 } 703 }
648 704
649 Func Base@C Function[func,tocall,args,type:out] 705 Func Base@C Function[func,tocall,args,type:out]
650 { 706 {
707 Pretty Print[args, ""]
708 {
651 rargs <- Map[args, ["Make Op"]Set Input[1, func]] 709 rargs <- Map[args, ["Make Op"]Set Input[1, func]]
652 out <- [Fold["_Function Arg C", func, rargs] 710 out <- [Fold["_Function Arg C", func, rargs]
653 ]Add Raw Line[[[[[ [type]Append["("] ]Append[tocall]]Append[", "]]Append[ [rargs]Length ]]Append[")"]] 711 ]Add Raw Line[[[[[ [type]Append["("] ]Append[tocall]]Append[", "]]Append[ [rargs]Length ]]Append[")"]]
712 }
713 }
714
715 Call Foreign@C Function[func,name,language,args,store result:out]
716 {
717 rargs <- Map[args, ["Make Op"]Set Input[1, func]]
718 //Assume language = "C" for now
719 base <- [[[name]Append["("]]Append[ Join[rargs, ", "] ]]Append[")"]
720 ,do store <- If[[Type Of[store result]]=["String"]]
721 {
722 ,do store <- If[[store result]=[""]]
723 { stmt <- Val[base] }
724 }
725
726 Val[do store]
727 { stmt <- [[Make Op[store result, func]]Append[" = "]]Append[base] }
728 out <- [func]Add Statement[stmt]
654 } 729 }
655 730
656 Field Base@C Function[func,field,args,type:out] 731 Field Base@C Function[func,field,args,type:out]
657 { 732 {
658 rargs <- Map[args, ["Make Op"]Set Input[1, func]] 733 rargs <- Map[args, ["Make Op"]Set Input[1, func]]
691 out <- ["locals->"]Append[Escape Rhope Name[op]] 766 out <- ["locals->"]Append[Escape Rhope Name[op]]
692 } 767 }
693 }{ 768 }{
694 out <- Escape Rhope Name[op] 769 out <- Escape Rhope Name[op]
695 } 770 }
771 }
772
773 Resolve Output@C Function[func,name:out]
774 {
775 If[[[func]Convention >>] = ["rhope"]]
776 {
777 out <- ["locals->"]Append[Escape Rhope Name[name]]
778 }{
779 out <- Escape Rhope Name[name]
780 }
696 } 781 }
697 782
698 Instruction Stream@C Function[func:out] 783 Instruction Stream@C Function[func:out]
699 { 784 {
700 out <- [func]Statements <<[()] 785 out <- [func]Statements <<[()]
720 out <- [["call->params["]Append[output]]Append["]"] 805 out <- [["call->params["]Append[output]]Append["]"]
721 } 806 }
722 807
723 If Null Else@C Function[func,left,right:out] 808 If Null Else@C Function[func,left,right:out]
724 { 809 {
810 check <- [[Make Condition[left]]Strip Addref]Make Op[func]
811 l <- [left]Make Op[func]
812 r <- [right]Make Op[func]
725 out <- [[[[[["(" 813 out <- [[[[[["("
726 ]Append[left] 814 ]Append[check]
727 ]Append[" ? "] 815 ]Append[" ? "]
728 ]Append[left] 816 ]Append[l]
729 ]Append[" : "] 817 ]Append[" : "]
730 ]Append[right] 818 ]Append[r]
731 ]Append[")"] 819 ]Append[")"]
732 } 820 }
733 821
734 _Set Outputs C[string,inputname,inputnum:out] 822 _Set Outputs C[string,inputname,inputnum:out]
735 { 823 {
760 } 848 }
761 849
762 850
763 Definitions@C Function[func:out] 851 Definitions@C Function[func:out]
764 { 852 {
853 Print[["Definitions@C Function: "]Append[[func]Name >>]]
854 {
765 If[ [[[func]Convention >>] = ["rhope"]] And [[ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] > [0]] ] 855 If[ [[[func]Convention >>] = ["rhope"]] And [[ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] > [0]] ]
766 { 856 {
767 localtype <- [[[Fold[["_Output Defs C"]Set Input[3, func], Fold["_Var Defs C","typedef struct {\n", [func]Variables >>], [func]Outputs >>]]Append["} l_"]]Append[Escape Rhope Name[[func]Name >>]]]Append[";\n"] 857 localtype <- [[[Fold[["_Output Defs C"]Set Input[3, func], Fold["_Var Defs C","typedef struct {\n", [func]Variables >>], [func]Outputs >>]]Append["} l_"]]Append[Escape Rhope Name[[func]Name >>]]]Append[";\n"]
768 }{ 858 }{
769 localtype <- "" 859 localtype <- ""
784 } 874 }
785 }{ 875 }{
786 proto <- [[func]Naked Proto]Append[";\n"] 876 proto <- [[func]Naked Proto]Append[";\n"]
787 } 877 }
788 out <- [localtype]Append[proto] 878 out <- [localtype]Append[proto]
879 }
789 } 880 }
790 881
791 _Proto Input[list,input,index,types:out] 882 _Proto Input[list,input,index,types:out]
792 { 883 {
793 out <- [list]Append[ [[Rhope Type to C[[types]Index[index]]]Append[" "]]Append[Escape Rhope Name[input]] ] 884 out <- [list]Append[ [[Rhope Type to C[[types]Index[index]]]Append[" "]]Append[Escape Rhope Name[input]] ]
836 } 927 }
837 } 928 }
838 929
839 Text@C Function[func:out] 930 Text@C Function[func:out]
840 { 931 {
932 Print[["Text@C Function: "]Append[[func]Name >>]]
841 If[ [[func]Convention >>] = ["rhope"] ] 933 If[ [[func]Convention >>] = ["rhope"] ]
842 { 934 {
843 cname <- Escape Rhope Name[[func]Name >>] 935 cname <- Escape Rhope Name[[func]Name >>]
844 param check <- Fold[["Check Param Type C"]Set Input[3, func], "", [func]Input Types >>] 936 param check <- Fold[["Check Param Type C"]Set Input[3, func], "", [func]Input Types >>]
845 If[ [ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] = [0] ] 937 If[ [ [[[func]Variables >>]Length]+[[[func]Outputs >>]Length] ] = [0] ]
880 { 972 {
881 Functions 973 Functions
882 Method Registry 974 Method Registry
883 Field Registry 975 Field Registry
884 Type Registry 976 Type Registry
977 Libraries
885 } 978 }
886 979
887 C Program[:out] 980 C Program[:out]
888 { 981 {
889 out <- [[[[Build["C Program"]]Functions <<[Dictionary[]]]Method Registry <<[C Method Registry[]]]Type Registry <<[C Type Registry[]]]Field Registry <<[C Field Registry[]] 982 out <- [[[[[Build["C Program"]]Functions <<[Dictionary[]]]Method Registry <<[C Method Registry[]]]Type Registry <<[C Type Registry[]]]Field Registry <<[C Field Registry[]]]Libraries <<[Dictionary[]]
983 }
984
985 Link@C Program[program,language,library:out]
986 {
987 If[[library] = ["runtime"]]
988 {
989 out <- program
990 }{
991 langlibs <- [[program]Libraries >>]Index[language] {}
992 { langlibs <- Dictionary[] }
993 out <- [program]Libraries <<[ [[program]Libraries >>]Set[language, [langlibs]Set[library, Yes]] ]
994 }
890 } 995 }
891 996
892 Register Type@C Program[program,def:out] 997 Register Type@C Program[program,def:out]
893 { 998 {
894 out <- [[[program]Type Registry <<[ [[program]Type Registry >>]Register Type[def] ] 999 out <- [[[program]Type Registry <<[ [[program]Type Registry >>]Register Type[def] ]
942 out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ] 1047 out <- [text]Append[ [["object * _const_"]Append[Escape Rhope Name[name]]]Append[";\n"] ]
943 } 1048 }
944 1049
945 _Set Consts C Program[text,value,name,type reg:out] 1050 _Set Consts C Program[text,value,name,type reg:out]
946 { 1051 {
1052 Print[["_Set Consts: "]Append[valtype]]
1053 Pretty Print[value, "_Set Consts: "]
947 //TODO: Support more constant types 1054 //TODO: Support more constant types
948 valtype <- Type Of[value] 1055 valtype <- Type Of[value]
949 [("Int32","Whole Number")]Find[valtype] 1056 [("Int32","Whole Number")]Find[valtype]
950 { 1057 {
951 out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Int32("]]Append[value]]Append[");\n"]] 1058 out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Int32("]]Append[value]]Append[");\n"]]
1059 { Print["_Set Consts got output integer"] }
952 }{ 1060 }{
953 If[[valtype] = ["Type Instance"]] 1061 If[[valtype] = ["Type Instance"]]
954 { 1062 {
955 //TODO: Support parametric types 1063 //TODO: Support parametric types
956 typeid <- [type reg]Type ID[[value]Name >>] 1064 typeid <- [type reg]Type ID[[value]Name >>]
957 out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Blueprint("]]Append[typeid]]Append[");\n"]] 1065 out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Blueprint("]]Append[typeid]]Append[");\n"]]
1066 { Print["_Set Consts got output blueprint"] }
958 }{ 1067 }{
959 If[[valtype] = ["Yes No"]] 1068 If[[valtype] = ["Yes No"]]
960 { 1069 {
961 If[value] 1070 If[value]
962 { 1071 {
963 out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_yes;\n"]] 1072 out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_yes;\n"]]
1073 { Print["_Set Consts got output yes"] }
964 }{ 1074 }{
965 out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_no;\n"]] 1075 out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_no;\n"]]
1076 { Print["_Set Consts got output no"] }
966 } 1077 }
967 } 1078 }
968 } 1079 }
969 } 1080 }
970 } 1081 }
978 #include \"object.h\" 1089 #include \"object.h\"
979 #include \"context.h\" 1090 #include \"context.h\"
980 #include \"func.h\" 1091 #include \"func.h\"
981 #include \"integer.h\" 1092 #include \"integer.h\"
982 #include \"blueprint.h\" 1093 #include \"blueprint.h\"
1094 #include \"array.h\"
983 #include \"bool.h\"\n\n" 1095 #include \"bool.h\"\n\n"
984 out <- [[[[[[headers 1096 out <- [[[[[[headers
985 ]Append[[[program]Type Registry >>]Type Defs] 1097 ]Append[[[program]Type Registry >>]Type Defs]
986 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>], 1098 ]Append[Fold[["_Text C Program"]Set Input[2, [program]Type Registry >>],
987 Fold["_Consts C Program", 1099 Fold["_Consts C Program",
988 Fold["_Defs C Program", "", [program]Functions >>], 1100 Fold["_Defs C Program", "", [program]Functions >>],
989 constants 1101 constants
990 ], [program]Functions >>]] 1102 ], [program]Functions >>]]
991 ]Append["#include \"builtin.c\"\n\nint main(int argc, char **argv) 1103 ]Append["#include \"builtin.c\"\n#include \"array.c\"\n\nint main(int argc, char **argv)
992 { 1104 {
993 returntype ret; 1105 returntype ret;
994 calldata *cdata; 1106 calldata *cdata;
995 context * ct; 1107 context * ct;
996 blueprint * bp; 1108 blueprint * bp;