Mercurial > hg > Members > kono > Cerium
comparison example/word_count_test/spe/Exec.cc @ 674:bde5f13adf10
fix many task example (sort).
Dummy task is now system supported.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 06 Dec 2009 00:54:10 +0900 |
parents | d753b4f6b129 |
children | f725c6455d19 |
comparison
equal
deleted
inserted
replaced
673:d9111086b2c4 | 674:bde5f13adf10 |
---|---|
24 int word_flag = 0; | 24 int word_flag = 0; |
25 int word_num = 0; | 25 int word_num = 0; |
26 int line_num = 0; | 26 int line_num = 0; |
27 int i = 0; | 27 int i = 0; |
28 | 28 |
29 /*文字なら1,スペースか改行なら0*/ | |
30 head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); | 29 head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A); |
31 word_num -= 1-head_tail_flag[0]; | 30 word_num -= 1-head_tail_flag[0]; |
32 | 31 |
33 for (; i < length; i++) { | 32 for (; i < length; i++) { |
34 | |
35 //s->printf("[SPE%d]%c",id,i_data[i]); | |
36 | |
37 | |
38 if (i_data[i] == 0x20) { | 33 if (i_data[i] == 0x20) { |
39 //s->printf("スペース\n"); | |
40 word_flag = 1; | 34 word_flag = 1; |
41 } | 35 } else if (i_data[i] == 0x0A) { |
42 | |
43 else if (i_data[i] == 0x0A) { | |
44 //s->printf("改行\n"); | |
45 line_num += 1; | 36 line_num += 1; |
46 word_flag = 1; | 37 word_flag = 1; |
47 } | 38 } else { |
48 | |
49 else { | |
50 word_num += word_flag; | 39 word_num += word_flag; |
51 word_flag = 0; | 40 word_flag = 0; |
52 } | 41 } |
53 | |
54 } | 42 } |
55 | 43 |
56 word_num += word_flag; | 44 word_num += word_flag; |
57 /*文字なら1,スペースか改行なら0*/ | |
58 //printf("last word %c",i_data[i-1]); | |
59 head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A); | 45 head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A); |
60 | 46 |
61 // s->printf("SPE word %d line %d\n",word_num,line_num); | 47 // s->printf("SPE word %d line %d\n",word_num,line_num); |
62 | 48 |
63 o_data[0] = (unsigned long long)word_num; | 49 o_data[0] = (unsigned long long)word_num; |