Mercurial > hg > Applications > Grep
comparison regexParser/cerium/ppe/Print.cc @ 281:b74e3b4b11d7
parallel search done
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 18:28:58 +0900 |
parents | 6cc1d9779f45 |
children | 87a801c14117 |
comparison
equal
deleted
inserted
replaced
280:6bbd1cbf90d0 | 281:b74e3b4b11d7 |
---|---|
18 int out_size = w->division_out_size / sizeof(unsigned long long); | 18 int out_size = w->division_out_size / sizeof(unsigned long long); |
19 int out_task_num = w->task_num; | 19 int out_task_num = w->task_num; |
20 ResultPtr prev = NULL; | 20 ResultPtr prev = NULL; |
21 for (int i = 0; i < out_task_num ; i++) { | 21 for (int i = 0; i < out_task_num ; i++) { |
22 ResultPtr r = (ResultPtr)w->o_data[i*out_size+0]; | 22 ResultPtr r = (ResultPtr)w->o_data[i*out_size+0]; |
23 if (r == NULL) { | |
24 prev = NULL; | |
25 continue; | |
26 } | |
23 StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; | 27 StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; |
24 StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. | 28 StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. |
25 if (prev && i != out_task_num-1) { | 29 if (prev) { |
30 if (i >= out_task_num) break; | |
26 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) | 31 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) |
32 #if 0 | |
33 printf("task %d prev begin : %p r->begin : %p r->end : %p\n", i,prev->begin,r->begin,r->end); | |
34 printf("blockBegin : %lx blockEnd : %lx : string ",blockBegin->bitState.bitContainer,blockEnd->bitState.bitContainer); | |
35 fwrite(r->begin,r->end - r->begin-1,1,stdout); | |
36 printf(" match %d\n", ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0)? 1 : 0 ); | |
37 #endif | |
27 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { | 38 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { |
28 // 前のブロックの matchBegin から最初 result の end までがマッチ | 39 // 前のブロックの matchBegin から最初 result の end までがマッチ |
29 fwrite(prev->begin,r->end - prev->begin,1,stdout); | 40 fwrite(prev->begin,r->end - prev->begin-1,1,stdout); |
41 if (!r->continued) puts(""); | |
30 } | 42 } |
31 r = r->next; | 43 r = r->next; |
32 } | 44 } |
33 prev = resultPrint(r,"Print"); | 45 prev = resultPrint(r,"Print"); |
34 } | 46 } |