# HG changeset patch # User Nobuyasu Oshiro # Date 1339674192 -32400 # Node ID 78d3881f288212ad31ea794737a82deadcf3054f # Parent 7ad14f4461359cc36969ecd237f979112edb96a7 add CbC-example/rectype diff -r 7ad14f446135 -r 78d3881f2882 CbC-examples/rectype/rectype.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CbC-examples/rectype/rectype.cbc Thu Jun 14 20:43:12 2012 +0900 @@ -0,0 +1,22 @@ +#include +#include +__code print(__rectype *p) +{ + printf("print\n"); + exit(0); +} +__code csA(__rectype *p) +{ + goto p(csA); +} + +void main1() +{ + goto csA(print); +} + +int main() +{ + main1(); + return 0; +} diff -r 7ad14f446135 -r 78d3881f2882 CbC-examples/rectype/struct.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CbC-examples/rectype/struct.cbc Thu Jun 14 20:43:12 2012 +0900 @@ -0,0 +1,30 @@ +#include +#include +struct interface { + __code (*next)(struct interface); +}; + +__code print(struct interface p) +{ + printf("print\n"); + exit(0); +} +__code csA(struct interface p) +{ + struct interface ds; + ds.next = csA; + goto p.next(ds); +} + +void main1() +{ + struct interface ds; + ds.next = print; + goto csA(ds); +} + +int main() +{ + main1(); + return 0; +}