Mercurial > hg > CbC > old > device
view test/throw.c @ 746:f8ea174944f2
i64 continue... global table have to be fixed.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Nov 2010 22:19:55 +0900 |
parents | 6b7372e17970 |
children | c2c709727221 |
line wrap: on
line source
extern int printf(const char *,...); extern void *malloc(int); __code (*ret)(); void *env; #define ENVSIZE (1<<14) typedef struct interface1 { int a; int b; char c[100]; int last; } interface1; __code throw2(interface1 arg,int i,int j) { goto ret(3),env; } __code throw1(interface1 arg,int i,int j) { printf("%d %d %d %d %d\n",arg.last,arg.a,arg.c[99],i,j); arg.last=96; goto throw2(arg,i,74); } __code throw(interface1 arg,int i,int j) { char *space = (char *)malloc(ENVSIZE)+ENVSIZE; printf("%d %d %d %d %d\n",arg.last,arg.a,arg.c[99],i,j); arg.last=97; goto throw1(arg,i,75),space; } void setup(interface1 *arg) { register int i; for(i=0;i<100;i++) arg->c[i]=i; } int main0() { interface1 arg; arg.a = 3; arg.b = 55; setup(&arg); arg.c[99] = 66; arg.last = 96; printf("main0\n"); ret = __return; env = __environment; goto throw(arg,-7,76); } int main1() { int dummy; int dummy1; interface1 arg; char *space = (char *)malloc(ENVSIZE)+ENVSIZE; arg.a = 3; arg.b = 55; setup(&arg); arg.c[99] = 66; arg.last=98; printf("main1\n"); ret = __return; env = __environment; goto throw1(arg,-6,77),space; } int main2() { int dummy; interface1 arg; char *space = (char *)malloc(ENVSIZE)+ENVSIZE; arg.a = 3; arg.b = 55; setup(&arg); arg.c[99] = 66; arg.last=99; printf("main2\n"); ret = __return; env = __environment; goto throw1(arg,-5,78); } int main() { main0(); main1(); main2(); return 0; } /* end */