Ignore:
Timestamp:
Sep 12, 2016, 12:58:31 PM (3 years ago)
Author:
cameron
Message:

Generate property value enumerations with default value first (enum code 0).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/UCD/UCD_properties.py

    r5143 r5153  
    100100
    101101 
    102     def generate_property_value_file(self, filename_root, property_code, default_value = None):
     102    def generate_property_value_file(self, filename_root, property_code):
     103        canon_map = self.property_value_lookup_map[property_code]
     104        if self.missing_specs.has_key(property_code):
     105            default_value = canon_map[canonicalize(self.missing_specs[property_code])]
     106        else: default_value = None
    103107        vlist = self.property_value_list[property_code]
    104108        canon_map = self.property_value_lookup_map[property_code]
    105109        (prop_values, value_map) = parse_UCD_enumerated_property_map(property_code, vlist, canon_map, filename_root + '.txt', default_value)
     110        #
     111        self.property_value_list[property_code] = prop_values
    106112        basename = os.path.basename(filename_root)
    107113        f = cformat.open_header_file_for_write(os.path.basename(filename_root))
     
    109115        f.write("\nnamespace UCD {\n")
    110116        f.write("    namespace %s_ns {\n" % property_code.upper())
    111         for v in self.property_value_list[property_code]:
     117        for v in prop_values:
    112118            f.write("    /** Code Point Ranges for %s\n    " % v)
    113119            f.write(cformat.multiline_fill(['[%s, %s]' % (lo, hi) for (lo, hi) in uset_to_range_list(value_map[v])], ',', 4))
     
    116122            f.write(value_map[v].showC(8) + ";\n")
    117123        print "%s: %s bytes" % (basename, sum([value_map[v].bytes() for v in value_map.keys()]))
    118         set_list = ['&%s_Set' % v.lower() for v in self.property_value_list[property_code]]
     124        set_list = ['&%s_Set' % v.lower() for v in prop_values]
    119125        f.write("    static EnumeratedPropertyObject property_object\n")
    120126        f.write("        {%s,\n" % property_code)
     
    214220    # Next parse all property value names and their aliases.  Generate the data.
    215221    ucd.load_property_value_info()
    216     ucd.generate_PropertyValueAliases_h()
    217222    #
    218223    # The Age property
     
    281286    # ucd.generate_property_value_file('Jamo', 'jsn')
    282287    #
    283     # Stubs
    284     #
     288    #
     289    #
     290    ucd.generate_PropertyValueAliases_h()
     291
    285292    ucd.generate_PropertyObjectTable_h()
    286293
Note: See TracChangeset for help on using the changeset viewer.