mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Patch from Andrew Taylor to optimize the decomposition table to eliminate
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com> * glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch from Andrew Taylor to optimize the decomposition table to eliminate relocations and save space. (#64982)
This commit is contained in:
parent
f4fd840eaf
commit
2bbd00a263
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -1,3 +1,9 @@
|
||||
Tue Nov 20 20:54:25 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* glib/gunidecomp.[ch] glib/gen-unicode-tables.pl: Patch
|
||||
from Andrew Taylor to optimize the decomposition table
|
||||
to eliminate relocations and save space. (#64982)
|
||||
|
||||
2001-11-18 Hans Breuer <hans@breuer.org>
|
||||
|
||||
* glib/glib.def :
|
||||
|
@ -707,12 +707,14 @@ sub print_decomp
|
||||
print OUT " unsigned short ch;\n";
|
||||
print OUT " unsigned char canon_offset;\n";
|
||||
print OUT " unsigned char compat_offset;\n";
|
||||
print OUT " unsigned char *expansion;\n";
|
||||
print OUT " unsigned short expansion_offset;\n";
|
||||
print OUT "} decomposition;\n\n";
|
||||
|
||||
print OUT "static const decomposition decomp_table[] =\n{\n";
|
||||
my ($iter);
|
||||
my ($first) = 1;
|
||||
my ($decomp_string) = "";
|
||||
my ($decomp_string_offset) = 0;
|
||||
for ($count = 0; $count <= $last; ++$count)
|
||||
{
|
||||
if (defined $decompositions[$count])
|
||||
@ -749,18 +751,25 @@ sub print_decomp
|
||||
$string .= $compat_decomp;
|
||||
}
|
||||
|
||||
$bytes_out += (length $string) / 4; # "\x20"
|
||||
if (!defined($decomp_offsets{$string})) {
|
||||
$decomp_offsets{$string} = $decomp_string_offset;
|
||||
$decomp_string .= "\n \"".$string."\\0\\0\" /* offset ".
|
||||
$decomp_string_offset." */";
|
||||
$decomp_string_offset += ((length $string) / 4) + 2;
|
||||
|
||||
# Only a single terminator because one is implied in the string.
|
||||
printf OUT qq( { 0x%04x, %u, %u, "%s\\0" }),
|
||||
$count, $canon_offset, $compat_offset, $string;
|
||||
|
||||
$bytes_out += (length $string) / 4 + 2; # "\x20"
|
||||
}
|
||||
|
||||
printf OUT qq( { 0x%04x, %u, %u, %d }),
|
||||
$count, $canon_offset, $compat_offset, $decomp_offsets{$string};
|
||||
$bytes_out += 6;
|
||||
|
||||
}
|
||||
}
|
||||
print OUT "\n};\n\n";
|
||||
|
||||
printf OUT "static const char decomp_expansion_string[] = %s;\n\n", $decomp_string;
|
||||
|
||||
print OUT "#endif /* DECOMP_H */\n";
|
||||
|
||||
printf STDERR "Generated %d bytes in decomp tables\n", $bytes_out;
|
||||
|
@ -83,7 +83,7 @@ g_unicode_canonical_ordering (gunichar *string,
|
||||
}
|
||||
}
|
||||
|
||||
static guchar *
|
||||
static const guchar *
|
||||
find_decomposition (gunichar ch,
|
||||
gboolean compat)
|
||||
{
|
||||
@ -113,7 +113,7 @@ find_decomposition (gunichar ch,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return decomp_table[half].expansion + offset;
|
||||
return &(decomp_expansion_string[decomp_table[half].expansion_offset + offset]);
|
||||
}
|
||||
else if (half == start)
|
||||
break;
|
||||
@ -141,7 +141,7 @@ gunichar *
|
||||
g_unicode_canonical_decomposition (gunichar ch,
|
||||
gsize *result_len)
|
||||
{
|
||||
guchar *decomp = find_decomposition (ch, FALSE);
|
||||
const guchar *decomp = find_decomposition (ch, FALSE);
|
||||
gunichar *r;
|
||||
|
||||
if (decomp)
|
||||
@ -251,7 +251,7 @@ _g_utf8_normalize_wc (const gchar *str,
|
||||
{
|
||||
gunichar wc = g_utf8_get_char (p);
|
||||
|
||||
guchar *decomp = find_decomposition (wc, do_compat);
|
||||
const guchar *decomp = find_decomposition (wc, do_compat);
|
||||
|
||||
if (decomp)
|
||||
{
|
||||
@ -276,7 +276,7 @@ _g_utf8_normalize_wc (const gchar *str,
|
||||
while ((max_len < 0 || p < str + max_len) && *p)
|
||||
{
|
||||
gunichar wc = g_utf8_get_char (p);
|
||||
guchar *decomp;
|
||||
const guchar *decomp;
|
||||
int cc;
|
||||
gsize old_n_wc = n_wc;
|
||||
|
||||
|
9710
glib/gunidecomp.h
9710
glib/gunidecomp.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user