Changeset 3965 for icGREP


Ignore:
Timestamp:
Aug 6, 2014, 5:05:37 PM (5 years ago)
Author:
daled
Message:

The Unicode category 'Nd' is in place and it is working.

Location:
icGREP/icgrep-devel/icgrep
Files:
7 edited

Legend:

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

    r3940 r3965  
    44 *  icgrep is a trademark of International Characters.
    55 */
     6
     7#include "icgrep.h"
    68
    79#include "utf_encoding.h"
     
    5254    BitBlock LF;
    5355};
     56
     57/*
    5458
    5559struct Basis_bits {
     
    6367    BitBlock bit_7;
    6468};
     69*/
    6570
    6671#include <simd-lib/transpose.hpp>
  • icGREP/icgrep-devel/icgrep/llvm_gen.cpp

    r3956 r3965  
    1515
    1616extern "C" {
    17     BitBlock wrapped_get_unicode_category(const char* name){
    18         return Unicode_Categories::getCategory(name);
    19     }
    20 }
    21 
    22 BitBlock LLVM_Generator::Get_UnicodeCategory(const char *name)
    23 {
    24     return Unicode_Categories::getCategory(name);
     17    BitBlock wrapped_get_unicode_category(Basis_bits &basis_bits, const char* name){
     18        return Unicode_Categories::getCategory(basis_bits, name);
     19    }
     20}
     21
     22BitBlock LLVM_Generator::Get_UnicodeCategory(Basis_bits &basis_bits, const char *name)
     23{
     24    return Unicode_Categories::getCategory(basis_bits, name);
    2525}
    2626
     
    202202void LLVM_Generator::DeclareFunctions()
    203203{
    204     mFunc_get_unicode_category = mMod->getOrInsertFunction("wrapped_get_unicode_category", m64x2Vect, Type::getInt8PtrTy(mMod->getContext()), NULL);
     204    mFunc_get_unicode_category = mMod->getOrInsertFunction("wrapped_get_unicode_category", m64x2Vect, mStruct_Basis_Bits_Ptr1, Type::getInt8PtrTy(mMod->getContext()), NULL);
    205205    mExecutionEngine->addGlobalMapping(cast<GlobalValue>(mFunc_get_unicode_category), (void *)&wrapped_get_unicode_category);
    206206
     
    413413        if (mMarkerMap.find(call->getCallee()) == mMarkerMap.end())
    414414        {
    415             Value* unicode_category = b.CreateCall(mFunc_get_unicode_category, b.CreateGlobalStringPtr(call->getCallee()));
     415            Value* basis_bits_struct = b.CreateLoad(mPtr_basis_bits_addr);
     416            Value* unicode_category = b.CreateCall2(mFunc_get_unicode_category, basis_bits_struct, b.CreateGlobalStringPtr(call->getCallee()));
    416417            Value* ptr = b.CreateAlloca(m64x2Vect);
    417418            Value* void_1 = b.CreateStore(unicode_category, ptr);
  • icGREP/icgrep-devel/icgrep/llvm_gen.h

    r3955 r3965  
    107107                                    std::list<PabloS*> cc_cgo);
    108108    void Print_Register(char* name, BitBlock bit_block);
    109     BitBlock Get_UnicodeCategory(const char* name);
     109    BitBlock Get_UnicodeCategory(Basis_bits &basis_bits, const char* name);
    110110private:
    111111    void MakeLLVMModule();
  • icGREP/icgrep-devel/icgrep/pbix_compiler.cpp

    r3963 r3965  
    171171                cg_state.stmtsl.push_back(new Assign(gs_retVal, new MatchStar(new Var(cg_state.newsym), new CharClass(rep_name->getName()))));
    172172            }
    173             else if (rep_name->getType() == Name::UnicodeCategory)
    174             {
    175                 // TODO:  ?? not too sure....
    176             }
    177             else //Name::unicode
     173            else //Name::Unicode and Name::UnicodeCategory
    178174            {
    179175                cg_state.stmtsl.push_back(new Assign(gs_retVal,
  • icGREP/icgrep-devel/icgrep/re_nullable.cpp

    r3935 r3965  
    166166        return false;
    167167    }
     168    else if (Name* re_name = dynamic_cast<Name*>(re))
     169    {
     170        return false;
     171    }
    168172    else if (Start* re_start = dynamic_cast<Start*>(re))
    169173    {
  • icGREP/icgrep-devel/icgrep/unicode_categories.cpp

    r3941 r3965  
    11#include "unicode_categories.h"
    22
    3 BitBlock Unicode_Categories::getCategory(const char* category)
     3BitBlock Unicode_Categories::getCategory(Basis_bits &basis_bits, const char* category)
    44{
    5     BitBlock test_vector = simd<1>::constant<0>();
    65
    7     std::cout << "FROM Unicode_Categories, CATEGORY: " << category << std::endl;
     6    /*
     7    if (category == "Lu")
     8    {
     9        Lu lu;
     10        Struct_Lu lu_output;
     11        lu.do_block(basis_bits, lu_output);
    812
    9     return test_vector;
     13        return lu_output.cc;
     14    }
     15    else if (std::strcmp(category,"Cc\n") != 0)
     16    {
     17        Cc cc;
     18        Struct_Cc cc_output;
     19        cc.do_block(basis_bits, cc_output);
     20
     21        return cc_output.cc;
     22    }
     23    else
     24    {
     25        std::cout << "Category not implemented yet." << std::endl;
     26        BitBlock retVal = simd<1>::constant<0>();
     27
     28        return retVal;
     29    }
     30    */
     31
     32    if (std::strcmp(category, "Cc\n") != 0)
     33    {
     34        //Cc cc;
     35        //Struct_Cc cc_output;
     36        //cc.do_block(basis_bits, cc_output);
     37
     38        //return cc_output.cc;
     39    }
     40    else if (std::strcmp(category, "Nd\n") !=0)
     41    {
     42        Nd nd;
     43        Struct_Nd nd_output;
     44        nd.do_block(basis_bits, nd_output);
     45
     46        return nd_output.cc;
     47    }
     48    else
     49    {
     50        std::cout << "Category not implemented yet." << std::endl;
     51        BitBlock retVal = simd<1>::constant<0>();
     52
     53        return retVal;
     54    }
     55
    1056}
    1157
  • icGREP/icgrep-devel/icgrep/unicode_categories.h

    r3941 r3965  
    11#ifndef UNICODE_CATEGORIES_H
    22#define UNICODE_CATEGORIES_H
     3
     4//#include "categories_Cc.h"
     5#include "categories_Nd.h"
    36
    47#include <simd-lib/bitblock.hpp>
     
    912#include <simd-lib/bitblock_iterator.hpp>
    1013
     14#include <cstring>
     15#include <string>
     16
     17//BitBlock None = simd<1>::constant<0>();
     18
    1119class Unicode_Categories
    1220{
    1321public:
    1422    //Unicode_Categories();
    15     static BitBlock getCategory(const char* category);
     23    static BitBlock getCategory(Basis_bits &basis_bits, const char* category);
    1624};
    1725
Note: See TracChangeset for help on using the changeset viewer.