Mercurial > hg > Applications > Grep
comparison regexParser/cerium/ppe/Print.cc @ 282:87a801c14117
fix match condition (parallel search doesn't work)
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 19:53:58 +0900 |
parents | b74e3b4b11d7 |
children | 948428caf616 |
comparison
equal
deleted
inserted
replaced
281:b74e3b4b11d7 | 282:87a801c14117 |
---|---|
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) { | 23 if (r == NULL) { |
24 prev = NULL; | 24 prev = NULL; |
25 continue; | 25 continue; |
26 } | 26 } |
27 StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; | 27 StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+1]; |
28 StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. | |
29 if (prev) { | 28 if (prev) { |
30 if (i >= out_task_num) break; | 29 if (i >= out_task_num) break; |
31 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) | 30 // 最後のブロックでなく、前の prevBlockEnd が state 1 でない場合) |
31 StatePtr prevBlockEnd = (StatePtr)w->o_data[i*out_size-1]; | |
32 #if 0 | 32 #if 0 |
33 printf("task %d prev begin : %p r->begin : %p r->end : %p\n", i,prev->begin,r->begin,r->end); | 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); | 34 printf("nextblockBegin : %lx prevBlockEnd : %lx : string ",blockBegin->bitState.bitContainer,prevBlockEnd->bitState.bitContainer); |
35 fwrite(r->begin,r->end - r->begin-1,1,stdout); | 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 ); | 36 printf(" match %d\n", ((prevBlockEnd->bitState.bitContainer & ~blockBegin->bitState.bitContainer)==0)? 1 : 0 ); |
37 #endif | 37 #endif |
38 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { | 38 if ((prevBlockEnd->bitState.bitContainer & ~blockBegin->bitState.bitContainer)==0) { |
39 // 前のブロックの matchBegin から最初 result の end までがマッチ | 39 // 前のブロックの matchBegin から最初 result の end までがマッチ |
40 fwrite(prev->begin,r->end - prev->begin-1,1,stdout); | 40 fwrite(prev->begin,r->end - prev->begin-1,1,stdout); |
41 // printf("####"); | |
41 if (!r->continued) puts(""); | 42 if (!r->continued) puts(""); |
42 } | 43 } |
43 r = r->next; | 44 r = r->next; |
45 // printf("%p\n",r); | |
46 } else { | |
47 if (blockBegin->bitState.bitContainer != 1) r = r->next; | |
44 } | 48 } |
45 prev = resultPrint(r,"Print"); | 49 prev = resultPrint(r,"Print"); |
46 } | 50 } |
47 return 0; | 51 return 0; |
48 } | 52 } |