Mercurial > hg > CbC > old > DPP
diff main.cbc @ 2:b15128ab0324
Fix dpp2 for cbc using LLVM 3.7
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 Dec 2015 17:16:29 +0900 |
parents | d4bc23cb728b |
children | b7d63c5499e7 |
line wrap: on
line diff
--- a/main.cbc Wed Dec 16 16:52:16 2015 +0900 +++ b/main.cbc Wed Dec 16 17:16:29 2015 +0900 @@ -2,20 +2,22 @@ ** Dining Philosophers Problem's scheduler */ #include "dpp.h" +__code die(char *err); +__code init_fork2(PhilsPtr self, int count, int id); #define NUM_PHILOSOPHER 5 /* A number of philosophers must be more than 2. */ -code (*ret)(int); +__code (*ret)(int); void *env; PhilsPtr phils_list = NULL; -code run(PhilsPtr self) +__code run(PhilsPtr self) { goto thinking(self); } -code init_final(PhilsPtr self) +__code init_final(PhilsPtr self) { self->right = phils_list; self->right_fork = phils_list->left_fork; @@ -24,7 +26,7 @@ goto run(phils_list); } -code init_phils2(PhilsPtr self, int count, int id) +__code init_phils2(PhilsPtr self, int count, int id) { PhilsPtr tmp_self; @@ -50,7 +52,7 @@ } } -code init_fork2(PhilsPtr self, int count, int id) +__code init_fork2(PhilsPtr self, int count, int id) { ForkPtr tmp_fork; @@ -65,7 +67,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; @@ -87,7 +89,7 @@ goto init_fork2(self, count, id); } -code init_fork1(int count) +__code init_fork1(int count) { ForkPtr fork; int id = 1; @@ -102,16 +104,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(void) { - ret = return; - env = environment; + ret = __return; + env = __environment; goto init_fork1(NUM_PHILOSOPHER); }