Mercurial > hg > Applications > Grep
view regexParser/sequentialSearch.cc @ 244:a3cddb32b87f
change condition in generateTransition
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Jan 2016 18:11:59 +0900 |
parents | 6ed6f385205e |
children | 157f6886ba55 |
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,stdout); puts(""); 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; }