Mercurial > hg > Applications > Grep
comparison regexParser/sequentialSearch.cc @ 298:63213964502a
refactoring ....
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Feb 2016 12:24:34 +0900 |
parents | ef95a7f1bc03 |
children | c9ac6f06e706 |
comparison
equal
deleted
inserted
replaced
297:c5a7caa37f61 | 298:63213964502a |
---|---|
4 #include <fcntl.h> | 4 #include <fcntl.h> |
5 #include <sys/stat.h> | 5 #include <sys/stat.h> |
6 #include <sys/mman.h> | 6 #include <sys/mman.h> |
7 | 7 |
8 #include "fileread.h" | 8 #include "fileread.h" |
9 #include "threadedSearch.h" | |
9 | 10 |
10 void state1(Buffer buff); | 11 TSValue state0(TSValue ts); |
11 | |
12 void stateSkip(Buffer buff) { | |
13 buff.matchBegin = buff.buffptr; | |
14 state1(buff); | |
15 } | |
16 | |
17 void stateMatch(Buffer buff) { | |
18 fwrite(buff.matchBegin,buff.buffptr-buff.matchBegin-1,1,stdout); | |
19 puts(""); | |
20 buff.buffptr--; | |
21 stateSkip(buff); | |
22 } | |
23 | 12 |
24 #include "state.cc" | 13 #include "state.cc" |
25 int main(int argc, char **argv) { | 14 int main(int argc, char **argv) { |
26 char *filename; | 15 char *filename; |
27 for (int i = 1; i < argc; i++) { | 16 for (int i = 1; i < argc; i++) { |
31 } | 20 } |
32 | 21 |
33 int fd = 0; | 22 int fd = 0; |
34 st_mmap_t st_mmap = createSt_mmap(filename,fd); | 23 st_mmap_t st_mmap = createSt_mmap(filename,fd); |
35 Buffer buff = createBuffer(st_mmap); | 24 Buffer buff = createBuffer(st_mmap); |
36 stateSkip(buff); | 25 TSValue tsv = createTSValue(NULL,buff); |
26 tsv = state0(tsv); | |
37 close(fd); | 27 close(fd); |
38 return 0; | 28 return 0; |
39 } | 29 } |
30 | |
31 /* end */ |