comparison ltl.cbc @ 10:35d0358b3fe6

update Modern CbC Compiler
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 01 Jul 2019 22:18:03 +0900
parents cef74c1054c1
children
comparison
equal deleted inserted replaced
9:cef74c1054c1 10:35d0358b3fe6
9 PhilsPtr current = phils; 9 PhilsPtr current = phils;
10 PhilsPtr last = phils->left; 10 PhilsPtr last = phils->left;
11 11
12 if (last->left_fork->owner == NULL) return 0; 12 if (last->left_fork->owner == NULL) return 0;
13 while (current != last) { 13 while (current != last) {
14 if (current->left_fork->owner == NULL) return 0; 14 if (current->left_fork->owner == NULL) return 0;
15 current = current->right; 15 current = current->right;
16 } 16 }
17 return 1; 17 return 1;
18 } 18 }
19 19
20 __code check(int *always_flag, PhilsPtr phils, TaskPtr list) 20 __code check(int *always_flag, PhilsPtr phils, TaskPtr list)
21 { 21 {
22 if (p(list->phils)) { 22 if (p(list->phils)) {
23 *always_flag = 0; 23 *always_flag = 0;
24 } 24 }
25 goto tableau(list); 25 goto tableau(list);
26 } 26 }
27 27
28 void 28 void
29 show_result(int always_flag) 29 show_result(int always_flag)
30 { 30 {
31 if (always_flag == 1) { 31 if (always_flag == 1) {
32 printf("[]~p is valid.\n"); 32 printf("[]~p is valid.\n");
33 } else { 33 } else {
34 printf("[]~p is not valid.\n"); 34 printf("[]~p is not valid.\n");
35 } 35 }
36 } 36 }