Mercurial > hg > Applications > Grep
changeset 262:157f6886ba55
write driver of threadedSearch
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 19:32:18 +0900 |
parents | 2b36dde3ffb7 |
children | 292753bb31e4 |
files | regexParser/main.cc regexParser/sequentialSearch.cc regexParser/subsetConstruction.cc regexParser/threadedSearch.cc regexParser/threadedSearch.h |
diffstat | 5 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/main.cc Tue Jan 26 14:35:34 2016 +0900 +++ b/regexParser/main.cc Tue Jan 26 19:32:18 2016 +0900 @@ -61,9 +61,7 @@ int fd = 0; st_mmap_t st_mmap = createSt_mmap(filename,fd); Buffer buff = createBuffer(st_mmap); - TSValue tsv; - tsv.buff = buff; - if (ts) tSearch(tsv); + if (ts) threadedSearch(tgv.tg,buff); else grepWalk(tgv.tg,buff); close(fd); }
--- a/regexParser/sequentialSearch.cc Tue Jan 26 14:35:34 2016 +0900 +++ b/regexParser/sequentialSearch.cc Tue Jan 26 19:32:18 2016 +0900 @@ -15,7 +15,7 @@ } void stateMatch(Buffer buff) { - fwrite(buff.matchBegin,buff.buffptr-buff.matchBegin,1,stdout); + fwrite(buff.matchBegin,buff.buffptr-buff.matchBegin-1,1,stdout); puts(""); stateSkip(buff); }
--- a/regexParser/subsetConstruction.cc Tue Jan 26 14:35:34 2016 +0900 +++ b/regexParser/subsetConstruction.cc Tue Jan 26 19:32:18 2016 +0900 @@ -16,6 +16,8 @@ cc->cond.range.begin = begin; cc->cond.range.end = end; cc->cond.range.next = NULL; + cc->cond.w.word = NULL; + cc->cond.w.length = 0; cc->left = left; cc->right = right; cc->nextState.bitContainer = state;
--- a/regexParser/threadedSearch.cc Tue Jan 26 14:35:34 2016 +0900 +++ b/regexParser/threadedSearch.cc Tue Jan 26 19:32:18 2016 +0900 @@ -85,3 +85,11 @@ tsv.current->stateSkip(tsv); } } + +void threadedSearch(TransitionGeneratorPtr tg, Buffer buff) { + TSValue tsv; + tsv.buff = buff; + tsv.tg = tg; + tsv.current = generateTState(tg->stateList); + stateSkip(tsv); +}