From 162f137de9416187fdae1cba75ffce880c5507e1 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Fri, 23 Dec 2011 04:29:33 +0000 Subject: [PATCH] ICU-8972 document stable pnames_data.h output X-SVN-Rev: 31171 --- tools/unicode/py/preparseucd.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/unicode/py/preparseucd.py b/tools/unicode/py/preparseucd.py index 389bb125a40..d70a3aca1f5 100755 --- a/tools/unicode/py/preparseucd.py +++ b/tools/unicode/py/preparseucd.py @@ -1495,11 +1495,11 @@ _bc_comment_re = re.compile(" */\*\* *([A-Z]{1,3}) ") _bc_re = re.compile(" *(U_[A-Z_]+) *= *[0-9]+,") # Sample line to match: -# UBLOCK_CYRILLIC =9, /*[0400]*/ +# UBLOCK_CYRILLIC =9, _ublock_re = re.compile(" *(UBLOCK_[0-9A-Z_]+) *= *[0-9]+,") # Sample line to match: -# U_EA_AMBIGUOUS, /*[A]*/ +# U_EA_AMBIGUOUS, _prop_and_value_re = re.compile( " *(U_(DT|EA|GCB|HST|LB|JG|JT|NT|SB|WB)_([0-9A-Z_]+))") @@ -1680,6 +1680,18 @@ def WritePNamesDataHeader(out_path): """) + # Note: The uchar.h & uscript.h parsers store the ICU Unicode properties + # and values in the order of their definition, + # and this function writes them in that order. + # Since the ICU API constants are stable and new values are only + # appended at the end + # (new properties are added at the end of each binary/enum/... range), + # the output is stable as well. + # When a property or value constant is renamed, + # it only changes the name itself in the output; + # it does not move in the output since there is no sorting. + # This minimizes diffs and assists with reviewing and evaluating updates. + version = _ucd_version.split('.') while len(version) < 4: version.append("0") out_file.write("#define UNICODE_VERSION { %s }\n\n" % ", ".join(version))