Ignore:
Timestamp:
May 3, 2016, 5:53:12 PM (3 years ago)
Author:
xuedongx
Message:

If '-c', ignore the scanmatch kernel.

File:
1 edited

Legend:

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

    r5017 r5025  
    66
    77#include <cstdio>
    8 
     8#include <vector>
    99#include <llvm/Support/CommandLine.h>
    1010#include <re/re_alt.h>
     
    1919
    2020#include <iostream> // MEEE
     21static cl::OptionCategory CountOnlyOptions("CountOnly Option",
     22                                       "This option controls the output.");
     23static cl::opt<bool> CountOnly("c", cl::desc("Count and display the matching lines per file only."), cl::cat(CountOnlyOptions));
     24static cl::alias CountOnlyLong("count", cl::desc("Alias for -c"), cl::aliasopt(CountOnly));
    2125
    2226static cl::OptionCategory aRegexSourceOptions("Regular Expression Options",
     
    9195}
    9296
     97std::vector<int> total_CountOnly;
    9398std::mutex count_mutex;
    9499size_t fileCount;
     
    104109
    105110    while (fileIdx < inputFiles.size()){
    106         grepEngine->doGrep(inputFiles[fileIdx], fileIdx);
     111        grepEngine->doGrep(inputFiles[fileIdx], fileIdx, CountOnly, total_CountOnly);
    107112       
    108113        count_mutex.lock();
     
    236241   
    237242    GrepEngine grepEngine;
    238     grepEngine.grepCodeGen(module_name, re_ast);
    239 
     243    grepEngine.grepCodeGen(module_name, re_ast, CountOnly);
     244   
    240245    initResult(inputFiles);
     246    for (int i=0; i<inputFiles.size(); i++){
     247        total_CountOnly.push_back(0);
     248    }
     249
    241250    if (Threads <= 1) {
    242251        for (unsigned i = 0; i != inputFiles.size(); ++i) {
    243             grepEngine.doGrep(inputFiles[i], i);
     252            grepEngine.doGrep(inputFiles[i], i, CountOnly, total_CountOnly);
    244253        }       
    245254    } else if (Threads > 1) {
     
    262271        }
    263272    }
    264     PrintResult();   
     273    PrintResult(CountOnly, total_CountOnly);
    265274   
    266275    return 0;
Note: See TracChangeset for help on using the changeset viewer.