Mercurial > hg > CbC > old > device
view test/arg.c @ 171:3902240d4930
*** empty log message ***
author | kono |
---|---|
date | Mon, 24 Nov 2003 20:28:19 +0900 |
parents | 82d0e30f61dd |
children | 096559f07a70 |
line wrap: on
line source
#include "stdio.h" struct arg { int a0;int a1;int a2;int a3;int a4; }; code carg1(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env) { printf("arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1,env); goto carg2(arg1,arg2,arg3,arg4,arg0,exit1,env); } code carg2(int arg0,int arg1,int arg2,int arg3,int arg4,code(*exit1)(),void *env) { struct arg args0; printf("arg1: %d %d %d %d %d : %x %x\n",arg0,arg1,arg2,arg3,arg4,exit1,env); args0.a0 = arg0; args0.a1 = arg1; args0.a2 = arg2; args0.a3 = arg3; args0.a4 = arg4; goto cargs(args0,exit1,env); } code cargs(struct arg args0,code exit1(),void *env) { printf("args: %d %d %d %d %d : %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, exit1,env); // goto exit1(321),env; goto (*exit1)(321),env; } code carg3(struct arg args0,struct arg args1,int i, int j,int k,int l) { printf("args3: %d %d %d %d %d : %x %x %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); if (args0.a0==args1.a0) exit(); goto carg4(args0,args1,j,k,l,i); } code carg4(struct arg args0,struct arg args1,int i, int j,int k,int l) { printf("args4: %d %d %d %d %d : %x %x %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); goto carg5(args1,args0,j,k,l,i); } code carg5(struct arg args0,struct arg args1,int i, int j,int k,int l) { printf("args5: %d %d %d %d %d : %x %x %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); goto carg6(i,j,k,l,args0); } code carg6(int i, int j,int k,int l,struct arg args0) { printf("args6: %d %d %d %d %d : %x %x %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4,i,j,k,l); goto carg3(args0,args0,i,j,k,l); } int main1(int n) { goto carg1(0,1,2,3,4,return,environment); return n; } struct arg a00; struct arg a01; int main( int ac, char *av[]) { int n; n = main1(123); printf("321=%d\n",n); a00.a0 = 11; a00.a1 = 22; a00.a2 = 33; a00.a3 = 44; a00.a4 = 55; a01.a0 = 66; a01.a1 = 77; a01.a2 = 88; a01.a3 = 99; a01.a4 = 10; goto carg3(a00,a01,1,2,3,4); }