# HG changeset patch # User Masataka Kohagura # Date 1454237638 -32400 # Node ID 87a801c14117fd162da18bf63c70d4a31ec4ec05 # Parent b74e3b4b11d77b12461344b31e11324b499c82a8 fix match condition (parallel search doesn't work) diff -r b74e3b4b11d7 -r 87a801c14117 regexParser/cerium/ppe/Exec.cc --- a/regexParser/cerium/ppe/Exec.cc Sun Jan 31 18:28:58 2016 +0900 +++ b/regexParser/cerium/ppe/Exec.cc Sun Jan 31 19:53:58 2016 +0900 @@ -30,15 +30,17 @@ tsv = tSearch(tsv); tsv.blockEnd = tsv.current; if (tsv.blockEnd->state->bitState.bitContainer != 1) { - // partial match case at block end. - ResultPtr r = NEW(Result); - r->continued = true; - r->begin = tsv.buff.matchBegin; - r->end = tsv.buff.buffptr-1; - *tsv.resultEnd = r; - r->next = NULL; - tsv.resultEnd = &r->next; + if (tsv.buff.matchBegin != tsv.buff.buffptr) { + // partial match case at block end. + ResultPtr r = NEW(Result); + r->continued = true; + r->begin = tsv.buff.matchBegin; + r->end = tsv.buff.buffptr; + *tsv.resultEnd = r; + r->next = NULL; + tsv.resultEnd = &r->next; // printf("Exec %lx r->begin : %p r->end : %p\n",tsv.blockEnd->state->bitState.bitContainer, r->begin,r->end); + } } tsv.result = result; return tsv; diff -r b74e3b4b11d7 -r 87a801c14117 regexParser/cerium/ppe/Print.cc --- a/regexParser/cerium/ppe/Print.cc Sun Jan 31 18:28:58 2016 +0900 +++ b/regexParser/cerium/ppe/Print.cc Sun Jan 31 19:53:58 2016 +0900 @@ -24,23 +24,27 @@ prev = NULL; continue; } - StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; - StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. + StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+1]; if (prev) { if (i >= out_task_num) break; - // 最後のブロックでなく、前の blockEnd が state 1 でない場合) + // 最後のブロックでなく、前の prevBlockEnd が state 1 でない場合) + StatePtr prevBlockEnd = (StatePtr)w->o_data[i*out_size-1]; #if 0 printf("task %d prev begin : %p r->begin : %p r->end : %p\n", i,prev->begin,r->begin,r->end); -printf("blockBegin : %lx blockEnd : %lx : string ",blockBegin->bitState.bitContainer,blockEnd->bitState.bitContainer); +printf("nextblockBegin : %lx prevBlockEnd : %lx : string ",blockBegin->bitState.bitContainer,prevBlockEnd->bitState.bitContainer); fwrite(r->begin,r->end - r->begin-1,1,stdout); -printf(" match %d\n", ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0)? 1 : 0 ); +printf(" match %d\n", ((prevBlockEnd->bitState.bitContainer & ~blockBegin->bitState.bitContainer)==0)? 1 : 0 ); #endif - if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { + if ((prevBlockEnd->bitState.bitContainer & ~blockBegin->bitState.bitContainer)==0) { // 前のブロックの matchBegin から最初 result の end までがマッチ fwrite(prev->begin,r->end - prev->begin-1,1,stdout); +// printf("####"); if (!r->continued) puts(""); } r = r->next; +// printf("%p\n",r); + } else { + if (blockBegin->bitState.bitContainer != 1) r = r->next; } prev = resultPrint(r,"Print"); } diff -r b74e3b4b11d7 -r 87a801c14117 regexParser/threadedSearch.cc --- a/regexParser/threadedSearch.cc Sun Jan 31 18:28:58 2016 +0900 +++ b/regexParser/threadedSearch.cc Sun Jan 31 19:53:58 2016 +0900 @@ -83,7 +83,7 @@ TSValue tSearch(TSValue tsv) { next: while (tsv.buff.buffptr < tsv.buff.buffend) { unsigned char c = *tsv.buff.buffptr++; - // printState(tsv.current->state); +// printState(tsv.current->state); for (int i = 0; i < tsv.current->ccvSize; i++) { CCVPtr ccv = &tsv.current->ccv[i]; if (cbegin) {