source: icGREP/icgrep-devel/icgrep/grep_engine.h @ 5025

Last change on this file since 5025 was 5025, checked in by xuedongx, 3 years ago

If '-c', ignore the scanmatch kernel.

File size: 1.2 KB
Line 
1#ifndef DO_GREP_H
2#define DO_GREP_H
3/*
4 *  Copyright (c) 2016 International Characters.
5 *  This software is licensed to the public under the Open Software License 3.0.
6 *  icgrep is a trademark of International Characters.
7 */
8
9#include <string>
10#include <stdint.h>
11#include <re/re_re.h>
12#include <llvm/ExecutionEngine/ExecutionEngine.h>
13
14
15namespace llvm { class raw_ostream; }
16
17class GrepEngine {
18    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
19    typedef int64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
20public:
21
22    GrepEngine() {}
23
24    ~GrepEngine();
25 
26    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool isNameExpression = false);
27   
28    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<int> & total_CountOnly);
29   
30    re::CC *  grepCodepoints();
31   
32private:
33   
34    static bool finalLineIsUnterminated(const char * const fileBuffer, const size_t fileSize);
35
36    GrepFunctionType mGrepFunction;
37    GrepFunctionType_CountOnly mGrepFunction_CountOnly;
38
39    bool mIsNameExpression;
40    llvm::ExecutionEngine * mEngine;
41};
42
43
44#endif
Note: See TracBrowser for help on using the repository browser.