Mercurial > hg > Applications > Grep
changeset 260:3f3c9902bb6d
initialize node in allocateNode()
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 14:30:20 +0900 |
parents | 6a6546a753cf |
children | 2b36dde3ffb7 |
files | regexParser/main.cc regexParser/regexParser.cc regexParser/threadedSearch.cc |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/main.cc Tue Jan 26 13:34:33 2016 +0900 +++ b/regexParser/main.cc Tue Jan 26 14:30:20 2016 +0900 @@ -7,13 +7,14 @@ #include "node.h" #include "grepWalk.h" #include "fileread.h" +#include "threadedSearch.h" int main(int argc, char **argv) { bool generate = true; bool subset = false; bool generateSequentialSearch = false; - bool tSearch = false; + bool ts = false; char *filename; RegexInfo ri; @@ -29,8 +30,8 @@ generateSequentialSearch = true; } else if (strcmp(argv[i],"-file") == 0) { filename = argv[i+1]; i++; - } else if (strcmp(argv[i],"-tSearch") == 0) { - tSearch = true; + } else if (strcmp(argv[i],"-ts") == 0) { + ts = true; } } if (!ri.ptr) return 0; @@ -60,7 +61,9 @@ int fd = 0; st_mmap_t st_mmap = createSt_mmap(filename,fd); Buffer buff = createBuffer(st_mmap); - if (tSearch) tSearch(tsv); + TSValue tsv; + tsv.buff = buff; + if (ts) tSearch(tsv); else grepWalk(tgv.tg,buff); close(fd); }
--- a/regexParser/regexParser.cc Tue Jan 26 13:34:33 2016 +0900 +++ b/regexParser/regexParser.cc Tue Jan 26 14:30:20 2016 +0900 @@ -18,10 +18,12 @@ NodePtr allocateNode() { NodePtr n = NEW(Node); n->cc = NULL; + n->stateNum = 0; + n->nextStateNum = 0; + n->state = NULL; + n->nextState = NULL; n->left = NULL; n->right = NULL; - n->stateNum = 0; - n->nextStateNum = 0; return n; }
--- a/regexParser/threadedSearch.cc Tue Jan 26 13:34:33 2016 +0900 +++ b/regexParser/threadedSearch.cc Tue Jan 26 14:30:20 2016 +0900 @@ -13,9 +13,9 @@ } void stateMatch(TSValue tsv) { - fwrite(tsv.buff.matchBegin,tsv.buff.buffptr-buff.matchBegin,1,stdout); + fwrite(tsv.buff.matchBegin,tsv.buff.buffptr-tsv.buff.matchBegin,1,stdout); puts("\n"); - grepSkip(tg,buff); + stateSkip(tsv); } TStatePtr generateTState(StatePtr state) {