ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/gentables
(Generate patch)

Comparing rxvt-unicode/src/gentables (file contents):
Revision 1.2 by pcg, Wed Mar 3 00:20:33 2004 UTC vs.
Revision 1.5 by pcg, Mon Mar 15 01:27:46 2004 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2 2
3# the generated tables mostly have NOT been chcked so far! 3# the generated tables mostly have NOT been checked so far!
4 4
5use v5.8.2; 5use v5.8.2;
6use utf8; 6use utf8;
7use Encode; 7use Encode;
8 8
9my $gen; 9my $gen;
10
11$TO_UNICODE = 0; # also generate to_unicode tables
10 12
11sub linear { 13sub linear {
12 my ($a, $l, $h, $b) = @_; 14 my ($a, $l, $h, $b) = @_;
13 for ($l .. $h) { 15 for ($l .. $h) {
14 return unless defined $a->[$_] && $a->[$_] == $_ + ($b - $l); 16 return unless defined $a->[$_] && $a->[$_] == $_ + ($b - $l);
213 $enc1[$_] = $code; 215 $enc1[$_] = $code;
214 $enc2[$code] = $_ unless defined $enc2[$code]; 216 $enc2[$code] = $_ unless defined $enc2[$code];
215 } 217 }
216 } 218 }
217 219
220 my ($tab1, $fun1);
221 my ($tab2, $fun2);
222
218 my ($tab1, $fun1) = gen \@enc1, "$base\_f", "unicode"; 223 ($tab1, $fun1) = gen \@enc1, "$base\_f", "unicode";
219 my ($tab2, $fun2) = gen \@enc2, "$base\_t", "enc"; 224 ($tab2, $fun2) = gen \@enc2, "$base\_t", "enc" if $TO_UNICODE;
220 225
221 #$tab1 =~ s/^/ /gm;
222 #$tab2 =~ s/^/ /gm;
223 $fun1 =~ s/^/ /gm; 226 $fun1 =~ s/^/ /gm;
224 $fun2 =~ s/^/ /gm; 227 $fun2 =~ s/^/ /gm;
225 228
226 print "$base\n"; 229 print "$base\n";
227 open OUT, ">table/$base.h" or die; 230 open OUT, ">table/$base.h" or die;
232// 235//
233#ifdef ENCODING_$group 236#ifdef ENCODING_$group
234 237
235$tab1$tab2 238$tab1$tab2
236struct rxvt_codeset_conv_$base : rxvt_codeset_conv { 239struct rxvt_codeset_conv_$base : rxvt_codeset_conv {
237 uint32_t from_unicode (uint32_t unicode) const { 240 uint32_t from_unicode (unicode_t unicode) const {
238$fun1 } 241$fun1 }
242EOF
243
244if ($TO_UNICODE) {
245 print OUT <<EOF
246#if ENCODING_TO_UNICODE
239 uint32_t to_unicode (uint32_t enc) const { 247 unicode_t to_unicode (uint32_t enc) const {
240$fun2 } 248$fun2 }
249#endif
250EOF
251}
252
253print OUT <<EOF;
241} rxvt_codeset_conv_$base; 254} rxvt_codeset_conv_$base;
242 255
243#else 256#else
244 257
245#define rxvt_codeset_conv_$base rxvt_codeset_conv_unknown 258#define rxvt_codeset_conv_$base rxvt_codeset_conv_unknown
281EU iso8859_13 iso-8859-13 294EU iso8859_13 iso-8859-13
282EU iso8859_14 iso-8859-14 295EU iso8859_14 iso-8859-14
283DEFAULT iso8859_15 iso-8859-15 296DEFAULT iso8859_15 iso-8859-15
284EU iso8859_16 iso-8859-16 297EU iso8859_16 iso-8859-16
285JP jis0201_1976_0 jis0201-raw 298JP jis0201_1976_0 jis0201-raw
286JP jis0208_1983_0 jis0208-raw 299JP jis0208_1990_0 jis0208-raw
287JP jis0212_1990_0 jis0212-raw 300JP jis0212_1990_0 jis0212-raw
288JP_EXT jis0213_1 jis0213-1-raw 301JP_EXT jis0213_1 jis0213-1-raw
289JP_EXT jis0213_2 jis0213-2-raw 302JP_EXT jis0213_2 jis0213-2-raw

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines