Ignore:
Timestamp:
May 6, 2015, 8:27:36 AM (4 years ago)
Author:
cameron
Message:

Tracing options; make all command line options static

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r4538 r4544  
    11/*
    2  *  Copyright (c) 2014 International Characters.
     2 *  Copyright (c) 2015 International Characters.
    33 *  This software is licensed to the public under the Open Software License 3.0.
    44 *  icgrep is a trademark of International Characters.
     
    1616
    1717#include "llvm/Support/CommandLine.h"
     18
     19static cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
     20                                       "These options control the regular expression source.");
     21
     22static cl::OptionCategory bGrepOutputOptions("Output Options",
     23                                      "These options control the output.");
     24
     25static cl::list<std::string> inputFiles(cl::Positional, cl::desc("<regex> <input file ...>"), cl::OneOrMore);
     26
     27static cl::opt<bool> CountOnly("c", cl::desc("Count and display the matching lines per file only."), cl::cat(bGrepOutputOptions));
     28static cl::alias CountOnlyLong("count", cl::desc("Alias for -c"), cl::aliasopt(CountOnly));
     29static cl::opt<bool> NormalizeLineBreaks("normalize-line-breaks", cl::desc("Normalize line breaks to std::endl."), cl::init(false),  cl::cat(bGrepOutputOptions));
     30
     31static cl::opt<bool> ShowFileNames("H", cl::desc("Show the file name with each matching line."), cl::cat(bGrepOutputOptions));
     32static cl::alias ShowFileNamesLong("with-filename", cl::desc("Alias for -H"), cl::aliasopt(ShowFileNames));
     33
     34static cl::opt<bool> CaseInsensitive("i", cl::desc("Ignore case distinctions in the pattern and the file."), cl::cat(aRegexSourceOptions));
     35static cl::opt<bool> ShowLineNumbers("n", cl::desc("Show the line number with each matching line."), cl::cat(bGrepOutputOptions));
     36static cl::alias ShowLineNumbersLong("line-number", cl::desc("Alias for -n"), cl::aliasopt(ShowLineNumbers));
     37
     38static cl::list<std::string> regexVector("e", cl::desc("Regular expression"), cl::ZeroOrMore, cl::cat(aRegexSourceOptions));
     39static cl::opt<std::string> RegexFilename("f", cl::desc("Take regular expressions (one per line) from a file"), cl::value_desc("regex file"), cl::init(""), cl::cat(aRegexSourceOptions));
     40
     41
     42
    1843
    1944int main(int argc, char *argv[]) {
     
    4469    Map["verify-scev"]->setHiddenFlag(cl::Hidden);
    4570   
     71    cl::ParseCommandLineOptions(argc, argv);
    4672   
    47     cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
    48                                           "These options control the regular expression source.");
    49    
    50     cl::OptionCategory bGrepOutputOptions("Output Options",
    51                                          "These options control the output.");
    5273   
    5374    int firstInputFile = 1;  // Normal case when first positional arg is a regex.
    54     cl::list<std::string> inputFiles(cl::Positional, cl::desc("<regex> <input file ...>"), cl::OneOrMore);
    55    
    56     cl::opt<bool> CountOnly("c", cl::desc("Count and display the matching lines per file only."), cl::cat(bGrepOutputOptions));
    57     cl::alias CountOnlyLong("count", cl::desc("Alias for -c"), cl::aliasopt(CountOnly));
    58     cl::opt<bool> NormalizeLineBreaks("normalize-line-breaks", cl::desc("Normalize line breaks to std::endl."), cl::init(false),  cl::cat(bGrepOutputOptions));
    59    
    60     cl::opt<bool> ShowFileNames("H", cl::desc("Show the file name with each matching line."), cl::cat(bGrepOutputOptions));
    61     cl::alias ShowFileNamesLong("with-filename", cl::desc("Alias for -H"), cl::aliasopt(ShowFileNames));
    62    
    63     cl::opt<bool> CaseInsensitive("i", cl::desc("Ignore case distinctions in the pattern and the file."), cl::cat(aRegexSourceOptions));
    64     cl::opt<bool> ShowLineNumbers("n", cl::desc("Show the line number with each matching line."), cl::cat(bGrepOutputOptions));
    65     cl::alias ShowLineNumbersLong("line-number", cl::desc("Alias for -n"), cl::aliasopt(ShowLineNumbers));
    66    
    67     cl::list<std::string> regexVector("e", cl::desc("Regular expression"), cl::ZeroOrMore, cl::cat(aRegexSourceOptions));
    68    
    69     cl::opt<std::string> RegexFilename("f", cl::desc("Take regular expressions (one per line) from a file"), cl::value_desc("regex file"), cl::init(""), cl::cat(aRegexSourceOptions));
    70  
    71     // Does -b mean the byte offset of the line, or the byte offset of the match start within the line?
    72     //static cl::opt<bool>ShowByteOffsets("b", cl::desc("Show the byte offset with each matching line."));
    73     //cl::alias ShowByteOffsetsLong("-byte-offset", cl::desc("Alias for -b"), cl::aliasopt(ShowByteOffsets));
    7475
    7576    Encoding encoding(Encoding::Type::UTF_8, 8);
    7677
    77     cl::ParseCommandLineOptions(argc, argv);
    7878   
    7979    //std::vector<std::string> regexVector;
Note: See TracChangeset for help on using the changeset viewer.