comparison CbC-examples/rectypeTest/typedef.cbc @ 107:a3a2f64cf8f4

modify implementation of rectype
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Jun 2012 19:44:54 +0900
parents 85047c4f1ca4
children
comparison
equal deleted inserted replaced
106:85047c4f1ca4 107:a3a2f64cf8f4
1 typedef __code (CS)(__rectype*); // CS *p
2
3 //typedef __code (*CS)(__code(*p)());
4 //typedef __code (CS)(__code(*p)()); // CS *p
5
1 #include <stdio.h> 6 #include <stdio.h>
2 7 __code cs_end(CS *p)
3 //typedef __code (*csPtr)(__rectype); 8 {
4 typedef __code (*csPtr)(__rectype*); // TODO: error 9 printf("end\n");
5
6
7 //__code print(csPtr p ) { TODO:
8 __code print(__rectype *p ) {
9 puts("hello");
10 } 10 }
11 11
12 //__code func(csPtr p ) { TODO: 12 __code cs(CS *p)
13 __code func(__rectype *p ) { 13 {
14 goto p(func); 14 CS *b;
15 goto p(b);
16 // goto p("aaa"); //note: expected ‘void (*)’ but argument is of type ‘char
15 } 17 }
16 18
17
18 int main() { 19 int main() {
19 goto func(print); 20 CS *p;
20 return 0; 21 p = cs_end;
22 goto cs(p);
23 return 0;
21 } 24 }