diff ABP/sender2.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
line wrap: on
line diff
--- a/ABP/sender2.c	Tue May 01 13:48:30 2012 +0900
+++ b/ABP/sender2.c	Sun Jun 03 22:06:40 2012 +0900
@@ -1,17 +1,20 @@
+#define __environment _CbC_environment
+#define __return _CbC_return
+
 int comm_bit;  /* communication bit */
 char *comm_msg;  /* communication message */
 
-code (*ret)(int);
-void *env;
-code sendState(struct packet, int);
-code receiveState(struct packet, int);
-
 struct packet {
 	int        bit;  /* alternating bit */
 	char     **msg;  /* messages */
 	code (*next)();  /* next code segment */
 };
 
+code (*ret)(int,void*);
+void *env;
+code sendState(struct packet, int);
+code receiveState(struct packet, int);
+
 char *msgs[6] = { "hoge1", "hoge2", "hoge3", "hoge4", "hoge5", 0 };
 
 code receiveState(struct packet pkt, int i)
@@ -33,7 +36,8 @@
 
 code sendState(struct packet pkt, int i)
 {
-	if (pkt.msg[i] == 0) goto ret(0), env;
+//	if (pkt.msg[i] == 0) goto ret(0), env;
+	if (pkt.msg[i] == 0) goto ret(0, env);
 	comm_bit = pkt.bit;
 	comm_msg = pkt.msg[i];
 	pkt.next = receiveState;
@@ -52,7 +56,7 @@
 int main(void)
 {
 	struct packet pkt;
-	ret = return;
-	env = environment;
+	ret = _CbC_return;
+	env = _CbC_environment;
 	goto initSender(pkt, 0);
 }