view test/test2.c @ 606:1e29742ea9a6

*** empty log message ***
author kono
date Wed, 01 Feb 2006 07:12:03 +0900
parents ff033b46cac5
children 682c8ec38d45
line wrap: on
line source

#include <stdio.h>
int sender_bit;

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

struct packet {
        int bit;
        char *msg;
        code (*next)();
};

code print_struct(struct packet pkt)
{
        printf("bit: %d\n", pkt.bit);
        printf("message: %s\n", pkt.msg);
        goto ret(0), env;
}

code initSender(int init_bit, struct packet pkt)
{
        sender_bit = init_bit;
        pkt.next = print_struct;
        printf("initSender bit: %d\n", pkt.bit);
        printf("initSender message: %s\n", pkt.msg);
        printf("sender_bit: %d\n", sender_bit);
        goto print_struct(pkt);
}

int main(void)
{
        struct packet pkt;
        pkt.bit = 1;
        pkt.msg = "hogehoge";
        pkt.next = initSender;
        ret = return;
        env = environment;
        printf("main bit: %d\n", pkt.bit);
        printf("main message: %s\n", pkt.msg);
        goto initSender(0, pkt);
}