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

Last change on this file since 5678 was 5678, checked in by cameron, 19 months ago

MatchAccumulator? modularization step

File size: 1.9 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#include <re/re_multiplex.h>
14
15namespace re { class CC; }
16namespace re { class RE; }
17namespace llvm { namespace cl { class OptionCategory; } }
18class Driver;
19
20
21namespace grep {
22
23// Thread function only.
24void *DoGrepThreadFunction(void *args);
25   
26   
27class MatchAccumulator {
28public:
29    MatchAccumulator() {};
30    virtual void accumulate_match(const size_t lineNum, size_t line_start, size_t line_end) = 0;
31};
32
33void accumulate_match_wrapper(intptr_t accum_addr, const size_t lineNum, size_t line_start, size_t line_end);
34   
35
36class GrepEngine {
37public:
38
39    GrepEngine();
40
41
42    ~GrepEngine();
43
44    void grepCodeGen(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16, GrepSource grepSource);
45
46    void grepCodeGen_nvptx(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16);
47
48    void doGrep(const std::string & fileName, std::string & PTXFilename) const;
49   
50    uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) const;
51
52    uint64_t doGrep(const int32_t fileDescriptor, const uint32_t fileIdx) const;
53       
54private:
55   
56    Driver * mGrepDriver;
57};
58
59void initFileResult(std::vector<std::string> filenames);
60   
61void PrintResults();
62   
63//void grepBuffer(re::RE * pattern, const char * buffer, size_t bufferLength, MatchAccumulator * accum);
64
65re::CC * grepCodepoints(re::RE * pattern, char * UnicodeDataBuffer, size_t bufferLength);
66   
67const std::vector<std::string> grepPropertyValues(const std::string& propertyName, re::RE * propertyValuePattern);
68
69}
70
71#endif
Note: See TracBrowser for help on using the repository browser.