Changeset 4803


Ignore:
Timestamp:
Sep 28, 2015, 9:27:09 AM (2 years ago)
Author:
cameron
Message:

Work on character name patterns

Location:
icGREP/icgrep-devel/icgrep
Files:
6 edited
1 moved

Legend:

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

    r4802 r4803  
    55 */
    66
    7 #include "icgrep.h"
     7#include "basis_bits.h"
    88#include "do_grep.h"
    99
  • icGREP/icgrep-devel/icgrep/do_grep.h

    r4802 r4803  
    99#include <string>
    1010#include <stdint.h>
    11 
     11#include "basis_bits.h"
    1212#include "include/simd-lib/bitblock.hpp"
    1313#include "include/simd-lib/transpose.hpp"
     
    5757         
    5858    void setCountOnlyOption(bool doCount = true) {mCountOnlyOption = doCount;}
    59     void setGetCodePointsOption(bool doCodepoints = true) {
    60         mGetCodePointsOption = doCodepoints;
     59    void setParseCodepointsOption() {
     60        mGetCodePointsOption = true;
    6161        mParsedCodePointSet = re::makeCC();
    6262    }
  • icGREP/icgrep-devel/icgrep/icgrep.cpp

    r4801 r4803  
    99#include <fstream>
    1010
    11 #include "icgrep.h"
     11#include "basis_bits.h"
    1212#include "toolchain.h"
    1313#include "utf_encoding.h"
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r4726 r4803  
    44 *  icgrep is a trademark of International Characters.
    55 */
    6 
    7 #include "re_compiler.h"
     6#include <re/re_compiler.h>
    87//Regular Expressions
    98#include <re/re_name.h>
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r4798 r4803  
    1818#include <UCD/resolve_properties.h>
    1919#include <UCD/CaseFolding_txt.h>
     20#include <toolchain.h>
     21#include "utf_encoding.h"
     22#include <pablo/pablo_compiler.h>
     23#include <do_grep.h>
     24
    2025#include <sstream>
    2126#include <algorithm>
     
    555560    // Embed the nameRE in ";.*$nameRE" to skip the codepoint field of Uname.txt
    556561    RE * embedded = makeSeq({re::makeCC(0x3B), re::makeRep(re::makeAny(), 0, Rep::UNBOUNDED_REP), nameRE});
    557 
    558 
     562    Encoding encoding(Encoding::Type::UTF_8, 8);
    559563    throw ParseFailure("\\N{...} character name expression recognized but not yet supported.");
    560 
    561 
     564    // Debugging needed:
     565    pablo::PabloFunction * nameSearchFunction = re2pablo_compiler(encoding, embedded);
     566    llvm::Function * nameSearchIR = nullptr;
     567   
     568    pablo_function_passes(nameSearchFunction);
     569    pablo::PabloCompiler pablo_compiler;
     570    try {
     571        nameSearchIR = pablo_compiler.compile(nameSearchFunction);
     572        releaseSlabAllocatorMemory();
     573    }
     574    catch (std::runtime_error e) {
     575        releaseSlabAllocatorMemory();
     576        std::cerr << "Runtime error: " << e.what() << std::endl;
     577        exit(1);
     578    }
     579    llvm::ExecutionEngine * engine = JIT_to_ExecutionEngine(nameSearchIR);
     580   
     581    icgrep_Linking(nameSearchIR->getParent(), engine);
     582   
     583    // Ensure everything is ready to go.
     584    engine->finalizeObject();
     585   
     586    void * icgrep_MCptr = engine->getPointerToFunction(nameSearchIR);
     587   
     588    if (icgrep_MCptr) {
     589        GrepExecutor grepEngine(icgrep_MCptr);
     590        grepEngine.setParseCodepointsOption();
     591        grepEngine.doGrep("../Uname.txt");
     592        return grepEngine.getParsedCodepoints();
     593    }
     594    else {
     595        return nullptr;
     596    }
     597   
     598    //engine->freeMachineCodeForFunction(nameSearchIR); // This function only prints a "not supported" message. Reevaluate with LLVM 3.6.
     599    delete engine;
    562600}
    563601
  • icGREP/icgrep-devel/icgrep/toolchain.cpp

    r4801 r4803  
    99#include <fstream>
    1010
    11 #include "icgrep.h"
     11#include "basis_bits.h"
    1212#include "utf_encoding.h"
    1313#include "pablo/pablo_compiler.h"
Note: See TracChangeset for help on using the changeset viewer.