diff CbC-examples/rectypeTest/struct.cbc @ 106:85047c4f1ca4

add CbC-examples/rectypeTest
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Wed, 13 Jun 2012 17:18:58 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CbC-examples/rectypeTest/struct.cbc	Wed Jun 13 17:18:58 2012 +0900
@@ -0,0 +1,33 @@
+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;
+}