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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "queue.h"
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "dpp_common.h"
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 static int
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 p(PhilsPtr phils)
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 {
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 PhilsPtr current = phils;
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 PhilsPtr last = phils->left;
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 if (last->left_fork->owner == NULL) return 0;
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 }
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 return 1;
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 code check(int *always_flag, PhilsPtr phils, TaskPtr list)
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 {
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 goto tableau(list);
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 }
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 void
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 show_result(int always_flag)
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 {
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
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
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 }
a89b61162c29 add DPP
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 }