Mercurial > hg > CbC > old > device
view test/test2.c @ 739:0c7a6ae119ba
i64 continue... compiler compiled.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Nov 2010 22:22:46 +0900 |
parents | 3f1f6c0610c1 |
children | c2c709727221 |
line wrap: on
line source
#define __environment _CbC_environment #define __return _CbC_return #include <stdio.h> int sender_bit; __code (*ret)(int,void *); 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); }