summaryrefslogtreecommitdiff
path: root/src/make_unicode_egcb_data.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-12-23 07:44:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2019-12-23 07:44:50 +0100
commit9e629c8f43b43617fa5b7d3654f7d81e81b8a427 (patch)
tree581dcb2708a7eac0bcc7bbfa6478cfa50dfcf5a8 /src/make_unicode_egcb_data.py
parent7bbf4ae1401bc6e40f71a32d3f97952796d85690 (diff)
parent091456e1a135d4674701a264495bd34918779391 (diff)
Merge branch 'release/debian/6.9.4-1'debian/6.9.4-1
Diffstat (limited to 'src/make_unicode_egcb_data.py')
-rwxr-xr-xsrc/make_unicode_egcb_data.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/make_unicode_egcb_data.py b/src/make_unicode_egcb_data.py
index 0f63f97..9c71796 100755
--- a/src/make_unicode_egcb_data.py
+++ b/src/make_unicode_egcb_data.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# make_unicode_egcb_data.py
-# Copyright (c) 2017-2018 K.Kosako
+# Copyright (c) 2017-2019 K.Kosako
import sys
import re
@@ -13,18 +13,19 @@ PR_LINE_REG = re.compile("([0-9A-Fa-f]+)(?:..([0-9A-Fa-f]+))?\s*;\s*(\w+)")
PA_LINE_REG = re.compile("(\w+)\s*;\s*(\w+)")
PVA_LINE_REG = re.compile("(sc|gc)\s*;\s*(\w+)\s*;\s*(\w+)(?:\s*;\s*(\w+))?")
BL_LINE_REG = re.compile("([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+)\s*;\s*(.*)")
-VERSION_REG = re.compile("#\s*.*-(\d+\.\d+\.\d+)\.txt")
+VERSION_REG = re.compile("#\s*.*-(\d+)\.(\d+)\.(\d+)\.txt")
-VERSION_INFO = None
+VERSION_INFO = [-1, -1, -1]
DIC = { }
PROPS = []
PropIndex = { }
def check_version_info(s):
- global VERSION_INFO
m = VERSION_REG.match(s)
if m is not None:
- VERSION_INFO = m.group(1)
+ VERSION_INFO[0] = int(m.group(1))
+ VERSION_INFO[1] = int(m.group(2))
+ VERSION_INFO[2] = int(m.group(3))
def print_ranges(ranges):
for (start, end) in ranges:
@@ -160,7 +161,7 @@ def parse_properties(path):
continue
if s[0] == '#':
- if VERSION_INFO is None:
+ if VERSION_INFO[0] < 0:
check_version_info(s)
m = PR_LINE_REG.match(s)
@@ -194,7 +195,7 @@ PROPS = sorted(PROPS)
print '/* unicode_egcb_data.c: Generated by make_unicode_egcb_data.py. */'
COPYRIGHT = '''
/*-
- * Copyright (c) 2017-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2017-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -222,9 +223,11 @@ COPYRIGHT = '''
print COPYRIGHT
print ''
-if VERSION_INFO is not None:
- print "#define GRAPHEME_BREAK_PROPERTY_VERSION %s" % re.sub(r'[\.-]', '_', VERSION_INFO)
- print ''
+if VERSION_INFO[0] < 0:
+ raise RuntimeError("Version is not found")
+
+print "#define GRAPHEME_BREAK_PROPERTY_VERSION %02d%02d%02d" % (VERSION_INFO[0], VERSION_INFO[1], VERSION_INFO[2])
+print ''
ranges = []
for prop in PROPS: