Mercurial > hg > Members > masakoha > testcode
changeset 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 | fbdb94df9eac |
files | regexParser/cerium/ppe/Exec.cc regexParser/cerium/ppe/Print.cc regexParser/threadedSearch.cc |
diffstat | 3 files changed, 21 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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"); }
--- 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 (c<ccv->begin) {