changeset 3:6bf69a0f2e24

Make dpp2
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Sun, 20 Dec 2015 16:46:24 +0900
parents b15128ab0324
children b7d63c5499e7
files Makefile scheduler.cbc tableau.cbc
diffstat 3 files changed, 24 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Dec 16 17:16:29 2015 +0900
+++ b/Makefile	Sun Dec 20 16:46:24 2015 +0900
@@ -1,7 +1,7 @@
 CC=clang
 MCC=cbc-clang
 TARGET=dpp dpp2 tableau tableau2 tableau3
-MCCFLAGS=-S -c
+MCCFLAGS=-S -c -g
 CFLAGS=-I. -g -Wall
 
 .SUFFIXES:	.cbc .c .o
@@ -60,68 +60,3 @@
 dpp2.o: dpp2.h queue.h dpp.h state_db.h scheduler.h
 main.o: dpp.h
 queue.o: queue.h dpp.h state_db.h
-#scheduler.o: /usr/include/stdio.h /usr/include/features.h
-#scheduler.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-#scheduler.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-#scheduler.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-#scheduler.o: /usr/include/libio.h /usr/include/_G_config.h
-#scheduler.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-#scheduler.o: /usr/include/gconv.h /usr/include/bits/stdio_lim.h
-#scheduler.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
-#scheduler.o: /usr/include/sys/types.h /usr/include/time.h
-#scheduler.o: /usr/include/endian.h /usr/include/bits/endian.h
-#scheduler.o: /usr/include/sys/select.h /usr/include/bits/select.h
-#scheduler.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
-#scheduler.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
-#scheduler.o: /usr/include/alloca.h dpp2.h queue.h dpp.h state_db.h
-tableau.o: /usr/include/stdlib.h /usr/include/features.h
-tableau.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-tableau.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-tableau.o: /usr/include/sys/types.h /usr/include/bits/types.h
-tableau.o: /usr/include/bits/typesizes.h /usr/include/time.h
-tableau.o: /usr/include/endian.h /usr/include/bits/endian.h
-tableau.o: /usr/include/sys/select.h /usr/include/bits/select.h
-tableau.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
-tableau.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
-tableau.o: /usr/include/alloca.h dpp2.h queue.h dpp.h state_db.h memory.h
-#memory.o: /usr/include/stdio.h /usr/include/features.h
-#memory.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-#memory.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-#memory.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-#memory.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
-#memory.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-#memory.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
-#memory.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
-#memory.o: /usr/include/endian.h /usr/include/bits/endian.h
-#memory.o: /usr/include/sys/select.h /usr/include/bits/select.h
-#memory.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
-#memory.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
-#memory.o: /usr/include/alloca.h memory.h crc32.h /usr/include/string.h
-queue.o: dpp.h state_db.h
-state_db.o: /usr/include/stdlib.h /usr/include/features.h
-state_db.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-state_db.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-state_db.o: /usr/include/sys/types.h /usr/include/bits/types.h
-state_db.o: /usr/include/bits/typesizes.h /usr/include/time.h
-state_db.o: /usr/include/endian.h /usr/include/bits/endian.h
-state_db.o: /usr/include/sys/select.h /usr/include/bits/select.h
-state_db.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
-state_db.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
-state_db.o: /usr/include/alloca.h state_db.h memory.h
-test/memory_test.o: /usr/include/stdio.h /usr/include/features.h
-test/memory_test.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-test/memory_test.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-test/memory_test.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-test/memory_test.o: /usr/include/libio.h /usr/include/_G_config.h
-test/memory_test.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-test/memory_test.o: /usr/include/gconv.h /usr/include/bits/stdio_lim.h
-test/memory_test.o: /usr/include/bits/sys_errlist.h /usr/include/strings.h
-test/memory_test.o: memory.h
-test/state_test.o: /usr/include/stdio.h /usr/include/features.h
-test/state_test.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
-test/state_test.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
-test/state_test.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
-test/state_test.o: /usr/include/libio.h /usr/include/_G_config.h
-test/state_test.o: /usr/include/wchar.h /usr/include/bits/wchar.h
-test/state_test.o: /usr/include/gconv.h /usr/include/bits/stdio_lim.h
-test/state_test.o: /usr/include/bits/sys_errlist.h memory.h state_db.h
--- a/scheduler.cbc	Wed Dec 16 17:16:29 2015 +0900
+++ b/scheduler.cbc	Sun Dec 20 16:46:24 2015 +0900
@@ -188,7 +188,7 @@
 __code die(char *err)
 {
 	printf("%s\n", err);
-	goto ret(1);
+    exit(1);
 }
 
 int main(int argc, char **argv)
--- a/tableau.cbc	Wed Dec 16 17:16:29 2015 +0900
+++ b/tableau.cbc	Sun Dec 20 16:46:24 2015 +0900
@@ -2,7 +2,7 @@
 ** Dining Philosophers Problem's scheduler
 **    with state developper as a tableau method
 
-** 連絡先: 琉球大学情報工学科 河野 真治  
+** 連絡先: 琉球大学情報工学科 河野 真治
 ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp)
 **
 **    このソースのいかなる複写,改変,修正も許諾します。ただし、
@@ -12,10 +12,10 @@
 **    バイナリの配布の際にはversion messageを保存することを条件とします。
 **    このプログラムについては特に何の保証もしない、悪しからず。
 **
-**    Everyone is permitted to do anything on this program 
+**    Everyone is permitted to do anything on this program
 **    including copying, modifying, improving,
 **    as long as you don't try to pretend that you wrote it.
-**    i.e., the above copyright notice has to appear in all copies.  
+**    i.e., the above copyright notice has to appear in all copies.
 **    Binary distribution requires original version messages.
 **    You don't have to ask before copying, redistribution or publishing.
 **    THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
@@ -30,7 +30,7 @@
 
 int NUM_PHILOSOPHER = 5;    /* A number of philosophers must be more than 2. */
 
-static code (*ret)(int);
+static __code (*ret)(int);
 static void *env;
 
 static PhilsPtr phils_list = NULL;
@@ -79,7 +79,7 @@
  */
 
 
-code tableau(TaskPtr list)
+__code tableau(TaskPtr list)
 {
     StateDB out;
 
@@ -93,7 +93,7 @@
 	    if (!prev_iter) {
 		printf("All done count %d\n",count);
 		memory_usage();
-		goto ret(0),env;
+		goto ret(0);
 	    }
 	    //printf("no more branch %d\n",count);
 	    depth--;
@@ -115,7 +115,7 @@
     goto list->phils->next(list->phils,list);
 }
 
-code get_next_task_fifo(TaskPtr list)
+__code get_next_task_fifo(TaskPtr list)
 {
     TaskPtr t = list;
     TaskPtr e;
@@ -126,15 +126,15 @@
     goto list->phils->next(list->phils,list);
 }
 
-code scheduler(PhilsPtr phils, TaskPtr list)
+__code scheduler(PhilsPtr phils, TaskPtr list)
 {
     goto tableau(list);
     // goto next_next_task_fifo(list);
 }
 
-code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last);
+__code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last);
 
-code task_entry2(int count,PhilsPtr self, TaskPtr list,TaskPtr last, TaskPtr q)
+__code task_entry2(int count,PhilsPtr self, TaskPtr list,TaskPtr last, TaskPtr q)
 {
     if (!q) {
 	goto die("Can't allocate Task\n");
@@ -144,7 +144,7 @@
     }
 }
 
-code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last)
+__code task_entry1(int count, PhilsPtr self, TaskPtr list, TaskPtr last)
 {
     StateDB out;
     /*
@@ -167,13 +167,13 @@
     }
 }
 
-code task_entry0(int count, PhilsPtr self, TaskPtr list, TaskPtr last, TaskPtr q)
+__code task_entry0(int count, PhilsPtr self, TaskPtr list, TaskPtr last, TaskPtr q)
 {
     add_memory_range(q,sizeof(Task),&mem);
     goto task_entry1(count, self, q, q);
 }
 
-code init_final(PhilsPtr self)
+__code init_final(PhilsPtr self)
 {
     self->right = phils_list;
     self->right_fork = phils_list->left_fork;
@@ -182,7 +182,7 @@
     goto create_queue(1, self, 0, 0, task_entry0);
 }
 
-code init_phils2(PhilsPtr self, int count, int id)
+__code init_phils2(PhilsPtr self, int count, int id)
 {
     PhilsPtr tmp_self;
 
@@ -209,7 +209,7 @@
     }
 }
 
-code init_fork2(PhilsPtr self, int count, int id)
+__code init_fork2(PhilsPtr self, int count, int id)
 {
     ForkPtr tmp_fork;
 
@@ -225,7 +225,7 @@
     goto init_phils2(self, count, id);
 }
 
-code init_phils1(ForkPtr fork, int count, int id)
+__code init_phils1(ForkPtr fork, int count, int id)
 {
     PhilsPtr self;
 
@@ -248,7 +248,7 @@
     goto init_fork2(self, count, id);
 }
 
-code init_fork1(int count)
+__code init_fork1(int count)
 {
     ForkPtr fork;
     int id = 1;
@@ -264,16 +264,16 @@
     goto init_phils1(fork, count, id);
 }
 
-code die(char *err)
+__code die(char *err)
 {
     printf("%s\n", err);
-    goto ret(1), env;
+    goto ret(1);
 }
 
 int main(int ac, char *av[])
 {
-    ret = return;
-    env = environment;
+    ret = __return;
+    env = __environment;
     // srand((unsigned)time(NULL));
     // srandom((unsigned long)time(NULL));
     srandom(555);
@@ -282,7 +282,7 @@
 	NUM_PHILOSOPHER = atoi(av[1]);
 	if (NUM_PHILOSOPHER >10 ||NUM_PHILOSOPHER < 2) {
 	    printf("illegal number of philosopher = %d\n", NUM_PHILOSOPHER );
-	    return 1; 
+	    return 1;
 	}
 	printf("number of philosopher = %d\n", NUM_PHILOSOPHER );
     }