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

Last change on this file since 5613 was 5574, checked in by cameron, 2 years ago

Refactor to make a common grep pipeline

File size: 1.5 KB
Line 
1/*
2 *  Copyright (c) 2017 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 GREP_ENGINE_H
7#define GREP_ENGINE_H
8#include <grep_interface.h>
9#include <grep_type.h>  // for GrepType, GrepType::Normal
10#include <string>       // for string
11#include <vector>
12#include <re/re_parser.h> 
13
14namespace re { class CC; }
15namespace re { class RE; }
16namespace llvm { namespace cl { class OptionCategory; } }
17class Driver;
18
19
20namespace grep {
21
22// Thread function only.
23void *DoGrepThreadFunction(void *args);
24   
25class GrepEngine {
26public:
27
28    GrepEngine();
29
30
31    ~GrepEngine();
32
33    void grepCodeGen(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16, GrepSource grepSource);
34
35    void grepCodeGen_nvptx(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16);
36
37    void doGrep(const std::string & fileName, std::string & PTXFilename) const;
38   
39    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) const;
40
41    uint64_t doGrep(const int32_t fileDescriptor, const uint32_t fileIdx) const;
42       
43private:
44   
45    Driver * mGrepDriver;
46};
47
48void initFileResult(std::vector<std::string> filenames);
49   
50void PrintResults();
51   
52
53re::CC * grepCodepoints(re::RE * pattern, char * UnicodeDataBuffer, size_t bufferLength);
54   
55const std::vector<std::string> & grepPropertyValues(const std::string& propertyName, re::RE * propertyValuePattern);
56
57}
58
59#endif
Note: See TracBrowser for help on using the repository browser.