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

Last change on this file since 5037 was 5037, checked in by nmedfort, 3 years ago

UnicodeSet? bug fix and compile warning clean-up.

File size: 1.5 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
17
18
19class GrepEngine {
20    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
21    typedef uint64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx, uint64_t finalLineUnterminated);
22public:
23
24    GrepEngine() {}
25
26    ~GrepEngine();
27 
28    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool isNameExpression = false);
29   
30    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<uint64_t> &total_CountOnly);
31   
32    re::CC *  grepCodepoints();
33   
34private:
35   
36    static bool finalLineIsUnterminated(const char * const fileBuffer, const size_t fileSize);
37
38    GrepFunctionType mGrepFunction;
39    GrepFunctionType_CountOnly mGrepFunction_CountOnly;
40
41    bool mIsNameExpression;
42    llvm::ExecutionEngine * mEngine;
43};
44
45void icgrep_Linking(Module * m, ExecutionEngine * e);
46
47
48re::CC * getParsedCodePointSet();
49void setParsedCodePointSet();
50
51void initResult(std::vector<std::string> filenames);
52void PrintResult(bool CountOnly, std::vector<uint64_t> & total_CountOnly);
53
54#endif
Note: See TracBrowser for help on using the repository browser.