Mercurial > hg > CbC > old > DPP
comparison ltl.cbc @ 0:d4bc23cb728b
Import from CVS (CVS_DB/member/atsuki/cbc/DPP)
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 16 Dec 2015 15:16:11 +0900 |
parents | |
children | 171cc032eb29 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d4bc23cb728b |
---|---|
1 #include <stdio.h> | |
2 #include "queue.h" | |
3 #include "dpp_common.h" | |
4 | |
5 static int | |
6 p(PhilsPtr phils) | |
7 { | |
8 PhilsPtr current = phils; | |
9 PhilsPtr last = phils->left; | |
10 | |
11 if (last->left_fork->owner == NULL) return 0; | |
12 while (current != last) { | |
13 if (current->left_fork->owner == NULL) return 0; | |
14 current = current->right; | |
15 } | |
16 return 1; | |
17 } | |
18 | |
19 code check(int *always_flag, PhilsPtr phils, TaskPtr list) | |
20 { | |
21 if (p(list->phils)) { | |
22 *always_flag = 0; | |
23 } | |
24 goto tableau(list); | |
25 } | |
26 | |
27 void | |
28 show_result(int always_flag) | |
29 { | |
30 if (always_flag == 1) { | |
31 printf("[]~p is valid.\n"); | |
32 } else { | |
33 printf("[]~p is not valid.\n"); | |
34 } | |
35 } |