Mercurial > hg > Applications > Grep
comparison regexParser/main.cc @ 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 | 157f6886ba55 |
comparison
equal
deleted
inserted
replaced
259:6a6546a753cf | 260:3f3c9902bb6d |
---|---|
5 #include "regexParser.h" | 5 #include "regexParser.h" |
6 #include "subsetConstruction.h" | 6 #include "subsetConstruction.h" |
7 #include "node.h" | 7 #include "node.h" |
8 #include "grepWalk.h" | 8 #include "grepWalk.h" |
9 #include "fileread.h" | 9 #include "fileread.h" |
10 #include "threadedSearch.h" | |
10 | 11 |
11 int main(int argc, char **argv) | 12 int main(int argc, char **argv) |
12 { | 13 { |
13 bool generate = true; | 14 bool generate = true; |
14 bool subset = false; | 15 bool subset = false; |
15 bool generateSequentialSearch = false; | 16 bool generateSequentialSearch = false; |
16 bool tSearch = false; | 17 bool ts = false; |
17 char *filename; | 18 char *filename; |
18 | 19 |
19 RegexInfo ri; | 20 RegexInfo ri; |
20 ri.stateNumber = 1; | 21 ri.stateNumber = 1; |
21 for (int i = 1; i < argc; i++) { | 22 for (int i = 1; i < argc; i++) { |
27 subset = true; | 28 subset = true; |
28 } else if (strcmp(argv[i],"-seq") == 0) { | 29 } else if (strcmp(argv[i],"-seq") == 0) { |
29 generateSequentialSearch = true; | 30 generateSequentialSearch = true; |
30 } else if (strcmp(argv[i],"-file") == 0) { | 31 } else if (strcmp(argv[i],"-file") == 0) { |
31 filename = argv[i+1]; i++; | 32 filename = argv[i+1]; i++; |
32 } else if (strcmp(argv[i],"-tSearch") == 0) { | 33 } else if (strcmp(argv[i],"-ts") == 0) { |
33 tSearch = true; | 34 ts = true; |
34 } | 35 } |
35 } | 36 } |
36 if (!ri.ptr) return 0; | 37 if (!ri.ptr) return 0; |
37 | 38 |
38 printf("regex : %s\n",ri.ptr); | 39 printf("regex : %s\n",ri.ptr); |
58 | 59 |
59 if (filename != NULL) { | 60 if (filename != NULL) { |
60 int fd = 0; | 61 int fd = 0; |
61 st_mmap_t st_mmap = createSt_mmap(filename,fd); | 62 st_mmap_t st_mmap = createSt_mmap(filename,fd); |
62 Buffer buff = createBuffer(st_mmap); | 63 Buffer buff = createBuffer(st_mmap); |
63 if (tSearch) tSearch(tsv); | 64 TSValue tsv; |
65 tsv.buff = buff; | |
66 if (ts) tSearch(tsv); | |
64 else grepWalk(tgv.tg,buff); | 67 else grepWalk(tgv.tg,buff); |
65 close(fd); | 68 close(fd); |
66 } | 69 } |
67 return 0; | 70 return 0; |
68 } | 71 } |