Mercurial > hg > CbC > CbC_examples
view tmp4.c @ 5:90e6146d24cd
fix stack1.c
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 19:02:57 +0900 |
parents | 175041088754 |
children | 586096c45873 |
line wrap: on
line source
#ifdef GCC #define __environment _CbC_environment #define __return _CbC_return #endif #include "stdio.h" int main0(int ac,char *av[]); __code code0(int i,int j,int k,char *av[],__code (*ret)(int,void*),void*retenv); __code code1(int i,int j,int k,char *av[],__code(*ret)(int,void*),void*retenv); __code code2(int i,int j,int k,char *av[],__code (*ret)(int, void*),void *retenv); int main(int ac,char *av[]) { int i; i=main0(ac,av); fprintf(stdout,"#0012:1: %s %d\n",av[0]+2,i); return 0; } int main0(int ac,char *av[]) { int i,j,k; i=123; j=456; k=789; fprintf(stdout,"#0025:2: %s\n",av[0]+2); goto code0(i,j,k,av,__return,__environment); return 0; } __code code0(int i,int j,int k,char *av[],__code (*ret)(int,void*),void*retenv) { char *p; p = av[0]+2; fprintf(stdout,"#0037:3: i=%d j=%d k=%d av[0]=%s p=%s\n",i,j,k,av[0]+2,p); goto code1(i,j,k,av,ret,retenv); } __code code1(int i,int j,int k,char *av[],__code(*ret)(int,void*),void*retenv) { fprintf(stdout,"#0047:4: %s\n",av[0]+2); goto code2(i,j,k,av,ret,retenv); } __code code2(int i,int j,int k,char *av[],__code (*ret)(int,void*),void *retenv) { fprintf(stdout,"#0057:5: %s\n",av[0]+2); fprintf(stdout,"#0058:5: i=%d j=%d k=%d\n",i,j,k); goto (*ret)(1234,retenv); }