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

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

Cleaned up memory leaks + some warning messages.

File size: 1.7 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#include <grep_type.h>
14
15
16namespace llvm { class raw_ostream; }
17
18
19
20class GrepEngine {
21    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx);
22    typedef uint64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx);
23    typedef void (*GrepFunctionType_CPU)(char * rslt, char * byte_data, size_t filesize, const int fileIdx);
24public:
25
26    GrepEngine();
27    ~GrepEngine();
28 
29    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool UTF_16 = false, GrepType grepType = GrepType::Normal);
30   
31    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<size_t> &total_CountOnly, bool UTF_16);
32   
33    re::CC *  grepCodepoints();
34    const std::vector<std::string> & grepPropertyValues(const std::string& propertyName);
35   
36private:
37   
38    GrepFunctionType mGrepFunction;
39    GrepFunctionType_CountOnly mGrepFunction_CountOnly;
40    GrepFunctionType_CPU mGrepFunction_CPU;
41
42    GrepType mGrepType;
43    llvm::ExecutionEngine * mEngine;
44};
45
46void icgrep_Linking(Module * m, ExecutionEngine * e);
47
48
49re::CC * getParsedCodePointSet();
50void setParsedCodePointSet();
51
52const std::vector<std::string>& getParsedPropertyValues();
53void setParsedPropertyValues();
54
55
56void initResult(std::vector<std::string> filenames);
57void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly);
58
59#endif
Note: See TracBrowser for help on using the repository browser.