Ignore:
Timestamp:
Oct 5, 2017, 12:14:57 PM (2 years ago)
Author:
cameron
Message:

Full casing properties

Location:
icGREP/icgrep-devel/UCD-scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/UCD-scripts/UCD_parser.py

    r5668 r5669  
    388388    property_object_map['stc'].finalizeProperty()
    389389
     390def parse_SpecialCasing_txt(property_object_map):
     391    data_records = []
     392    f = open(UCD_config.UCD_src_dir + "/SpecialCasing.txt")
     393    lines = f.readlines()
     394    for t in lines:
     395        if UCD_skip.match(t):
     396            continue  # skip comment and blank lines
     397        (cp, cp_hi, fields) = parse_data_record(t)
     398        if len(fields) != 4: continue   #  Ignore context-dependent casing
     399        if fields[3] != '': continue
     400        (lc, uc, tc) = (fields[0], fields[1], fields[2])
     401        if not uc == '':
     402            property_object_map['uc'].addDataRecord(cp, cp, uc)
     403        if not lc == '':
     404            property_object_map['lc'].addDataRecord(cp, cp, lc)
     405        if not tc == '':
     406            property_object_map['tc'].addDataRecord(cp, cp, tc)
     407    property_object_map['lc'].finalizeProperty()
     408    property_object_map['uc'].finalizeProperty()
     409    property_object_map['tc'].finalizeProperty()
     410
  • icGREP/icgrep-devel/UCD-scripts/UCD_properties.py

    r5668 r5669  
    244244            self.emit_property(f, p)
    245245            property_object = self.property_object_map[p]
    246             if isinstance(property_object, BinaryPropertyObject) or isinstance(property_object, EnumeratedPropertyObject): self.supported_props.append(p)
    247246        f.write("}\n\n")
    248247        cformat.close_header_file(f)
     
    259258            self.emit_property(f, p)
    260259            property_object = self.property_object_map[p]
    261             self.supported_props.append(p)
     260        f.write("}\n\n")
     261        cformat.close_header_file(f)
     262        self.property_data_headers.append(basename)
     263
     264    def generate_SpecialCasing_h(self):
     265        basename = 'SpecialCasing'
     266        parse_SpecialCasing_txt(self.property_object_map)
     267        f = cformat.open_header_file_for_write(basename)
     268        cformat.write_imports(f, ['"PropertyAliases.h"', '"PropertyObjects.h"', '"PropertyValueAliases.h"', '"unicode_set.h"'])
     269        f.write("\nnamespace UCD {\n")
     270        for p in ['lc', 'uc', 'tc']:
     271            self.emit_property(f, p)
     272            property_object = self.property_object_map[p]
    262273        f.write("}\n\n")
    263274        cformat.close_header_file(f)
     
    335346
    336347    ucd.generate_UnicodeData_h()
     348   
     349    ucd.generate_SpecialCasing_h()
     350   
    337351    #
    338352    # The Age property
Note: See TracChangeset for help on using the changeset viewer.