view test/tmp1.c @ 585:a5b902b20300 ia32-no-rname

ia32 reconfigure end (correct?)
author kono
date Wed, 18 Jan 2006 12:26:48 +0900
parents a4445cb1aa91
children 682c8ec38d45
line wrap: on
line source

/* easy test */

code (*ret)();
void *env;
code exit1(int ac);

main0(ac,av)
int ac;
char *av[];
{
    ret = return;
    env = environment;
    printf("#0012:main0 %d start.\n",ac);
    if (ac>=1)
	goto code0(ac,av,return);
    goto code1(ac,av,exit1);
    // not reached. (warning?)
    printf("#0017:main0 %d end.\n",ac);
}

code exit1(int ac)
{
    // exit(0);
    goto code3(0,1,2,3,4,5);
}

code code3(a,b,c,d,e,f)
char a,b;
int c,d,e,f;
{
    printf("#0030:code3: %d %d %d %d %d %d\n",a,b,c,d,e,f);
    if(a<10)
	goto code3(a+1,b,c,d,e,f);
    else
	goto code4(a+3,b+3,c+3,d+3,e+3,f+3);
}

code code4(a,b,c,d,e,f)
char a,b;
int c,d,e,f;
{
    int i=1,j=2;
    printf("#0042:code4: %d %d %d %d %d %d\n",a,b,c,d,e,f);
    if(a<20)   // cyclic binary dependency
	goto code3(a+b,b+c,c+d,d+e,e+f,f+a);
    else if(a<30)
	goto code3(a,b,c,d,e,f);
    else if(a<40) // cyclic dependency
	goto code3(b,c,a,e,f,d);
    else if(a<50)
	goto code4(a+i,b+j,c+i,d+3,e+3,f+3);
    else goto ret(0),env;
}

code code0(ac,av,ret)
int ac;
char *av[];
code ret();
{
    goto code1(ac,av,ret);
}

code code1(ac,av,exit)
int ac,exit;
char *av[];
{
    code (*f)(int);
    printf("#0067:code1: %d\n",ac);
    f = exit;
    if (ac>3)
	goto code1(ac,av,f);
    else if (ac>2)
	goto code1(av,ac,f);
    else
	goto (*f)(ac),env;
}

int
main(int ac,char *av[])
{
   main0(1,av);
   printf("#0081:main continue.\n");
   main0(0,av);
   printf("#0083:main end.\n");
return 0;
}

/* end */