Mercurial > hg > Members > nobuyasu > CbC
annotate DPP/ltl.cbc @ 33:3946f8d26710 draft default tip
add benchmarck/binary-trees
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 09 Apr 2013 16:41:30 +0900 |
parents | a89b61162c29 |
children |
rev | line source |
---|---|
0 | 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) { | |
33
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
13 if (current->left_fork->owner == NULL) return 0; |
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
14 current = current->right; |
0 | 15 } |
16 return 1; | |
17 } | |
18 | |
19 code check(int *always_flag, PhilsPtr phils, TaskPtr list) | |
20 { | |
21 if (p(list->phils)) { | |
33
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
22 *always_flag = 0; |
0 | 23 } |
24 goto tableau(list); | |
25 } | |
26 | |
27 void | |
28 show_result(int always_flag) | |
29 { | |
30 if (always_flag == 1) { | |
33
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
31 printf("[]~p is valid.\n"); |
0 | 32 } else { |
33
3946f8d26710
add benchmarck/binary-trees
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 printf("[]~p is not valid.\n"); |
0 | 34 } |
35 } |