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

Last change on this file since 5387 was 5377, checked in by nmedfort, 2 years ago

Support for stdin. Needs more testing.

File size: 2.0 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6#ifndef DO_GREP_H
7#define DO_GREP_H
8#include <grep_type.h>  // for GrepType, GrepType::Normal
9#include <string>       // for string
10#include <vector>
11namespace llvm { class ExecutionEngine; }
12namespace llvm { class Module; }
13namespace re { class CC; }
14namespace re { class RE; }
15
16class GrepEngine {
17    typedef void (*GrepFunctionType)(char * byte_data, size_t filesize, const int fileIdx);
18    typedef uint64_t (*GrepFunctionType_CountOnly)(char * byte_data, size_t filesize, const int fileIdx);
19    typedef void (*GrepFunctionType_CPU)(char * rslt, char * LineBreak, char * byte_data, size_t filesize, const int fileIdx);
20public:
21
22    GrepEngine();
23    ~GrepEngine();
24 
25    void grepCodeGen(std::string moduleName, re::RE * re_ast, bool CountOnly, bool UTF_16 = false, GrepType grepType = GrepType::Normal, const bool usingStdIn = false);
26    void multiGrepCodeGen(std::string moduleName, std::vector<re::RE *> REs, bool CountOnly, bool UTF_16 = false, GrepType grepType = GrepType::Normal);
27     
28    void doGrep(const std::string & fileName, const int fileIdx, bool CountOnly, std::vector<size_t> & total_CountOnly);
29
30    void doGrep(const int fileIdx, bool CountOnly, std::vector<size_t> & total_CountOnly);
31   
32    re::CC *  grepCodepoints();
33
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(llvm::Module * m, llvm::ExecutionEngine * e);
47
48
49re::CC * getParsedCodePointSet();
50void setParsedCodePointSet();
51
52void setParsedPropertyValues();
53
54void initFileResult(std::vector<std::string> filenames);
55void PrintResult(bool CountOnly, std::vector<size_t> & total_CountOnly);
56
57#endif
Note: See TracBrowser for help on using the repository browser.