ENCODING = 'utf-8'
LINE_REG = re.compile("([0-9A-F]{1,6}); (.); ([0-9A-F]{1,6})(?: ([0-9A-F]{1,6}))?(?: ([0-9A-F]{1,6}))?;(?:\s*#\s*)(.*)")
+VERSION_REG = re.compile("#.*-(\d\.\d\.\d)\.txt")
+
+VERSION_INFO = None
FOLDS = {}
TURKISH_FOLDS = {}
x2 = (x>>16) & 0xff
return "\\x%02x\\x%02x\\x%02x" % (x2, x1, x0)
+def check_version_info(s):
+ global VERSION_INFO
+ if VERSION_INFO is None:
+ m = VERSION_REG.match(s)
+ if m is not None:
+ VERSION_INFO = m.group(1)
+
def parse_line(s):
if len(s) == 0:
return False
if s[0] == '#':
+ check_version_info(s)
return False
m = LINE_REG.match(s)
print >> f, "/* This file was generated by make_unicode_fold_data.py. */"
print >> f, '#include "regenc.h"'
print >> f, ''
+ if VERSION_INFO is not None:
+ print "#define CASEFOLD_VERSION %s" % re.sub(r'[\.-]', '_', VERSION_INFO)
+ print ''
#output_macros(f, DataName)
print >> f, ''
#output_typedef(f)