Mercurial > hg > CbC > old > device
view test/tmp1.c @ 462:f7c87020e6fe
inline
author | kono |
---|---|
date | Fri, 03 Dec 2004 01:05:17 +0900 |
parents | c55363eff5e5 |
children | a379da780856 |
line wrap: on
line source
/* easy test */ code (*ret)(); void *env; main0(ac,av) int ac; char *av[]; { ret = return; env = environment; printf("main0 %d start.\n",ac); if (ac>=1) goto code0(ac,av,return); goto code1(ac,av,exit1); // not reached. (warning?) printf("main0 %d end.\n",ac); } code exit1(int ac) { // exit(0); goto code3(0,1,2,3,4,5); } code code3(a,b,c,d,e,f) char a,b; int c,d,e,f; { printf("code3: %d %d %d %d %d %d\n",a,b,c,d,e,f); if(a<10) goto code3(a+1,b,c,d,e,f); else goto code4(a+3,b+3,c+3,d+3,e+3,f+3); } code code4(a,b,c,d,e,f) char a,b; int c,d,e,f; { int i=1,j=2; printf("code4: %d %d %d %d %d %d\n",a,b,c,d,e,f); if(a<20) // cyclic binary dependency goto code3(a+b,b+c,c+d,d+e,e+f,f+a); else if(a<30) goto code3(a,b,c,d,e,f); else if(a<40) // cyclic dependency 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; } code code0(ac,av,ret) int ac; char *av[]; code ret(); { goto code1(ac,av,ret); } code code1(ac,av,exit) int ac,exit; char *av[]; { code (*f)(int); printf("code1: %d\n",ac); f = exit; if (ac>3) goto code1(ac,av,f); else if (ac>2) goto code1(av,ac,f); else goto (*f)(ac),env; } int main(int ac,char *av[]) { main0(1,av); printf("main continue.\n"); main0(0,av); printf("main end.\n"); } /* end */