Mercurial > hg > CbC > old > device
view test/tmp6.c @ 856:d9dd3e6e7c5f
macro compatibility
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Nov 2011 05:44:49 +0900 |
parents | c2c709727221 |
children | 5313ed059cee |
line wrap: on
line source
#define __environment _CbC_environment #define __return _CbC_return #include "stdio.h" char *a[] = {"test1","2"}; int main(ac,av) int ac; char *av[]; { int i; if(ac!=2) { fprintf(stdout,"#0015:a used.\n"); // return(0); i=main0(2,a,__return,__environment); return 0; } i=main0(ac,av,__return,__environment); fprintf(stdout,"#0021:1: %s %d\n",av[0],i); return 0; } int main0(ac,av,ret,retenv) int ac; char *av[]; __code (*ret)(); void *retenv; { int i,j,k; i=123; j=456; k = atoi(av[1]); fprintf(stdout,"#0036:2: av=%x av[0]=%x %s\n",av==a,av[0]==a[0],av[0]); goto code0(i,j,k,av,ret,retenv,__return,__environment); } __code code0(i,j,k,av,ret,retenv,ret1,ret1env) int i,j,k; char *av[]; __code (*ret)(); void *retenv; __code (*ret1)(); void *ret1env; { char *p; p = av[0]; fprintf(stdout,"#0050:code0\n",av[0]); goto code1(i,j,k,av,ret,retenv,ret1,ret1env); } __code code1(i,j,k,av,ret,retenv,ret1,ret1env) int i,j,k; char *av[]; __code (*ret)(); void *retenv; __code (*ret1)(); void *ret1env; { fprintf(stdout,"#0062:4: %s\n",av[0]); goto code2(i,j,k,av,ret,retenv,ret1,ret1env); } __code code2(i,j,k,av,ret,retenv,ret1,ret1env) int i,j,k; char *av[]; __code (*ret)(); void *retenv; __code (*ret1)(); void *ret1env; { fprintf(stdout,"#0074:5: %s\n",av[0]); fprintf(stdout,"#0075:5: i=%d j=%d k=%d av=%x\n",i,j,k,av==a); if (k>3) goto (*ret1)(1234,ret1env); goto (*ret)(1234,retenv); }