Mercurial > hg > Members > masakoha > testcode
view regexParser/sequentialSearch.cc @ 232:1a34e702776a
add fileread.cc
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 19 Jan 2016 13:16:35 +0900 |
parents | d67649929e96 |
children | 6ed6f385205e |
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("\n"); 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; st_mmap_t st_mmap = createSt_mmap(filename,fd); Buffer buff = createBuffer(st_mmap); stateSkip(buff); close(fd); return 0; }