Mercurial > hg > CbC > old > device
view test/test2.c @ 927:b491db049d74
Added tag current-release for changeset 4e73a22327a8
author | kono |
---|---|
date | Sun, 13 Apr 2014 10:20:02 +0900 |
parents | c2c709727221 |
children |
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("#0017:bit: %d\n", pkt.bit); printf("#0018: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("#0026:initSender bit: %d\n", pkt.bit); printf("#0027:initSender message: %s\n", pkt.msg); printf("#0028: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("#0040:main bit: %d\n", pkt.bit); printf("#0041:main message: %s\n", pkt.msg); goto initSender(0, pkt); }