summaryrefslogtreecommitdiff
path: root/tool/unicode_norm_gen.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/unicode_norm_gen.rb')
-rw-r--r--tool/unicode_norm_gen.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/tool/unicode_norm_gen.rb b/tool/unicode_norm_gen.rb
index d1be12e50a..03a32bbdc5 100644
--- a/tool/unicode_norm_gen.rb
+++ b/tool/unicode_norm_gen.rb
@@ -4,6 +4,9 @@
# available under the same licence as Ruby itself
# (see http://www.ruby-lang.org/en/LICENSE.txt)
+InputDataDir = '../enc/unicode/data'
+OuputDataDir = '../lib/unicode_normalize'
+
class Integer
def to_UTF8()
if self>0xFFFF
@@ -53,7 +56,7 @@ class Hash
end
# read the file 'CompositionExclusions.txt'
-composition_exclusions = IO.readlines("../data/CompositionExclusions.txt")
+composition_exclusions = IO.readlines("#{InputDataDir}/CompositionExclusions.txt")
.select { |line| line =~ /^[A-Z0-9]{4,5}/ }
.collect { |line| line.split(' ').first.hex }
@@ -62,7 +65,7 @@ kompatible_table = {}
CombiningClass = {} # constant to allow use in Integer#to_UTF8
# read the file 'UnicodeData.txt'
-IO.foreach("../data/UnicodeData.txt") do |line|
+IO.foreach("#{InputDataDir}/UnicodeData.txt") do |line|
codepoint, name, _2, char_class, _4, decomposition, *_rest = line.split(";")
case decomposition
@@ -129,7 +132,7 @@ class_table_str = CombiningClass.collect do |key, value|
end.line_slice "\n "
# generate normalization tables file
-open("normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
+open("#{OuputDataDir}/normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
# coding: utf-8
# automatically generated by generate.rb