Mercurial > hg > CbC > old > device
view test/arg.c @ 418:c73f013d07d7 arm-complete
ARM complete. PowerPC, MIPS, IA32 checked.
emit_copy register save.
author | kono |
---|---|
date | Mon, 25 Oct 2004 19:16:17 +0900 |
parents | ce0c38b6c85e |
children | 0c256ea2a97e |
line wrap: on
line source
#include "stdio.h" struct arg { int a0;int a1;int a2;int a3;int a4; }; void *exit_env; code (*exit_code)(); 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==exit_code,env==exit_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==exit_code,env==exit_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==exit_code,env==exit_env); // goto exit1(321),env; goto (*exit1)(0),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); printf("args3: args0 %d %d %d %d %d : args1 %d %d %d %d %d : %x %x %x %x\n", args0.a0,args0.a1,args0.a2,args0.a3,args0.a4, args1.a0,args1.a1,args1.a2,args1.a3,args1.a4, i,j,k,l); if (args0.a0==args1.a0) exit(0); 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,exit_code=return,exit_env=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); }