Changeset 4949


Ignore:
Timestamp:
Mar 2, 2016, 5:47:13 PM (3 years ago)
Author:
cameron
Message:

Integrate Unicode Name data into icgrep executable

Location:
icGREP/icgrep-devel/icgrep
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4946 r4949  
    8181add_library(RegExpCompiler re/re_parser.cpp re/parsefailure.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_compiler.cpp re/re_analysis.cpp)
    8282add_library(CCADT cc/cc_compiler.cpp utf8_encoder.cpp UCD/CaseFolding_txt.cpp)
    83 add_library(UCDlib UCD/unicode_set.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp)
     83add_library(UCDlib UCD/unicode_set.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp UCD/UnicodeNameData.cpp)
    8484
    8585# add the executable
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r4947 r4949  
    1717#include <llvm/Support/Debug.h>
    1818#include <llvm/IR/Verifier.h>
     19#include <UCD/UnicodeNameData.h>
    1920
    2021#include <fstream>
     
    136137}
    137138
     139void GrepEngine::closeMMap() {
     140#ifdef USE_BOOST_MMAP
     141    mFile.close();
     142#else
     143    munmap((void *)mFileBuffer, mFileSize);
     144#endif   
     145
     146}
    138147
    139148void GrepEngine::doGrep() {
     
    147156    mMainFcn(mFileBuffer, mFileSize, mFileName.c_str(), finalLineUnterminated);
    148157   
    149     PrintTotalCount();
    150    
    151 #ifdef USE_BOOST_MMAP
    152     mFile.close();
    153 #else
    154     munmap((void *)mFileBuffer, mFileSize);
    155 #endif   
     158    if (!mIsNameExpression) PrintTotalCount();
    156159}
    157 
    158160
    159161void GrepEngine::grepCodeGen(std::string moduleName, re::RE * re_ast, bool isNameExpression) {
     
    166168
    167169    Encoding encoding(Encoding::Type::UTF_8, 8);
     170    mIsNameExpression = isNameExpression;
    168171    re_ast = regular_expression_passes(encoding, re_ast);   
    169172    pablo::PabloFunction * function = re2pablo_compiler(encoding, re_ast);
     
    187190re::CC *  GrepEngine::grepCodepoints() {
    188191    setParsedCodePointSet();
    189     if (openMMap("../UName.txt")) {
    190         doGrep();
    191     }
     192    mFileBuffer = getUnicodeNameDataPtr();
     193    mFileSize = getUnicodeNameDataSize();
     194    mFileName = "Uname.txt";
     195    doGrep();
    192196    return getParsedCodePointSet();
    193197}
  • icGREP/icgrep-devel/icgrep/grep_engine.h

    r4947 r4949  
    2525   
    2626    bool openMMap(const std::string & fileName);
     27   
     28    void closeMMap();
    2729
    2830    void doGrep();
     
    4042    main_fcn_T mMainFcn;
    4143   
     44    bool mIsNameExpression;
    4245    std::string mFileName;
    4346    size_t mFileSize;
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r4947 r4949  
    131131        if (grepEngine.openMMap(inputFiles[i])) {
    132132            grepEngine.doGrep();
     133            grepEngine.closeMMap();
    133134        }
    134135    }
Note: See TracChangeset for help on using the changeset viewer.