view regexParser/sequentialSearch.cc @ 255:61d4d466e64c

fix Makefile
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Mon, 25 Jan 2016 18:20:37 +0900
parents a3cddb32b87f
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;
}