summaryrefslogtreecommitdiff
path: root/src/make_unicode_egcb_data.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-11-29 11:26:35 +0100
committerJörg Frings-Fürst <debian@jff.email>2019-11-29 11:26:35 +0100
commit4216de6a3336cbc6dddb572cb7e6ab6193bf3729 (patch)
tree327a40dae71db474527a1281a205cc2ebddb2ce6 /src/make_unicode_egcb_data.py
parent40f3d0030e6e98bcb02d6523e5ee48497dec49a6 (diff)
New upstream version 6.9.4upstream/6.9.4
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: