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

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

Initial support for -q, -l, -L modes, grep options reorganization

File size: 2.1 KB
RevLine 
[4324]1/*
[4947]2 *  Copyright (c) 2016 International Characters.
[4324]3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
[5267]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>
[5473]11#include <re/re_parser.h>  // for
[5464]12
[5267]13namespace re { class CC; }
14namespace re { class RE; }
[5473]15namespace llvm { namespace cl { class OptionCategory; } }
[4324]16
[5473]17namespace grep {
18
19// Regular expression syntax, interpretation and processing.
20extern re::RE_Syntax RegexpSyntax;
21extern bool IgnoreCaseFlag;
22extern bool InvertMatchFlag;
23extern bool LineRegexpFlag;
24extern bool WordRegexpFlag;
25
26// Grep input sources and interpretation
27extern bool RecursiveFlag;
28extern bool DereferenceRecursiveFlag;
29
30// Grep output modes and flags.
31enum GrepModeType {QuietMode, FilesWithMatch, FilesWithoutMatch, CountOnly, NormalMode};
32extern GrepModeType Mode;
33
34
35const llvm::cl::OptionCategory * grep_regexp_flags();
36const llvm::cl::OptionCategory * grep_input_flags();
37const llvm::cl::OptionCategory * grep_output_flags();
38
[5406]39class GrepEngine {
[4659]40public:
[4324]41
[5240]42    GrepEngine();
[5401]43
[5473]44    void grepCodeGen(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16, GrepSource grepSource, GrepType grepType = GrepType::Normal);
[5398]45
[5473]46    void grepCodeGen_nvptx(std::vector<re::RE *> REs, GrepModeType grepMode, bool UTF_16);
[5377]47
[5458]48    void doGrep(const std::string & fileName) const;
49
50        uint64_t doGrep(const std::string & fileName, const uint32_t fileIdx) const;
51
[5419]52    uint64_t doGrep(const int32_t fileDescriptor, const uint32_t fileIdx) const;
[4949]53   
[5419]54    void doGrep(const char * buffer, const uint64_t length, const uint32_t fileIdx) const;
[5267]55
[5418]56    re::CC * grepCodepoints();
57
[5267]58    const std::vector<std::string> & grepPropertyValues(const std::string & propertyName);
[4946]59   
[4324]60private:
[4939]61   
[5418]62    void * mGrepFunction;
[4324]63};
64
65
[5033]66re::CC * getParsedCodePointSet();
67void setParsedCodePointSet();
68
[5206]69void setParsedPropertyValues();
70
[5377]71void initFileResult(std::vector<std::string> filenames);
[5473]72void PrintResult(GrepModeType grepMode, std::vector<size_t> & total_CountOnly);
73}
[5033]74
[4324]75#endif
Note: See TracBrowser for help on using the repository browser.