Ignore:
Timestamp:
Aug 26, 2016, 12:48:42 PM (3 years ago)
Author:
cameron
Message:

refine PabloKernel? signature based on CountOnly? parameter

Location:
icGREP/icgrep-devel/icgrep/re
Files:
4 edited

Legend:

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

    r5091 r5134  
    8686    mLineBreak = mPB.createOr(lb, unterminatedLineAtEOF);
    8787    mAny = mPB.createNot(lb, "any");
    88     mFunction.setResult(1, mPB.createAssign("lf", mLineBreak));
     88    if (!mCountOnly) mFunction.setResult(1, mPB.createAssign("lf", mLineBreak));
    8989    return;
    9090}
     
    170170    mLineBreak = mPB.createOr(lb, unterminatedLineAtEOF);
    171171    mAny = mPB.createNot(lb, "any");
    172     mFunction.setResult(1, mPB.createAssign("lf", mLineBreak));
     172    if (!mCountOnly) mFunction.setResult(1, mPB.createAssign("lf", mLineBreak));
    173173}
    174174
     
    212212    }
    213213    Assign * matches = mPB.createAssign("matches", mPB.createAnd(match_follow, mLineBreak));
    214     mFunction.setResultCount(mPB.createCount("matchedLineCount", matches));
    215     mFunction.setResult(0, matches);
     214    if (mCountOnly) {
     215        mFunction.setResultCount(mPB.createCount("matchedLineCount", matches));
     216    }
     217    else {
     218        mFunction.setResult(0, matches);
     219    }
    216220}
    217221
     
    626630}
    627631
    628 RE_Compiler::RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler)
    629 : mCCCompiler(ccCompiler)
     632RE_Compiler::RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler, bool CountOnly)
     633: mCountOnly(CountOnly)
     634, mCCCompiler(ccCompiler)
    630635, mLineBreak(nullptr)
    631636, mCRLF(nullptr)
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r5091 r5134  
    5252public:
    5353
    54     RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler);
     54    RE_Compiler(pablo::PabloFunction & function, cc::CC_Compiler & ccCompiler, bool CountOnly = false);
    5555    void initializeRequiredStreams(Encoding encoding);
    5656    void compileUnicodeNames(RE *& re);
     
    9393private:
    9494
     95    bool                                            mCountOnly;
    9596    cc::CC_Compiler &                               mCCCompiler;
    9697    pablo::PabloAST *                               mLineBreak;
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.cpp

    r5045 r5134  
    8686}
    8787   
    88 PabloFunction * re2pablo_compiler(const Encoding encoding, RE * re_ast) {
    89     PabloFunction * function = PabloFunction::Create("process_block", encoding.getBits(), 2);
     88PabloFunction * re2pablo_compiler(const Encoding encoding, RE * re_ast, bool CountOnly) {
     89    PabloFunction * function = PabloFunction::Create("process_block", encoding.getBits(), CountOnly ? 0 : 2);
    9090    cc::CC_Compiler cc_compiler(*function, encoding);
    91     re::RE_Compiler re_compiler(*function, cc_compiler);
     91    re::RE_Compiler re_compiler(*function, cc_compiler, CountOnly);
    9292    re_compiler.initializeRequiredStreams(encoding);
    9393    re_compiler.compileUnicodeNames(re_ast);
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.h

    r5030 r5134  
    3333RE * regular_expression_passes(const Encoding encoding, RE * re_ast);
    3434
    35 pablo::PabloFunction * re2pablo_compiler(const Encoding encoding, RE * re_ast);
     35pablo::PabloFunction * re2pablo_compiler(const Encoding encoding, RE * re_ast, bool CountOnly = false);
    3636   
    3737}
Note: See TracChangeset for help on using the changeset viewer.