diff CbC-examples/tmp1.c @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 5d30d517ebed
children
line wrap: on
line diff
--- a/CbC-examples/tmp1.c	Wed Apr 11 18:46:58 2018 +0900
+++ b/CbC-examples/tmp1.c	Wed Apr 11 19:32:28 2018 +0900
@@ -5,12 +5,16 @@
 
 extern int printf(const char *,...);
 
-__code code0(int ac,char *av[],__code (*ret)());
-__code code1(int ac,char *av[],__code (*exit)(int,void*))
+#if 0 //currently gcc version dose not support void type full continuation.
 
-__code (*ret)();
+__code code0(int ac,char *av[],__code (*ret)(void*));
+__code code1(int ac,char *av[],__code (*exit)(void*));
+__code code3(char a,char b,int c,int d,int e,int f);
+__code code4(char a,char b,int c,int d,int e,int f);
+
+__code (*ret)(void *);
 void *env;
-__code exit1(int ac,void *);
+__code exit1(void *);
 
 void main0(ac,av)
 int ac;
@@ -26,7 +30,7 @@
     printf("#0022:main0 %d end.\n",ac);
 }
 
-__code exit1(int ac)
+__code exit1(void *env)
 {
     // exit(0);
     goto code3(0,1,2,3,4,5);
@@ -57,39 +61,40 @@
 	goto code3(b,c,a,e,f,d);
     else if(a<50)
 	goto code4(a+i,b+j,c+i,d+3,e+3,f+3);
-    else goto ret(0,env);
+    else goto ret(env);
 }
 
 __code code0(ac,av,ret)
 int ac;
 char *av[];
-__code (*ret)(int);
+__code (*ret)(void *env);
 {
     goto code1(ac,av,ret);
 }
 
 __code code1(ac,av,exit)
 int ac;
-__code (*exit)(int,void*);
+__code (*exit)(void*);
 char *av[];
 {
-    __code (*f)(int,void *);
+    __code (*f)(void *);
     printf("#0073:code1: %d\n",ac);
     f = exit;
     if (ac>3)
 	goto code1(ac,av,f);
     else if (ac>2)
-	goto code1(av,ac,f);
+	goto code1(ac,av,f);
     else
-	goto (*f)(ac,env);
+	goto (*f)(env);
 }
 
-int
-main(int ac,char *av[])
+#endif
+
+int main(int ac,char *av[])
 {
-   main0(1,av);
+//   main0(1,av);
    printf("#0087:main continue.\n");
-   main0(0,av);
+//   main0(0,av);
    printf("#0089:main end.\n");
 return 0;
 }