Changeset 4385


Ignore:
Timestamp:
Jan 1, 2015, 3:47:26 PM (4 years ago)
Author:
cameron
Message:

Support for the Unicode script property

Location:
icGREP/icgrep-devel/icgrep
Files:
2 added
1 deleted
2 edited

Legend:

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

    r4383 r4385  
    2525#include <pablo/analysis/useanalysis.h>
    2626
    27 #include "unicode_categories.h"
     27#include "UCD/precompiled_gc.h"
     28#include "UCD/precompiled_sc.h"
    2829
    2930#include "resolve_properties.cpp"
     
    153154    PabloCompiler pablo_compiler(basisBits);
    154155   
    155 #define CHECK_GENERAL_CODE_CATEGORY(SUFFIX) \
    156     pablo_compiler.InstallExternalFunction(std::string("__get_gc_") + std::string(#SUFFIX), (void*)&__get_gc_##SUFFIX);
    157    
    158     CHECK_GENERAL_CODE_CATEGORY(Cc)
    159     CHECK_GENERAL_CODE_CATEGORY(Cf)
    160     CHECK_GENERAL_CODE_CATEGORY(Cn)
    161     CHECK_GENERAL_CODE_CATEGORY(Co)
    162     CHECK_GENERAL_CODE_CATEGORY(Cs)
    163     CHECK_GENERAL_CODE_CATEGORY(Ll)
    164     CHECK_GENERAL_CODE_CATEGORY(Lm)
    165     CHECK_GENERAL_CODE_CATEGORY(Lo)
    166     CHECK_GENERAL_CODE_CATEGORY(Lt)
    167     CHECK_GENERAL_CODE_CATEGORY(Lu)
    168     CHECK_GENERAL_CODE_CATEGORY(Mc)
    169     CHECK_GENERAL_CODE_CATEGORY(Me)
    170     CHECK_GENERAL_CODE_CATEGORY(Mn)
    171     CHECK_GENERAL_CODE_CATEGORY(Nd)
    172     CHECK_GENERAL_CODE_CATEGORY(Nl)
    173     CHECK_GENERAL_CODE_CATEGORY(No)
    174     CHECK_GENERAL_CODE_CATEGORY(Pc)
    175     CHECK_GENERAL_CODE_CATEGORY(Pd)
    176     CHECK_GENERAL_CODE_CATEGORY(Pe)
    177     CHECK_GENERAL_CODE_CATEGORY(Pf)
    178     CHECK_GENERAL_CODE_CATEGORY(Pi)
    179     CHECK_GENERAL_CODE_CATEGORY(Po)
    180     CHECK_GENERAL_CODE_CATEGORY(Ps)
    181     CHECK_GENERAL_CODE_CATEGORY(Sc)
    182     CHECK_GENERAL_CODE_CATEGORY(Sk)
    183     CHECK_GENERAL_CODE_CATEGORY(Sm)
    184     CHECK_GENERAL_CODE_CATEGORY(So)
    185     CHECK_GENERAL_CODE_CATEGORY(Zl)
    186     CHECK_GENERAL_CODE_CATEGORY(Zp)
    187     CHECK_GENERAL_CODE_CATEGORY(Zs)
    188    
     156    install_property_gc_fn_ptrs(pablo_compiler);
     157    install_property_sc_fn_ptrs(pablo_compiler);
    189158
    190159    LLVM_Gen_RetVal retVal = pablo_compiler.compile(main);
  • icGREP/icgrep-devel/icgrep/resolve_properties.cpp

    r4384 r4385  
    7575                if (theprop == UCD::gc) {
    7676                    // General Category
    77                    
    78                     int valcode = dynamic_cast<UCD::EnumeratedPropertyObject *> (UCD::property_object_table[UCD::gc])->GetPropertyValueEnumCode(v);
    79                    
     77                    int valcode = dynamic_cast<UCD::EnumeratedPropertyObject *> (UCD::property_object_table[UCD::gc])->GetPropertyValueEnumCode(v);                   
    8078                    if (valcode > 0) {
    8179                        name->setName("__get_gc_" + UCD::GC_ns::enum_names[valcode]);
     
    8482                else if (theprop == UCD::sc) {
    8583                    // Script property identified
    86                     throw std::runtime_error("Script property identified, aborting\n");
     84                    int valcode = dynamic_cast<UCD::EnumeratedPropertyObject *> (UCD::property_object_table[UCD::sc])->GetPropertyValueEnumCode(v);                   
     85                    if (valcode > 0) {
     86                        name->setName("__get_sc_" + UCD::SC_ns::enum_names[valcode]);
     87                    }
    8788                }
    8889                else if (theprop == UCD::scx) {
     
    100101                    theprop = UCD::gc;
    101102                    name->setName("__get_gc_" + UCD::GC_ns::enum_names[valcode]);
     103                    return;
    102104                }
    103                 else if (dynamic_cast<UCD::EnumeratedPropertyObject *> (UCD::property_object_table[UCD::sc])->GetPropertyValueEnumCode(v) > 0) {
     105                valcode = dynamic_cast<UCD::EnumeratedPropertyObject *> (UCD::property_object_table[UCD::sc])->GetPropertyValueEnumCode(v);
     106                if (valcode > 0) {
    104107                    theprop = UCD::sc;
    105                     throw std::runtime_error("Script property identified by value, aborting\n");
     108                    name->setName("__get_sc_" + UCD::SC_ns::enum_names[valcode]);
     109                    return;
    106110                }
    107 
    108111                else {
    109112                    throw std::runtime_error("Unknown property, aborting\n");
Note: See TracChangeset for help on using the changeset viewer.