view test/throw.c @ 874:3454953b3df0

fix inline strinit not yet worked.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 01 Apr 2014 23:25:05 +0900
parents c2c709727221
children
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("#0026:%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("#0035:%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("#0058: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("#0079: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("#0099:main2\n");
    ret = __return;
    env = __environment;

    goto throw1(arg,-5,78);
}

int
main()
{
    main0();
    main1();
    main2();
    return 0;
}

/* end */