comparison ABP/sender.c @ 9:18d2a590bc10 draft

add fibonacci
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sun, 03 Jun 2012 22:06:40 +0900
parents 5dc0fa7caa57
children
comparison
equal deleted inserted replaced
8:5dc0fa7caa57 9:18d2a590bc10
1 #include <stdio.h>
2
1 extern int comm_bit_s; /* communication bit for sender */ 3 extern int comm_bit_s; /* communication bit for sender */
2 extern int comm_bit_r; /* communication bit for receiver */ 4 extern int comm_bit_r; /* communication bit for receiver */
3 extern char *comm_msg; /* communication message */ 5 extern char *comm_msg; /* communication message */
4 6
5 code s_sendState(struct packet, int);
6 code s_receiveState(struct packet, int);
7 7
8 struct packet { 8 struct packet {
9 int bit; /* alternating bit */ 9 int bit; /* alternating bit */
10 char **msg; /* messages */ 10 char **msg; /* messages */
11 code (*next)(); /* next code segment */ 11 code (*next)(); /* next code segment */
12 }; 12 };
13
14 extern code schedule(struct packet pkt, int i);
15
16 code s_sendState(struct packet, int);
17 code s_receiveState(struct packet, int);
13 18
14 code s_receiveState(struct packet pkt, int i) 19 code s_receiveState(struct packet pkt, int i)
15 { 20 {
16 /* correct bit */ 21 /* correct bit */
17 if (pkt.bit == comm_bit_r) { 22 if (pkt.bit == comm_bit_r) {