view CbC-examples/rectypeTest/struct.cbc @ 108:7ad14f446135

add CbC-example/rectypeTest/
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Jun 2012 20:30:24 +0900
parents 85047c4f1ca4
children
line wrap: on
line source

struct aaa {
	__rectype *child;
};
__code test() {
	struct aaa b;
}

struct interface {
	__code (*next)(struct interface);
};


#include <stdio.h>
#include <stdlib.h>
__code csB() {
	exit(0);
}
__code print(struct interface p) {
	puts("hello");
	exit(0);
}

__code csA(struct interface p) {
	struct interface ds = { csB };
	goto p.next(ds);
//	goto p.next(3); // error
}

int main() {
	struct interface ds = { print };
	goto csA(ds);
	return 0;
}