diff 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
line wrap: on
line diff
--- a/CbC-examples/rectypeTest/typedef.cbc	Wed Jun 13 17:18:58 2012 +0900
+++ b/CbC-examples/rectypeTest/typedef.cbc	Thu Jun 14 19:44:54 2012 +0900
@@ -1,21 +1,24 @@
-#include <stdio.h>
+typedef __code (CS)(__rectype*); // CS *p
 
-//typedef __code (*csPtr)(__rectype);
-typedef __code (*csPtr)(__rectype*); // TODO:  error 
+//typedef __code (*CS)(__code(*p)());
+//typedef __code (CS)(__code(*p)()); // CS *p
 
-
-//__code print(csPtr p ) { TODO:
-__code print(__rectype *p ) {
-	puts("hello");
+#include <stdio.h>
+__code cs_end(CS *p)
+{
+  printf("end\n");
 }
 
-//__code func(csPtr p ) { TODO:
-__code func(__rectype *p ) {
-	goto p(func);
+__code cs(CS *p)
+{
+  CS *b; 
+  goto p(b);
+//  goto p("aaa"); //note: expected ‘void (*)’ but argument is of type ‘char
 }
 
-
 int main() {
-	goto func(print);
-	return 0;
+  CS *p;
+  p = cs_end;
+  goto cs(p);
+  return 0;
 }