summaryrefslogtreecommitdiff
path: root/enc/unicode
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-30 23:56:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-30 23:56:00 +0000
commit88eae35862f3b228443f116234cbf09057c361c8 (patch)
tree8c41fd4f70788aa16945c5ccad5f6ffedbff03ee /enc/unicode
parent1d588b4fde447d38c978a11b8e89ae8b5436f2e8 (diff)
case-folding.rb: merge tables
* enc/unicode/case-folding.rb (print_table): merge non-locale and locale tables, and reduce initializing loops. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode')
-rwxr-xr-xenc/unicode/case-folding.rb16
-rw-r--r--enc/unicode/casefold.h24
2 files changed, 19 insertions, 21 deletions
diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb
index 09fc719..f1faaeb 100755
--- a/enc/unicode/case-folding.rb
+++ b/enc/unicode/case-folding.rb
@@ -20,11 +20,14 @@ class CaseFolding
end
def print_table(dest, type, data)
+ dest.print("static const #{type}_Type #{type}_Table[] = {\n")
+ i = 0
data.each do |n, d|
- dest.print("static const #{type}_Type #{n}[] = {\n")
+ dest.print("#define #{n} (*(#{type}_Type (*)[#{d.size}])(#{type}_Table+#{i}))\n")
+ i += d.size
print_table_1(dest, d)
- dest.print("};\n\n")
end
+ dest.print("};\n\n")
end
end
@@ -82,20 +85,17 @@ class CaseFolding
# CaseFold + CaseFold_Locale
name = "CaseFold_11"
- print_table(dest, name, "CaseFold"=>fold)
- print_table(dest, name, "CaseFold_Locale"=>fold_locale)
+ print_table(dest, name, "CaseFold"=>fold, "CaseFold_Locale"=>fold_locale)
# print unfolding data
# CaseUnfold_11 + CaseUnfold_11_Locale
name = "CaseUnfold_11"
- print_table(dest, name, name=>unfold[0])
- print_table(dest, name, "#{name}_Locale"=>unfold_locale[0])
+ print_table(dest, name, name=>unfold[0], "#{name}_Locale"=>unfold_locale[0])
# CaseUnfold_12 + CaseUnfold_12_Locale
name = "CaseUnfold_12"
- print_table(dest, name, name=>unfold[1])
- print_table(dest, name, "#{name}_Locale"=>unfold_locale[1])
+ print_table(dest, name, name=>unfold[1], "#{name}_Locale"=>unfold_locale[1])
# CaseUnfold_13
name = "CaseUnfold_13"
diff --git a/enc/unicode/casefold.h b/enc/unicode/casefold.h
index 4ea8050..a433a22 100644
--- a/enc/unicode/casefold.h
+++ b/enc/unicode/casefold.h
@@ -1,7 +1,8 @@
/* DO NOT EDIT THIS FILE. */
/* Generated by enc/unicode/case-folding.rb */
-static const CaseFold_11_Type CaseFold[] = {
+static const CaseFold_11_Type CaseFold_11_Table[] = {
+#define CaseFold (*(CaseFold_11_Type (*)[1129])(CaseFold_11_Table+0))
{0x0041, {1, {0x0061}}},
{0x0042, {1, {0x0062}}},
{0x0043, {1, {0x0063}}},
@@ -1131,14 +1132,13 @@ static const CaseFold_11_Type CaseFold[] = {
{0x10425, {1, {0x1044d}}},
{0x10426, {1, {0x1044e}}},
{0x10427, {1, {0x1044f}}},
-};
-
-static const CaseFold_11_Type CaseFold_Locale[] = {
+#define CaseFold_Locale (*(CaseFold_11_Type (*)[2])(CaseFold_11_Table+1129))
{0x0049, {1, {0x0069}}},
{0x0130, {2, {0x0069, 0x0307}}},
};
-static const CaseUnfold_11_Type CaseUnfold_11[] = {
+static const CaseUnfold_11_Type CaseUnfold_11_Table[] = {
+#define CaseUnfold_11 (*(CaseUnfold_11_Type (*)[1005])(CaseUnfold_11_Table+0))
{0x0061, {1, {0x0041}}},
{0x0062, {1, {0x0042}}},
{0x0063, {1, {0x0043}}},
@@ -2144,13 +2144,12 @@ static const CaseUnfold_11_Type CaseUnfold_11[] = {
{0x1044d, {1, {0x10425}}},
{0x1044e, {1, {0x10426}}},
{0x1044f, {1, {0x10427}}},
-};
-
-static const CaseUnfold_11_Type CaseUnfold_11_Locale[] = {
+#define CaseUnfold_11_Locale (*(CaseUnfold_11_Type (*)[1])(CaseUnfold_11_Table+1005))
{0x0069, {1, {0x0049}}},
};
-static const CaseUnfold_12_Type CaseUnfold_12[] = {
+static const CaseUnfold_12_Type CaseUnfold_12_Table[] = {
+#define CaseUnfold_12 (*(CaseUnfold_12_Type (*)[58])(CaseUnfold_12_Table+0))
{{0x0061, 0x02be}, {1, {0x1e9a}}},
{{0x0066, 0x0066}, {1, {0xfb00}}},
{{0x0066, 0x0069}, {1, {0xfb01}}},
@@ -2209,13 +2208,12 @@ static const CaseUnfold_12_Type CaseUnfold_12[] = {
{{0x1f70, 0x03b9}, {1, {0x1fb2}}},
{{0x1f74, 0x03b9}, {1, {0x1fc2}}},
{{0x1f7c, 0x03b9}, {1, {0x1ff2}}},
-};
-
-static const CaseUnfold_12_Type CaseUnfold_12_Locale[] = {
+#define CaseUnfold_12_Locale (*(CaseUnfold_12_Type (*)[1])(CaseUnfold_12_Table+58))
{{0x0069, 0x0307}, {1, {0x0130}}},
};
-static const CaseUnfold_13_Type CaseUnfold_13[] = {
+static const CaseUnfold_13_Type CaseUnfold_13_Table[] = {
+#define CaseUnfold_13 (*(CaseUnfold_13_Type (*)[14])(CaseUnfold_13_Table+0))
{{0x0066, 0x0066, 0x0069}, {1, {0xfb03}}},
{{0x0066, 0x0066, 0x006c}, {1, {0xfb04}}},
{{0x03b1, 0x0342, 0x03b9}, {1, {0x1fb7}}},