Mercurial > hg > Applications > Grep
view regexParser/sequentialSearch.cc @ 264:ef95a7f1bc03
implement tSearch
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 27 Jan 2016 17:41:01 +0900 |
parents | 157f6886ba55 |
children | 63213964502a |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/mman.h> #include "fileread.h" void state1(Buffer buff); void stateSkip(Buffer buff) { buff.matchBegin = buff.buffptr; state1(buff); } void stateMatch(Buffer buff) { fwrite(buff.matchBegin,buff.buffptr-buff.matchBegin-1,1,stdout); puts(""); buff.buffptr--; stateSkip(buff); } #include "state.cc" int main(int argc, char **argv) { char *filename; for (int i = 1; i < argc; i++) { if (strcmp(argv[i],"-file") == 0) { filename = argv[i+1]; i++; } } int fd = 0; st_mmap_t st_mmap = createSt_mmap(filename,fd); Buffer buff = createBuffer(st_mmap); stateSkip(buff); close(fd); return 0; }