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